Spaces:
Sleeping
Sleeping
Ani07-05
commited on
Commit
·
c1eba4b
1
Parent(s):
1128154
Add sentencepiece and trust_remote_code for model loading
Browse files- app.py +2 -1
- requirements.txt +1 -0
app.py
CHANGED
@@ -30,7 +30,8 @@ def load_text_generation_pipeline():
|
|
30 |
tokenizer=MODEL_NAME, # Usually same as model
|
31 |
use_auth_token=HF_TOKEN if HF_TOKEN else None, # Use token if available
|
32 |
torch_dtype=torch.float16, # Use float16 to potentially save memory
|
33 |
-
device=device # Specify device placement
|
|
|
34 |
)
|
35 |
st.success(f"Model {MODEL_NAME} loaded successfully!")
|
36 |
return generator
|
|
|
30 |
tokenizer=MODEL_NAME, # Usually same as model
|
31 |
use_auth_token=HF_TOKEN if HF_TOKEN else None, # Use token if available
|
32 |
torch_dtype=torch.float16, # Use float16 to potentially save memory
|
33 |
+
device=device, # Specify device placement
|
34 |
+
trust_remote_code=True # <<< ADD THIS LINE
|
35 |
)
|
36 |
st.success(f"Model {MODEL_NAME} loaded successfully!")
|
37 |
return generator
|
requirements.txt
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
transformers>=4.30.0
|
2 |
torch>=2.0.0
|
3 |
streamlit>=1.20.0
|
|
|
4 |
# accelerate # Optional, might help with model loading
|
|
|
1 |
transformers>=4.30.0
|
2 |
torch>=2.0.0
|
3 |
streamlit>=1.20.0
|
4 |
+
sentencepiece
|
5 |
# accelerate # Optional, might help with model loading
|