myshell-ai / MeloTTS

High-quality multi-lingual text-to-speech library by MyShell.ai. Support English, Spanish, French, Chinese, Japanese and Korean.
MIT License
3.97k stars 473 forks source link

Embedding error for Chinese language #152

Closed zhouhao27 closed 4 days ago

zhouhao27 commented 5 days ago

Got the following error message:

File "/opt/miniconda3/envs/ollama/lib/python3.10/site-packages/torch/nn/functional.py", line 2264, in embedding return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse) RuntimeError: Placeholder storage has not been allocated on MPS device!

My code which caused the error message in model.tts_to_file:

            model = TTS(language=language, device=self._device)
            speaker_ids = model.hps.data.spk2id

            for speaker_key in speaker_ids.keys():
                speaker_id = speaker_ids[speaker_key]
                speaker_key = speaker_key.lower().replace('_', '-')
                speaker_model_path = f'modules/OpenVoice/checkpoints_v2/base_speakers/ses/{speaker_key}.pth'
                source_se = torch.load(speaker_model_path, map_location=self._device)
                model.tts_to_file(text, speaker_id, src_path, speed=speed)
                save_path = f'{self._output_dir}/output_v2_{speaker_key}_{language}.wav'

I tried all other languages. Only ZH and KR has issue. . But KR is different issue.

Anybody encounter the similar issue? How to solve it? Thanks.

zhouhao27 commented 4 days ago

Sorry, this is actually OpenVoice issue.