Spaces:
Sleeping
Sleeping
Update model_llm.py
Browse files- model_llm.py +8 -2
model_llm.py
CHANGED
@@ -15,13 +15,19 @@ from transformers import BitsAndBytesConfig
|
|
15 |
from threading import Thread
|
16 |
|
17 |
model_name = "mistralai/Mistral-7B-Instruct-v0.3"
|
|
|
18 |
|
19 |
# Auto-regressive model for language completion: padding left
|
20 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
|
|
|
|
|
|
|
|
21 |
model = AutoModelForCausalLM.from_pretrained(
|
22 |
model_name,
|
23 |
device_map="auto",
|
24 |
torch_dtype=torch.float16,
|
25 |
-
low_cpu_mem_usage=True
|
|
|
26 |
)
|
27 |
model = torch.compile(model)
|
|
|
15 |
from threading import Thread
|
16 |
|
17 |
model_name = "mistralai/Mistral-7B-Instruct-v0.3"
|
18 |
+
auth_token = os.environ.get("HF_TOKEN")
|
19 |
|
20 |
# Auto-regressive model for language completion: padding left
|
21 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
22 |
+
model_name,
|
23 |
+
padding_side="left",
|
24 |
+
use_auth_token=auth_token
|
25 |
+
)
|
26 |
model = AutoModelForCausalLM.from_pretrained(
|
27 |
model_name,
|
28 |
device_map="auto",
|
29 |
torch_dtype=torch.float16,
|
30 |
+
low_cpu_mem_usage=True,
|
31 |
+
use_auth_token=auth_token
|
32 |
)
|
33 |
model = torch.compile(model)
|