Spaces:
Sleeping
Sleeping
Update inference.py
Browse files- inference.py +6 -7
inference.py
CHANGED
|
@@ -18,14 +18,13 @@ def load_model_and_tokenizer():
|
|
| 18 |
MODEL_REPO,
|
| 19 |
trust_remote_code=True,
|
| 20 |
)
|
| 21 |
-
|
| 22 |
model = AutoModelForCausalLM.from_pretrained(
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
|
| 30 |
return tokenizer, model
|
| 31 |
|
|
|
|
| 18 |
MODEL_REPO,
|
| 19 |
trust_remote_code=True,
|
| 20 |
)
|
|
|
|
| 21 |
model = AutoModelForCausalLM.from_pretrained(
|
| 22 |
+
MODEL_REPO,
|
| 23 |
+
trust_remote_code=True,
|
| 24 |
+
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
|
| 25 |
+
device_map="auto"
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
|
| 29 |
return tokenizer, model
|
| 30 |
|