Spaces:
Build error
Build error
Wisdom Chen
commited on
Update model.py
Browse files
model.py
CHANGED
|
@@ -88,21 +88,20 @@ def initialize_models() -> bool:
|
|
| 88 |
bnb_4bit_quant_type="nf4"
|
| 89 |
)
|
| 90 |
|
| 91 |
-
# Initialize tokenizer with
|
| 92 |
llm_tokenizer = AutoTokenizer.from_pretrained(
|
| 93 |
model_name,
|
| 94 |
-
|
| 95 |
-
padding_side="left", # Add this line
|
| 96 |
trust_remote_code=True
|
| 97 |
)
|
| 98 |
llm_tokenizer.pad_token = llm_tokenizer.eos_token
|
| 99 |
|
| 100 |
-
# Initialize model with updated parameters
|
| 101 |
llm_model = AutoModelForCausalLM.from_pretrained(
|
| 102 |
model_name,
|
|
|
|
|
|
|
| 103 |
device_map="auto",
|
| 104 |
torch_dtype=torch.float16,
|
| 105 |
-
quantization_config=quantization_config,
|
| 106 |
trust_remote_code=True
|
| 107 |
)
|
| 108 |
llm_model.eval()
|
|
|
|
| 88 |
bnb_4bit_quant_type="nf4"
|
| 89 |
)
|
| 90 |
|
| 91 |
+
# Initialize tokenizer with specific version requirements
|
| 92 |
llm_tokenizer = AutoTokenizer.from_pretrained(
|
| 93 |
model_name,
|
| 94 |
+
use_auth_token=hf_token, # Changed from token to use_auth_token
|
|
|
|
| 95 |
trust_remote_code=True
|
| 96 |
)
|
| 97 |
llm_tokenizer.pad_token = llm_tokenizer.eos_token
|
| 98 |
|
|
|
|
| 99 |
llm_model = AutoModelForCausalLM.from_pretrained(
|
| 100 |
model_name,
|
| 101 |
+
use_auth_token=hf_token, # Changed from token to use_auth_token
|
| 102 |
+
quantization_config=quantization_config,
|
| 103 |
device_map="auto",
|
| 104 |
torch_dtype=torch.float16,
|
|
|
|
| 105 |
trust_remote_code=True
|
| 106 |
)
|
| 107 |
llm_model.eval()
|