Spaces:
Sleeping
Sleeping
seapoe1809
commited on
Update darnabot.py
Browse files- darnabot.py +5 -4
darnabot.py
CHANGED
@@ -75,14 +75,15 @@ MODEL = os.environ.get("MODEL_ID")
|
|
75 |
|
76 |
device = "cuda"
|
77 |
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
device_map="auto",
|
83 |
ignore_mismatched_sizes=True)
|
84 |
|
85 |
|
|
|
86 |
async def chat(messages):
|
87 |
# Convert messages to the format required for the model
|
88 |
conversation = [{"role": "user", "content": msg['content']} if msg['role'] == "user"
|
|
|
75 |
|
76 |
device = "cuda"
|
77 |
|
78 |
+
|
79 |
+
# Authenticate if needed
|
80 |
+
tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-Nemo-Instruct-2407", use_auth_token="mistral_ai")
|
81 |
+
model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-Nemo-Instruct-2407", use_auth_token="mistral_ai", torch_dtype=torch.bfloat16,
|
82 |
device_map="auto",
|
83 |
ignore_mismatched_sizes=True)
|
84 |
|
85 |
|
86 |
+
|
87 |
async def chat(messages):
|
88 |
# Convert messages to the format required for the model
|
89 |
conversation = [{"role": "user", "content": msg['content']} if msg['role'] == "user"
|