Spaces:
Running
on
Zero
Running
on
Zero
Catch OSError while trying to load cached model
Browse filesFixes this:
```
File "/mnt/d/Documents/Workspace/audioEditing/models.py", line 536, in __init__
self.model = StableAudioPipeline.from_pretrained(self.model_id, token=self.token, local_files_only=True
OSError: We couldn't connect to 'https://huggingface.co' to load this model, couldn't find it in the cached files and it looks like *** is not the path to a directory containing a model_index.json file.
```
models.py
CHANGED
@@ -535,7 +535,7 @@ class StableAudWrapper(PipelineWrapper):
|
|
535 |
try:
|
536 |
self.model = StableAudioPipeline.from_pretrained(self.model_id, token=self.token, local_files_only=True
|
537 |
).to(self.device)
|
538 |
-
except FileNotFoundError:
|
539 |
self.model = StableAudioPipeline.from_pretrained(self.model_id, token=self.token, local_files_only=False
|
540 |
).to(self.device)
|
541 |
self.model.transformer.eval()
|
|
|
535 |
try:
|
536 |
self.model = StableAudioPipeline.from_pretrained(self.model_id, token=self.token, local_files_only=True
|
537 |
).to(self.device)
|
538 |
+
except (FileNotFoundError, OSError):
|
539 |
self.model = StableAudioPipeline.from_pretrained(self.model_id, token=self.token, local_files_only=False
|
540 |
).to(self.device)
|
541 |
self.model.transformer.eval()
|