Spaces:
Sleeping
Sleeping
Commit ·
d6ffd09
1
Parent(s): ae8a9d7
Fix build requirements and enable trust_remote_code
Browse files- app.py +2 -1
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -75,11 +75,12 @@ def get_pipeline(model_id):
|
|
| 75 |
"text-generation",
|
| 76 |
model=model_id,
|
| 77 |
device_map="auto",
|
|
|
|
| 78 |
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
|
| 79 |
)
|
| 80 |
models_cache[model_id] = pipe
|
| 81 |
except Exception as e:
|
| 82 |
-
raise gr.Error(f"Failed to load model {model_id}: {str(e)}")
|
| 83 |
return models_cache[model_id]
|
| 84 |
|
| 85 |
def respond(
|
|
|
|
| 75 |
"text-generation",
|
| 76 |
model=model_id,
|
| 77 |
device_map="auto",
|
| 78 |
+
trust_remote_code=True,
|
| 79 |
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
|
| 80 |
)
|
| 81 |
models_cache[model_id] = pipe
|
| 82 |
except Exception as e:
|
| 83 |
+
raise gr.Error(f"Failed to load model {model_id} locally: {str(e)}")
|
| 84 |
return models_cache[model_id]
|
| 85 |
|
| 86 |
def respond(
|
requirements.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
gradio>=5.9.1
|
| 2 |
huggingface_hub
|
| 3 |
python-dotenv
|
| 4 |
-
audioop-lts
|
| 5 |
transformers
|
| 6 |
torch
|
|
|
|
|
|
| 1 |
gradio>=5.9.1
|
| 2 |
huggingface_hub
|
| 3 |
python-dotenv
|
|
|
|
| 4 |
transformers
|
| 5 |
torch
|
| 6 |
+
accelerate
|