Spaces:
Runtime error
Runtime error
Yixuan Li
commited on
Commit
·
e7d604d
1
Parent(s):
1d3c046
forcing torch.load to CPU
Browse files
app.py
CHANGED
|
@@ -6,7 +6,8 @@ import soundfile as sf
|
|
| 6 |
# forcing torch.load to CPU
|
| 7 |
import torch
|
| 8 |
_old_load = torch.load
|
| 9 |
-
|
|
|
|
| 10 |
|
| 11 |
import torchaudio
|
| 12 |
import hydra
|
|
@@ -20,7 +21,6 @@ from huggingface_hub import hf_hub_download
|
|
| 20 |
import fairseq
|
| 21 |
|
| 22 |
register_omegaconf_resolvers()
|
| 23 |
-
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 24 |
config = OmegaConf.load("configs/infer.yaml")
|
| 25 |
|
| 26 |
ckpt_path = hf_hub_download(
|
|
|
|
| 6 |
# forcing torch.load to CPU
|
| 7 |
import torch
|
| 8 |
_old_load = torch.load
|
| 9 |
+
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 10 |
+
torch.load = lambda *a, **k: _old_load(*a, map_location=k.pop('map_location', device))
|
| 11 |
|
| 12 |
import torchaudio
|
| 13 |
import hydra
|
|
|
|
| 21 |
import fairseq
|
| 22 |
|
| 23 |
register_omegaconf_resolvers()
|
|
|
|
| 24 |
config = OmegaConf.load("configs/infer.yaml")
|
| 25 |
|
| 26 |
ckpt_path = hf_hub_download(
|