from outetts.v0_1.interface import InterfaceHF, InterfaceGGUF
# Initialize the interface with the Hugging Face model
interface = InterfaceHF("OuteAI/OuteTTS-0.1-350M")
# Or initialize the interface with a GGUF model
# interface = InterfaceGGUF("path/to/model.gguf")
# Create a custom speaker from an audio file
speaker = interface.create_speaker(
"sample.wav",
"This is a test. This is a test. This is a test."
)
# Generate TTS with the custom voice
output = interface.generate(
text="This is a cloned voice speaking",
speaker=speaker,
temperature=0.1,
repetition_penalty=1.1,
max_lenght=4096
)
# Play the generated audio
output.play()
# Save the generated audio to a file
output.save("output.wav")
This is the error:
C:\Users\razva\tmp\outetts\venv\Lib\site-packages\torch\nn\utils\weight_norm.py:143: FutureWarning: `torch.nn.utils.weight_norm` is deprecated in favor of `torch.nn.utils.parametrizations.weight_norm`.
WeightNorm.apply(module, name, dim)
making attention of type 'vanilla' with 768 in_channels
C:\Users\razva\tmp\outetts\venv\Lib\site-packages\outetts\v0_1\decoder\pretrained.py:101: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
state_dict_raw = torch.load(model_path, map_location="cpu")['state_dict']
Traceback (most recent call last):
File "C:\Users\razva\tmp\outetts\ot.py", line 11, in <module>
speaker = interface.create_speaker(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\razva\tmp\outetts\venv\Lib\site-packages\outetts\v0_1\interface.py", line 59, in create_speaker
torchaudio.save(temp_file.name, full_audio, ctc.sample_rate)
File "C:\Users\razva\tmp\outetts\venv\Lib\site-packages\torchaudio\_backend\utils.py", line 313, in save
return backend.save(
^^^^^^^^^^^^^
File "C:\Users\razva\tmp\outetts\venv\Lib\site-packages\torchaudio\_backend\soundfile.py", line 44, in save
soundfile_backend.save(
File "C:\Users\razva\tmp\outetts\venv\Lib\site-packages\torchaudio\_backend\soundfile_backend.py", line 457, in save
soundfile.write(file=filepath, data=src, samplerate=sample_rate, subtype=subtype, format=format)
File "C:\Users\razva\tmp\outetts\venv\Lib\site-packages\soundfile.py", line 343, in write
with SoundFile(file, 'w', samplerate, channels,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\razva\tmp\outetts\venv\Lib\site-packages\soundfile.py", line 658, in __init__
self._file = self._open(file, mode_int, closefd)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\razva\tmp\outetts\venv\Lib\site-packages\soundfile.py", line 1216, in _open
raise LibsndfileError(err, prefix="Error opening {0!r}: ".format(self.name))
soundfile.LibsndfileError: Error opening 'c:\\tmp\\tmptv2lfdg_test.wav': System error.
This is the script:
This is the error: