VALL-E-X icon indicating copy to clipboard operation
VALL-E-X copied to clipboard

[Windows] UnicodeEncodeError: 'charmap' codec can't encode characters

Open nekogecko2 opened this issue 1 year ago • 6 comments

Any other windows users dealing with this error? I don't have this bug if I run it through WSL or google colab.

If I try to clone any japanese voice, I get this error. I assume it might happen with chinese voices too

It works fine with English voices.

Full error

File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 4-43: character maps to <undefined>

nekogecko2 avatar Aug 29 '23 22:08 nekogecko2

Please show me the cmd window and ui screenshot when it appears, and the corresponding input. I can't reproduce this problem on my computer.

hkzbiyx avatar Aug 30 '23 08:08 hkzbiyx

Maybe you can try creating a new text file and putting the Japanese you entered into it, then save it as utf-8 encoding.

hkzbiyx avatar Aug 30 '23 08:08 hkzbiyx

Please present more details about how you caused this error. Are you using through web UI or code? Which language you are typing into? What text did you try to synthesize? Better if you provide some screenshots. Thanks.

Plachtaa avatar Aug 30 '23 10:08 Plachtaa

Sorry! I'm using it through Web UI. I'm typing it with english

The problem occurs when I try to clone any japanese voice. If I clone a english voice or clone a english voice to speak japanese, it works fine.

Here's the full output from the terminal when I try to run any Japanese audio. Example audio file I used: https://vocaroo.com/11fwIvmV4XAi

Detected language: ja
俺の名前を一生覚えてろ。俺は、海賊王に成る男だ!
Traceback (most recent call last):
  File "C:\Users\user1\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\gradio\routes.py", line 488, in run_predict
    output = await app.get_blocks().process_api(
  File "C:\Users\user1\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\gradio\blocks.py", line 1431, in process_api
    result = await self.call_function(
  File "C:\Users\user1\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\gradio\blocks.py", line 1109, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "C:\Users\user1\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\anyio\to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "C:\Users\user1\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\anyio\_backends\_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "C:\Users\user1\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\anyio\_backends\_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "C:\Users\user1\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\gradio\utils.py", line 706, in wrapper
    response = f(*args, **kwargs)
  File "C:\Users\user1\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "E:\VALL-E-X\launch-ui.py", line 238, in infer_from_audio
    text_pr, lang_pr = make_prompt('dummy', wav_pr, sr, save=False)
  File "E:\VALL-E-X\launch-ui.py", line 212, in make_prompt
    f.write(text)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 4-26: character maps to <undefined>

nekogecko2 avatar Aug 30 '23 23:08 nekogecko2

FOUND THE SOLUTION TO THE ISSUE!

If anyone else has this issue, add "-X utf8" to python

so run the command python -X utf8 launch-ui.py

This might be a issue for english Windows users like me who doesn't have the Chinese or Japanese language installed on their computer? 😅 I don't know

nekogecko2 avatar Aug 31 '23 00:08 nekogecko2

Thank you for your feedback. We will solve this problem.

hkzbiyx avatar Aug 31 '23 09:08 hkzbiyx