You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from melo.api import TTS
texts = {
'EN_NEWEST': "Did you ever hear a folk tale about a giant turtle?", # The newest English base speaker model
'EN': "Did you ever hear a folk tale about a giant turtle?",
'ES': "El resplandor del sol acaricia las olas, pintando el cielo con una paleta deslumbrante.",
'FR': "La lueur doree du soleil caresse les vagues, peignant le ciel d'une palette eblouissante.",
'ZH': "在这次vacation中,我们计划去Paris欣赏埃菲尔铁塔和卢浮宫的美景。",
'JP': "彼は毎朝ジョギングをして体を健康に保っています。",
'KR': "안녕하세요! 오늘은 날씨가 정말 좋네요.",
}
src_path = f'{output_dir}/tmp.wav'
# Speed is adjustable
speed = 1.0
for language, text in texts.items():
model = TTS(language=language, device=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('_', '-')
source_se = torch.load(f'checkpoints_v2/base_speakers/ses/{speaker_key}.pth', map_location=device)
model.tts_to_file(text, speaker_id, src_path, speed=speed)
save_path = f'{output_dir}/output_v2_{speaker_key}.wav'
# Run the tone color converter
encode_message = "@MyShell"
tone_color_converter.convert(
audio_src_path=src_path,
src_se=source_se,
tgt_se=target_se,
output_path=save_path,
message=encode_message)
and error occrued like below
{
"name": "UnicodeEncodeError",
"message": "'ascii' codec can't encode characters in position 12-13: ordinal not in range(128)",
"stack": "---------------------------------------------------------------------------
UnicodeEncodeError Traceback (most recent call last)
Cell In[10], line 28
25 speaker_key = speaker_key.lower().replace('_', '-')
27 source_se = torch.load(f'checkpoints_v2/base_speakers/ses/{speaker_key}.pth', map_location=device)
---> 28 model.tts_to_file(text, speaker_id, src_path, speed=speed)
29 save_path = f'{output_dir}/output_v2_{speaker_key}.wav'
31 # Run the tone color converter
File d:\\OneDrive\\바탕 화면\\정통부 AI프로젝트\\.venv2\\lib\\site-packages\\melo\\api.py:100, in TTS.tts_to_file(self, text, speaker_id, output_path, sdp_ratio, noise_scale, noise_scale_w, speed, pbar, format, position, quiet)
98 t = re.sub(r'([a-z])([A-Z])', r'\\1 \\2', t)
99 device = self.device
--> 100 bert, ja_bert, phones, tones, lang_ids = utils.get_text_for_tts_infer(t, language, self.hps, device, self.symbol_to_id)
101 with torch.no_grad():
102 x_tst = phones.to(device).unsqueeze(0)
File d:\\OneDrive\\바탕 화면\\정통부 AI프로젝트\\.venv2\\lib\\site-packages\\melo\\utils.py:23, in get_text_for_tts_infer(text, language_str, hps, device, symbol_to_id)
22 def get_text_for_tts_infer(text, language_str, hps, device, symbol_to_id=None):
---> 23 norm_text, phone, tone, word2ph = clean_text(text, language_str)
24 phone, tone, language = cleaned_text_to_sequence(phone, tone, language_str, symbol_to_id)
26 if hps.data.add_blank:
File d:\\OneDrive\\바탕 화면\\정통부 AI프로젝트\\.venv2\\lib\\site-packages\\melo\\text\\cleaner.py:12, in clean_text(text, language)
10 language_module = language_module_map[language]
11 norm_text = language_module.text_normalize(text)
---> 12 phones, tones, word2ph = language_module.g2p(norm_text)
13 return norm_text, phones, tones, word2ph
File d:\\OneDrive\\바탕 화면\\정통부 AI프로젝트\\.venv2\\lib\\site-packages\\melo\\text\\french.py:49, in g2p(text, pad_start_end, tokenized)
47 phone_list = ['UNK']
48 else:
---> 49 phone_list = list(filter(lambda p: p != \" \", fr_to_ipa.fr2ipa(w)))
51 for ph in phone_list:
52 phones.append(ph)
File d:\\OneDrive\\바탕 화면\\정통부 AI프로젝트\\.venv2\\lib\\site-packages\\melo\\text\\fr_phonemizer\\fr_to_ipa.py:26, in fr2ipa(text)
24 e = Gruut(language=\"fr-fr\", keep_puncs=True, keep_stress=True, use_espeak_phonemes=True)
25 # text = french_cleaners(text)
---> 26 phonemes = e.phonemize(text, separator=\"\")
27 # print(phonemes)
28 phonemes = remove_consecutive_t(phonemes)
File d:\\OneDrive\\바탕 화면\\정통부 AI프로젝트\\.venv2\\lib\\site-packages\\melo\\text\\fr_phonemizer\\base.py:132, in BasePhonemizer.phonemize(self, text, separator, language)
130 phonemized = []
131 for t in text:
--> 132 p = self._phonemize(t, separator)
133 phonemized.append(p)
134 phonemized = self._phonemize_postprocess(phonemized, punctuations)
File d:\\OneDrive\\바탕 화면\\정통부 AI프로젝트\\.venv2\\lib\\site-packages\\melo\\text\\fr_phonemizer\\gruut_wrapper.py:110, in Gruut._phonemize(self, text, separator)
109 def _phonemize(self, text, separator):
--> 110 return self.phonemize_gruut(text, separator, tie=False)
File d:\\OneDrive\\바탕 화면\\정통부 AI프로젝트\\.venv2\\lib\\site-packages\\melo\\text\\fr_phonemizer\\gruut_wrapper.py:77, in Gruut.phonemize_gruut(self, text, separator, tie)
58 \"\"\"Convert input text to phonemes.
59
60 Gruut phonemizes the given `str` by seperating each phoneme character with `separator`, even for characters
(...)
74 with '_'. This option requires espeak>=1.49. Default to False.
75 \"\"\"
76 ph_list = []
---> 77 for sentence in gruut.sentences(text, lang=self.language, espeak=self.use_espeak_phonemes):
78 for word in sentence:
79 if word.is_break:
80 # Use actual character for break phoneme (e.g., comma)
File d:\\OneDrive\\바탕 화면\\정통부 AI프로젝트\\.venv2\\lib\\site-packages\\gruut\\__init__.py:79, in sentences(text, lang, ssml, espeak, major_breaks, minor_breaks, punctuations, explicit_lang, phonemes, break_phonemes, pos, **process_args)
76 _LOCAL.processors[model_prefix] = text_processor
78 assert text_processor is not None
---> 79 graph, root = text_processor(text, lang=lang, ssml=ssml, **process_args)
81 yield from text_processor.sentences(
82 graph,
83 root,
(...)
90 pos=pos,
91 )
File d:\\OneDrive\\바탕 화면\\정통부 AI프로젝트\\.venv2\\lib\\site-packages\\gruut\\text_processor.py:440, in TextProcessor.__call__(self, *args, **kwargs)
438 def __call__(self, *args, **kwargs):
439 \"\"\"Processes text or SSML\"\"\"
--> 440 return self.process(*args, **kwargs)
File d:\\OneDrive\\바탕 화면\\정통부 AI프로젝트\\.venv2\\lib\\site-packages\\gruut\\text_processor.py:1176, in TextProcessor.process(self, text, lang, ssml, pos, phonemize, post_process, add_speak_tag, detect_numbers, detect_currency, detect_dates, detect_times, verbalize_numbers, verbalize_currency, verbalize_dates, verbalize_times, max_passes)
1172 sentence_words.append(word_node)
1174 if sentence_words:
1175 # Final sentence
-> 1176 process_sentence(sentence_words)
1177 sentence_words = []
1179 if post_process:
1180 # Post-process sentences
File d:\\OneDrive\\바탕 화면\\정통부 AI프로젝트\\.venv2\\lib\\site-packages\\gruut\\text_processor.py:1099, in TextProcessor.process.<locals>.process_sentence(words)
1097 pos_settings = self.get_settings(node.lang)
1098 if pos_settings.get_parts_of_speech is not None:
-> 1099 pos_tags = pos_settings.get_parts_of_speech(
1100 [word.text for word in words]
1101 )
1102 for word, pos_tag in zip(words, pos_tags):
1103 word.pos = pos_tag
File d:\\OneDrive\\바탕 화면\\정통부 AI프로젝트\\.venv2\\lib\\site-packages\\gruut\\lang.py:858, in DelayedPartOfSpeechTagger.__call__(self, words)
856 if self.tagger is None:
857 _LOGGER.debug(\"Loading part of speech tagger from %s\", self.model_path)
--> 858 self.tagger = PartOfSpeechTagger(self.model_path, **self.tagger_args)
860 assert self.tagger is not None
861 return self.tagger(words)
File d:\\OneDrive\\바탕 화면\\정통부 AI프로젝트\\.venv2\\lib\\site-packages\\gruut\\pos.py:63, in PartOfSpeechTagger.__init__(self, crf_tagger, **kwargs)
60 else:
61 # Load model
62 self.crf_tagger = pycrfsuite.Tagger()
---> 63 self.crf_tagger.open(str(crf_tagger))
File pycrfsuite/_pycrfsuite.pyx:572, in pycrfsuite._pycrfsuite.Tagger.open()
File <stringsource>:15, in string.from_py.__pyx_convert_string_from_py_std__in_string()
UnicodeEncodeError: 'ascii' codec can't encode characters in position 12-13: ordinal not in range(128)"
}
This problem has been driving me crazy for days
I also do '$env:PYTHONIOENCODING="UTF-8"' this but didn't work.
please help me
The text was updated successfully, but these errors were encountered:
I run code below
and error occrued like below
This problem has been driving me crazy for days
I also do '$env:PYTHONIOENCODING="UTF-8"' this but didn't work.
please help me
The text was updated successfully, but these errors were encountered: