Yixuan Li
commited on
Commit
·
f634dc4
1
Parent(s):
e7d604d
forcing torch.load to CPU
Browse files
app.py
CHANGED
|
@@ -5,9 +5,9 @@ import soundfile as sf
|
|
| 5 |
|
| 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 |
-
|
|
|
|
| 11 |
|
| 12 |
import torchaudio
|
| 13 |
import hydra
|
|
|
|
| 5 |
|
| 6 |
# forcing torch.load to CPU
|
| 7 |
import torch
|
|
|
|
| 8 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 9 |
+
_old_load = torch.load
|
| 10 |
+
torch.load = lambda *a, **k: _old_load(*a, **({'map_location': device} | k if 'map_location' not in k else k))
|
| 11 |
|
| 12 |
import torchaudio
|
| 13 |
import hydra
|