Spaces:
Sleeping
Sleeping
update models.py
Browse files- modules/models.py +3 -1
modules/models.py
CHANGED
|
@@ -3,6 +3,7 @@ import re
|
|
| 3 |
from typing import *
|
| 4 |
|
| 5 |
import torch
|
|
|
|
| 6 |
from fairseq import checkpoint_utils
|
| 7 |
from fairseq.models.hubert.hubert import HubertModel
|
| 8 |
from pydub import AudioSegment
|
|
@@ -273,7 +274,8 @@ def get_vc_model(model_name: str):
|
|
| 273 |
else:
|
| 274 |
# Fallback to checkpoints folder
|
| 275 |
model_path = os.path.join(MODELS_DIR, "checkpoints", model_name)
|
| 276 |
-
|
|
|
|
| 277 |
weight = torch.load(model_path, map_location="cpu", weights_only=False)
|
| 278 |
return VoiceConvertModel(model_name, weight)
|
| 279 |
|
|
|
|
| 3 |
from typing import *
|
| 4 |
|
| 5 |
import torch
|
| 6 |
+
import fairseq
|
| 7 |
from fairseq import checkpoint_utils
|
| 8 |
from fairseq.models.hubert.hubert import HubertModel
|
| 9 |
from pydub import AudioSegment
|
|
|
|
| 274 |
else:
|
| 275 |
# Fallback to checkpoints folder
|
| 276 |
model_path = os.path.join(MODELS_DIR, "checkpoints", model_name)
|
| 277 |
+
|
| 278 |
+
torch.serialization.add_safe_globals([fairseq.data.dictionary.Dictionary])
|
| 279 |
weight = torch.load(model_path, map_location="cpu", weights_only=False)
|
| 280 |
return VoiceConvertModel(model_name, weight)
|
| 281 |
|