I have this code import requests import json download the files from the website url =…
- User
I have this code
import requests import json
# download the files from the website url = "https://huggingface.co/HuggingFaceH4/starchat-alpha/tree/main" files = [“model.tar.gz”, “vocab.json”, “merges.txt”] for file in files: response = requests.get(url + file) with open(file, “wb”) as f: f.write(response.content)
# load the downloaded files into a chatbot from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
tokenizer = AutoTokenizer.from_pretrained(”./“) model = AutoModelForCausalLM.from_pretrained(”./") chatbot = pipeline(“text-generation”, model=model, tokenizer=tokenizer)
# interact with the chatbot while True: user_input = input("You: ") response = chatbot(user_input) print(“Bot:”, response[0][“generated_text”]) and this error File "", line 6 files = [“model.tar.gz”, “vocab.json”, “merges.txt”] ^ SyntaxError: invalid character '“' (U+201C)
- Assistant
The error is due to the use of curly double quotes ("“" and "”") instead of straight double quotes ("). Replace all instances of curly double quotes with straight double quotes in line 6:
files = ["model.tar.gz", "vocab.json", "merges.txt"]