Update app.py
Browse files
app.py
CHANGED
@@ -64,7 +64,7 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
64 |
|
65 |
# model_id = "mistralai/Mistral-7B-v0.3"
|
66 |
|
67 |
-
model_id = "CohereForAI/aya-23-
|
68 |
|
69 |
|
70 |
tokenizer = AutoTokenizer.from_pretrained(
|
@@ -118,6 +118,7 @@ def respond(
|
|
118 |
|
119 |
messages.append({"role": "user", "content": message})
|
120 |
input_ids = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(accelerator.device) #.to('cuda')
|
|
|
121 |
## <BOS_TOKEN><|START_OF_TURN_TOKEN|><|USER_TOKEN|>Hello, how are you?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>
|
122 |
# with autocast():
|
123 |
gen_tokens = model.generate(
|
@@ -129,6 +130,7 @@ def respond(
|
|
129 |
|
130 |
gen_text = tokenizer.decode(gen_tokens[0])
|
131 |
print(gen_text)
|
|
|
132 |
yield gen_text
|
133 |
|
134 |
|
|
|
64 |
|
65 |
# model_id = "mistralai/Mistral-7B-v0.3"
|
66 |
|
67 |
+
model_id = "CohereForAI/aya-23-35B"
|
68 |
|
69 |
|
70 |
tokenizer = AutoTokenizer.from_pretrained(
|
|
|
118 |
|
119 |
messages.append({"role": "user", "content": message})
|
120 |
input_ids = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(accelerator.device) #.to('cuda')
|
121 |
+
print(input_ids)
|
122 |
## <BOS_TOKEN><|START_OF_TURN_TOKEN|><|USER_TOKEN|>Hello, how are you?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>
|
123 |
# with autocast():
|
124 |
gen_tokens = model.generate(
|
|
|
130 |
|
131 |
gen_text = tokenizer.decode(gen_tokens[0])
|
132 |
print(gen_text)
|
133 |
+
|
134 |
yield gen_text
|
135 |
|
136 |
|