Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -54,7 +54,7 @@ model = AutoModelForCausalLM.from_pretrained("CreativeWorksAi/CreativeWorks_Mist
|
|
| 54 |
#model = AutoModelForCausalLM.from_pretrained("meta-llama/Meta-Llama-3-8B-Instruct", device_map="auto") # to("cuda:0")
|
| 55 |
terminators = [
|
| 56 |
tokenizer.eos_token_id,
|
| 57 |
-
tokenizer.convert_tokens_to_ids("
|
| 58 |
]
|
| 59 |
|
| 60 |
@spaces.GPU(duration=120)
|
|
@@ -75,8 +75,8 @@ def chat_llama3_8b(message: str,
|
|
| 75 |
"""
|
| 76 |
conversation = []
|
| 77 |
for user, assistant in history:
|
| 78 |
-
conversation.extend([{"
|
| 79 |
-
conversation.append({"
|
| 80 |
|
| 81 |
input_ids = tokenizer.apply_chat_template(conversation, return_tensors="pt").to(model.device)
|
| 82 |
|
|
|
|
| 54 |
#model = AutoModelForCausalLM.from_pretrained("meta-llama/Meta-Llama-3-8B-Instruct", device_map="auto") # to("cuda:0")
|
| 55 |
terminators = [
|
| 56 |
tokenizer.eos_token_id,
|
| 57 |
+
tokenizer.convert_tokens_to_ids("</s>")
|
| 58 |
]
|
| 59 |
|
| 60 |
@spaces.GPU(duration=120)
|
|
|
|
| 75 |
"""
|
| 76 |
conversation = []
|
| 77 |
for user, assistant in history:
|
| 78 |
+
conversation.extend([{"from": "human", "value": user}, {"from": "assistant", "value": assistant}])
|
| 79 |
+
conversation.append({"from": "human", "value": message})
|
| 80 |
|
| 81 |
input_ids = tokenizer.apply_chat_template(conversation, return_tensors="pt").to(model.device)
|
| 82 |
|