UnicodeDecodeError: 'cp950' codec can't decode byte 0xec in position 135: illegal multibyte sequence

If training is failing to start, and you are not receiving an error message telling you what to do, tell us about it here


Forum rules

Read the FAQs and search the forum before posting a new topic.

This forum is for reporting errors with the Training process. If you want to get tips, or better understand the Training process, then you should look in the Training Discussion forum.

Please mark any answers that fixed your problems so others can find the solutions.

Locked
User avatar
Aaronplayh
Posts: 3
Joined: Mon Jun 26, 2023 7:23 am

UnicodeDecodeError: 'cp950' codec can't decode byte 0xec in position 135: illegal multibyte sequence

Post by Aaronplayh »

Please help!!!
I can't train my video and I don't know why,I am a noob.The video is download from facebook by online tool.I know the problem but I can't sfine the way to encode the code.I find lots in internet but still not work.
Can everyone help me?
The problems:

===========

Code: Select all

Loading...
Setting Faceswap backend to NVIDIA
06/26/2023 15:11:14 INFO     Log level set to: INFO
06/26/2023 15:11:17 INFO     Model A Directory: 'C:\Users\AaronChan\Desktop\Game\ai\A\a' (95 images)
06/26/2023 15:11:17 INFO     Model B Directory: 'C:\Users\AaronChan\Desktop\Game\ai\B\b' (1132 images)
06/26/2023 15:11:17 WARNING  At least one of your input folders contains fewer than 250 images. Results are likely to be poor.
06/26/2023 15:11:17 WARNING  You need to provide a significant number of images to successfully train a Neural Network. Aim for between 500 - 5000 images per side.
06/26/2023 15:11:17 INFO     Training data directory: C:\Users\AaronChan\Desktop\Game\ai\model
06/26/2023 15:11:17 INFO     ===================================================
06/26/2023 15:11:17 INFO       Starting
06/26/2023 15:11:17 INFO     ===================================================
06/26/2023 15:11:17 INFO     Loading data, this may take a while...
06/26/2023 15:11:17 INFO     Loading Model from Phaze_A plugin...
06/26/2023 15:11:18 INFO     No existing state file found. Generating.
06/26/2023 15:11:18 INFO     Storing Mixed Precision compatible layers. Please ignore any following warnings about using mixed precision.
06/26/2023 15:11:18 INFO     Mixed precision compatibility check (mixed_float16): OK\nYour GPU will likely run quickly with dtype policy mixed_float16 as it has compute capability of at least 7.0. Your GPU: NVIDIA GeForce RTX 3060 Laptop GPU, compute capability 8.6
06/26/2023 15:11:20 INFO     Loading Trainer from Original plugin...

WTL: Caching Landmarks (A):   0%|          | 0/95 [00:00<?, ?it/s]
WTL: Caching Landmarks (A):  22%|██▏       | 21/95 [00:00<00:00, 209.96it/s]


WTL: Caching Landmarks (B):   0%|          | 0/1132 [00:00<?, ?it/s]
WTL: Caching Landmarks (B):   0%|          | 1/1132 [00:00<03:00,  6.26it/s]
WTL: Caching Landmarks (B):  10%|▉         | 113/1132 [00:00<00:02, 493.00it/s]
WTL: Caching Landmarks (B):  16%|█▌        | 178/1132 [00:00<00:01, 540.60it/s]
WTL: Caching Landmarks (B):  21%|██        | 237/1132 [00:00<00:01, 448.49it/s]
WTL: Caching Landmarks (B):  26%|██▌       | 296/1132 [00:00<00:01, 488.42it/s]
WTL: Caching Landmarks (B):  32%|███▏      | 358/1132 [00:00<00:01, 526.15it/s]
WTL: Caching Landmarks (B):  37%|███▋      | 418/1132 [00:00<00:01, 509.57it/s]
WTL: Caching Landmarks (B):  44%|████▎     | 494/1132 [00:00<00:01, 573.37it/s]
WTL: Caching Landmarks (B):  49%|████▉     | 554/1132 [00:01<00:01, 574.22it/s]
WTL: Caching Landmarks (B):  54%|█████▍    | 613/1132 [00:01<00:01, 457.99it/s]
WTL: Caching Landmarks (B):  60%|█████▉    | 675/1132 [00:01<00:00, 494.45it/s]
WTL: Caching Landmarks (B):  65%|██████▍   | 734/1132 [00:01<00:00, 513.80it/s]
WTL: Caching Landmarks (B):  70%|███████   | 797/1132 [00:01<00:00, 539.79it/s]
WTL: Caching Landmarks (B):  76%|███████▌  | 860/1132 [00:01<00:00, 548.27it/s]
WTL: Caching Landmarks (B):  81%|████████▏ | 920/1132 [00:01<00:00, 562.29it/s]
WTL: Caching Landmarks (B):  86%|████████▋ | 979/1132 [00:01<00:00, 560.99it/s]
WTL: Caching Landmarks (B):  92%|█████████▏| 1037/1132 [00:02<00:00, 446.69it/s]
WTL: Caching Landmarks (B):  97%|█████████▋| 1094/1132 [00:02<00:00, 470.08it/s]

06/26/2023 15:11:39 INFO     [Saved models] - Average loss since last save: face_a: 0.41034, face_b: 0.38531

06/26/2023 15:11:40 INFO     [Preview Updated]

Exception in thread Thread-13:
Traceback (most recent call last):
  File "C:\Users\AaronChan\MiniConda3\envs\faceswap\lib\threading.py", line 980, in _bootstrap_inner
    self.run()
  File "C:\Users\AaronChan\MiniConda3\envs\faceswap\lib\threading.py", line 917, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\AaronChan\faceswap\lib\gui\wrapper.py", line 269, in read_stderr
    output = self.process.stderr.readline()
UnicodeDecodeError: 'cp950' codec can't decode byte 0xec in position 135: illegal multibyte sequence
```
==========
Last edited by torzdf on Tue Jun 27, 2023 9:55 am, edited 1 time in total.

Tags:
User avatar
torzdf
Posts: 2697
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 136 times
Been thanked: 631 times

Re: UnicodeDecodeError: 'cp950' codec can't decode byte 0xec in position 135: illegal multibyte sequence

Post by torzdf »

I'm going to put the 'Bug' tag on this, to see if there is anything I can do to fix this in the code.

In the meantime, you can try the following

Navigate to the file C:\Users\AaronChan\faceswap\faceswap_win_launcher.bat and open it up it Notepad.

At the beginning of the line (not on a different line, it needs to go on the same line as the existing command) prefix it with

Code: Select all

chcp 65001 && 

The final command should be something like (the paths may be slightly different for your final setup):

Code: Select all

chcp 65001 && "C:\Users\AaronChan\MiniConda3\scripts\activate.bat" && conda activate "faceswap" && python "C:\Users\AaronChan\faceswap/faceswap.py" gui

Save the file and try Faceswap again.

Let me know if this works, because I haven't tested it.

Last edited by torzdf on Tue Jun 27, 2023 10:25 am, edited 2 times in total.

My word is final

User avatar
SwS_Kz
Posts: 1
Joined: Thu Jun 29, 2023 2:18 am

Exception in thread Thread-3 + Exception in thread Thread-4 report error

Post by SwS_Kz »

i am a novice , It doesn't work and I can't find a solution
please help me

Code: Select all

Exception in thread Thread-3 (read_stdout):
Traceback (most recent call last):
  File "C:\Users\sws_kz\MiniConda3\envs\faceswap\lib\threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "C:\Users\sws_kz\MiniConda3\envs\faceswap\lib\threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\sws_kz\faceswap\lib\gui\wrapper.py", line 242, in read_stdout
    output = self.process.stdout.readline()
UnicodeDecodeError: 'cp950' codec can't decode byte 0x8c in position 76: illegal multibyte sequence
Exception in thread Thread-4 (read_stderr):
Traceback (most recent call last):
  File "C:\Users\sws_kz\MiniConda3\envs\faceswap\lib\threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "C:\Users\sws_kz\MiniConda3\envs\faceswap\lib\threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\sws_kz\faceswap\lib\gui\wrapper.py", line 269, in read_stderr
    output = self.process.stderr.readline()
UnicodeDecodeError: 'cp950' codec can't decode byte 0x8c in position 95: illegal multibyte sequence
Last edited by torzdf on Thu Jun 29, 2023 8:33 am, edited 1 time in total.
User avatar
torzdf
Posts: 2697
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 136 times
Been thanked: 631 times

Re: UnicodeDecodeError: 'cp950' codec can't decode byte 0xec in position 135: illegal multibyte sequence

Post by torzdf »

See above messge (viewtopic.php?p=9156#p9156)

Please let me know if this works, as if it does I will look to put in a permanent solution

My word is final

User avatar
Aaronplayh
Posts: 3
Joined: Mon Jun 26, 2023 7:23 am

Re: UnicodeDecodeError: 'cp950' codec can't decode byte 0xec in position 135: illegal multibyte sequence

Post by Aaronplayh »

torzdf thank you so much the reply,I try your way but still not work, that faceswap change another error

this is the following code:
Loading...
Setting Faceswap backend to NVIDIA
06/30/2023 10:50:56 INFO Log level set to: INFO
06/30/2023 10:50:59 INFO Model A Directory: 'C:\Users\AaronChan\Desktop\Game\ai\A\a' (95 images)
06/30/2023 10:50:59 INFO Model B Directory: 'C:\Users\AaronChan\Desktop\Game\ai\B\b' (1132 images)
06/30/2023 10:50:59 WARNING At least one of your input folders contains fewer than 250 images. Results are likely to be poor.
06/30/2023 10:50:59 WARNING You need to provide a significant number of images to successfully train a Neural Network. Aim for between 500 - 5000 images per side.
06/30/2023 10:50:59 INFO Training data directory: C:\Users\AaronChan\Desktop\Game\ai\model
06/30/2023 10:50:59 INFO ===================================================
06/30/2023 10:50:59 INFO Starting
06/30/2023 10:50:59 INFO ===================================================
06/30/2023 10:50:59 INFO Loading data, this may take a while...
06/30/2023 10:50:59 INFO Loading Model from Phaze_A plugin...
06/30/2023 10:51:00 INFO Config item: 'freeze_layers' has been updated from '[]' to '['keras_encoder']'
06/30/2023 10:51:00 INFO Using configuration saved in state file
06/30/2023 10:51:01 INFO Loaded model from disk: 'C:\Users\AaronChan\Desktop\Game\ai\model\phaze_a.h5'
06/30/2023 10:51:01 INFO Loading Trainer from Original plugin...

WTL: Caching Landmarks (A): 0%| | 0/95 [00:00<?, ?it/s]
WTL: Caching Landmarks (A): 1%| | 1/95 [00:00<00:19, 4.78it/s]

WTL: Caching Landmarks (B): 0%| | 0/1132 [00:00<?, ?it/s]
WTL: Caching Landmarks (B): 0%| | 1/1132 [00:00<03:06, 6.06it/s]
WTL: Caching Landmarks (B): 12%|█▏ | 139/1132 [00:00<00:01, 630.18it/s]
WTL: Caching Landmarks (B): 19%|█▉ | 217/1132 [00:00<00:01, 653.84it/s]
WTL: Caching Landmarks (B): 26%|██▌ | 291/1132 [00:00<00:01, 515.93it/s]
WTL: Caching Landmarks (B): 31%|███ | 351/1132 [00:00<00:01, 527.15it/s]
WTL: Caching Landmarks (B): 37%|███▋ | 417/1132 [00:00<00:01, 563.47it/s]
WTL: Caching Landmarks (B): 42%|████▏ | 478/1132 [00:00<00:01, 573.95it/s]
WTL: Caching Landmarks (B): 48%|████▊ | 539/1132 [00:00<00:01, 570.50it/s]
WTL: Caching Landmarks (B): 55%|█████▌ | 626/1132 [00:01<00:00, 639.64it/s]
WTL: Caching Landmarks (B): 61%|██████▏ | 694/1132 [00:01<00:00, 524.38it/s]
WTL: Caching Landmarks (B): 67%|██████▋ | 761/1132 [00:01<00:00, 550.80it/s]
WTL: Caching Landmarks (B): 73%|███████▎ | 830/1132 [00:01<00:00, 578.62it/s]
WTL: Caching Landmarks (B): 79%|███████▊ | 891/1132 [00:01<00:00, 545.77it/s]
WTL: Caching Landmarks (B): 84%|████████▍ | 955/1132 [00:01<00:00, 565.95it/s]
WTL: Caching Landmarks (B): 90%|█████████ | 1021/1132 [00:01<00:00, 578.73it/s]
WTL: Caching Landmarks (B): 96%|█████████▌| 1084/1132 [00:01<00:00, 591.40it/s]

06/30/2023 10:51:23 INFO [Saved models] - Average loss since last save: face_a: 0.36866, face_b: 0.36050

06/30/2023 10:51:24 INFO [Preview Updated]

Exception in thread Thread-7:
Traceback (most recent call last):
File "C:\Users\AaronChan\MiniConda3\envs\faceswap\lib\threading.py", line 980, in bootstrap_inner
self.run()
File "C:\Users\AaronChan\MiniConda3\envs\faceswap\lib\threading.py", line 917, in run
self.
target(*self.args, **self.kwargs)
File "C:\Users\AaronChan\faceswap\lib\gui\wrapper.py", line 269, in read_stderr
output = self.process.stderr.readline()
UnicodeDecodeError: 'cp950' codec can't decode byte 0xec in position 134: illegal multibyte sequence

User avatar
torzdf
Posts: 2697
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 136 times
Been thanked: 631 times

Re: UnicodeDecodeError: 'cp950' codec can't decode byte 0xec in position 135: illegal multibyte sequence

Post by torzdf »

I have pushed an update which hopefully fixes this issue, but I am unable to test it.

Please could you update faceswap and see if it works and let me know. If it does not work, please post the latest crash report.

My word is final

User avatar
YTY
Posts: 1
Joined: Fri Jun 30, 2023 10:57 pm

Re: UnicodeDecodeError: 'cp950' codec can't decode byte 0xec in position 135: illegal multibyte sequence

Post by YTY »

Code: Select all

07/01/2023 06:53:11 INFO     Log level set to: INFO
07/01/2023 06:53:14 INFO     Loading Detect from S3Fd plugin...
07/01/2023 06:53:14 INFO     Loading Align from Fan plugin...
07/01/2023 06:53:14 INFO     Loading Mask from Components plugin...
07/01/2023 06:53:14 INFO     Loading Mask from Extended plugin...
07/01/2023 06:53:14 WARNING  Not enough free VRAM for parallel processing. Switching to serial
07/01/2023 06:53:14 INFO     Reset batch sizes due to available VRAM: Detect: 1
07/01/2023 06:53:14 INFO     Starting, this may take a while...
07/01/2023 06:53:14 INFO     Output Directory: C:\Users\24296\Desktop\B

07/01/2023 06:53:14 INFO     Initializing S3FD (Detect)...
07/01/2023 06:53:15 INFO     Initialized S3FD (Detect) with batchsize of 1

Exception in thread Thread-6 (_read_stdout):
Traceback (most recent call last):
  File "C:\Users\24296\MiniConda3\envs\faceswap\lib\threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "C:\Users\24296\MiniConda3\envs\faceswap\lib\threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\24296\faceswap\lib\gui\wrapper.py", line 331, in _read_stdout
    output: str = buff.readline()
  File "C:\Users\24296\MiniConda3\envs\faceswap\lib\codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa8 in position 35: invalid start byte
Last edited by torzdf on Sat Jul 01, 2023 9:47 am, edited 1 time in total.
User avatar
torzdf
Posts: 2697
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 136 times
Been thanked: 631 times

Re: UnicodeDecodeError: 'cp950' codec can't decode byte 0xec in position 135: illegal multibyte sequence

Post by torzdf »

Ugggh, always Windows.

I have pushed another fix. This just allows decoding errors, but doesn't decode problematic characters. Would be interested to see if this works, and what the output anyone gets now from previously failing commands is.

My word is final

User avatar
Aaronplayh
Posts: 3
Joined: Mon Jun 26, 2023 7:23 am

Re: UnicodeDecodeError: 'cp950' codec can't decode byte 0xec in position 135: illegal multibyte sequence

Post by Aaronplayh »

Hi, I am not sure what should I do

User avatar
torzdf
Posts: 2697
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 136 times
Been thanked: 631 times

Re: UnicodeDecodeError: 'cp950' codec can't decode byte 0xec in position 135: illegal multibyte sequence

Post by torzdf »

Aaronplayh wrote: Tue Jul 04, 2023 2:32 am

Hi, I am not sure what should I do

Update/reinstall faceswap. Try again. If you hit another issue, post the new crash report here.

My word is final

Locked