Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -27,17 +27,15 @@ def load_model():
|
|
27 |
"""Loads the Mistral model and tokenizer and updates the load status."""
|
28 |
global tokenizer, model, model_loaded
|
29 |
try:
|
30 |
-
if
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
)
|
40 |
-
model.to('cuda')
|
41 |
model_loaded = True
|
42 |
return "✅ Model Loaded!"
|
43 |
except Exception as e:
|
|
|
27 |
"""Loads the Mistral model and tokenizer and updates the load status."""
|
28 |
global tokenizer, model, model_loaded
|
29 |
try:
|
30 |
+
if tokenizer is None:
|
31 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name, token=hf_token)
|
32 |
+
if model is None:
|
33 |
+
model = AutoModelForCausalLM.from_pretrained(
|
34 |
+
model_name,
|
35 |
+
token=hf_token,
|
36 |
+
torch_dtype=torch.float16
|
37 |
+
)
|
38 |
+
model.to('cuda')
|
|
|
|
|
39 |
model_loaded = True
|
40 |
return "✅ Model Loaded!"
|
41 |
except Exception as e:
|