Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ Join us : 🌟TeamTonic🌟 is always making cool demos! Join our active builder
|
|
20 |
|
21 |
tokenizer = AutoModelForCausalLM.from_pretrained(model_id)
|
22 |
tokenizer = YiTokenizer.from_pretrained(tokenizer_path)
|
23 |
-
model = AutoModelForCausalLM.from_pretrained(model_id
|
24 |
|
25 |
def format_prompt(user_message, system_message="I am YiTonic, an AI language model created by Tonic-AI. I am a cautious assistant. I carefully follow instructions. I am helpful and harmless and I follow ethical guidelines and promote positive behavior."):
|
26 |
prompt = f"<|im_start|>assistant\n{self.system_message}<|im_end|>\n<|im_start|>\nuser\n{user_message}<|im_end|>\nassistant\n"
|
|
|
20 |
|
21 |
tokenizer = AutoModelForCausalLM.from_pretrained(model_id)
|
22 |
tokenizer = YiTokenizer.from_pretrained(tokenizer_path)
|
23 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True)
|
24 |
|
25 |
def format_prompt(user_message, system_message="I am YiTonic, an AI language model created by Tonic-AI. I am a cautious assistant. I carefully follow instructions. I am helpful and harmless and I follow ethical guidelines and promote positive behavior."):
|
26 |
prompt = f"<|im_start|>assistant\n{self.system_message}<|im_end|>\n<|im_start|>\nuser\n{user_message}<|im_end|>\nassistant\n"
|