Spaces:
Runtime error
Runtime error
Yixuan Li
commited on
Commit
·
1d3c046
1
Parent(s):
9b761cd
forcing torch.load to CPU
Browse files
app.py
CHANGED
|
@@ -2,7 +2,12 @@ import gradio as gr
|
|
| 2 |
from pathlib import Path
|
| 3 |
|
| 4 |
import soundfile as sf
|
|
|
|
|
|
|
| 5 |
import torch
|
|
|
|
|
|
|
|
|
|
| 6 |
import torchaudio
|
| 7 |
import hydra
|
| 8 |
from omegaconf import OmegaConf
|
|
|
|
| 2 |
from pathlib import Path
|
| 3 |
|
| 4 |
import soundfile as sf
|
| 5 |
+
|
| 6 |
+
# forcing torch.load to CPU
|
| 7 |
import torch
|
| 8 |
+
_old_load = torch.load
|
| 9 |
+
torch.load = lambda *a, **k: _old_load(*a, **{**k, 'map_location': 'cpu'})
|
| 10 |
+
|
| 11 |
import torchaudio
|
| 12 |
import hydra
|
| 13 |
from omegaconf import OmegaConf
|