forked from coqui-ai/TTS
-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: only enable load with weights_only in pytorch>=2.4
Allows moving the minimum Pytorch version back to 2.1
- Loading branch information
Showing
17 changed files
with
89 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,33 @@ | ||
import _codecs | ||
import importlib.metadata | ||
from collections import defaultdict | ||
|
||
import numpy as np | ||
import torch | ||
|
||
from TTS.config.shared_configs import BaseDatasetConfig | ||
from TTS.tts.configs.xtts_config import XttsConfig | ||
from TTS.tts.models.xtts import XttsArgs, XttsAudioConfig | ||
from TTS.utils.radam import RAdam | ||
from TTS.utils.generic_utils import is_pytorch_at_least_2_4 | ||
|
||
__version__ = importlib.metadata.version("coqui-tts") | ||
|
||
|
||
torch.serialization.add_safe_globals([dict, defaultdict, RAdam]) | ||
if is_pytorch_at_least_2_4(): | ||
import _codecs | ||
from collections import defaultdict | ||
|
||
import numpy as np | ||
import torch | ||
|
||
from TTS.config.shared_configs import BaseDatasetConfig | ||
from TTS.tts.configs.xtts_config import XttsConfig | ||
from TTS.tts.models.xtts import XttsArgs, XttsAudioConfig | ||
from TTS.utils.radam import RAdam | ||
|
||
torch.serialization.add_safe_globals([dict, defaultdict, RAdam]) | ||
|
||
# Bark | ||
torch.serialization.add_safe_globals( | ||
[ | ||
np.core.multiarray.scalar, | ||
np.dtype, | ||
np.dtypes.Float64DType, | ||
_codecs.encode, # TODO: safe by default from Pytorch 2.5 | ||
] | ||
) | ||
# Bark | ||
torch.serialization.add_safe_globals( | ||
[ | ||
np.core.multiarray.scalar, | ||
np.dtype, | ||
np.dtypes.Float64DType, | ||
_codecs.encode, # TODO: safe by default from Pytorch 2.5 | ||
] | ||
) | ||
|
||
# XTTS | ||
torch.serialization.add_safe_globals([BaseDatasetConfig, XttsConfig, XttsAudioConfig, XttsArgs]) | ||
# XTTS | ||
torch.serialization.add_safe_globals([BaseDatasetConfig, XttsConfig, XttsAudioConfig, XttsArgs]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.