Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'cp1' codec can't decode bytes in position 0--1: No mapping for the Unicode character exists in the target code page. #639

Open
Liuwuyang1026 opened this issue Apr 2, 2024 · 4 comments

Comments

@Liuwuyang1026
Copy link

Describe the bug
Traceback (most recent call last):
File "C:\Users\29125\anaconda3\envs\stylegan\lib\site-packages\torch\utils\cpp_extension.py", line 2096, in _run_ninja_build
subprocess.run(
File "C:\Users\29125\anaconda3\envs\stylegan\lib\subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\29125\PYcharm\keyanmodule\stylegan3\stylegan3-main\train.py", line 287, in
main() # pylint: disable=no-value-for-parameter
File "C:\Users\29125\anaconda3\envs\stylegan\lib\site-packages\click\core.py", line 1157, in call
return self.main(*args, **kwargs)
File "C:\Users\29125\anaconda3\envs\stylegan\lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
File "C:\Users\29125\anaconda3\envs\stylegan\lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\29125\anaconda3\envs\stylegan\lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "D:\29125\PYcharm\keyanmodule\stylegan3\stylegan3-main\train.py", line 282, in main
launch_training(c=c, desc=desc, outdir=opts.outdir, dry_run=opts.dry_run)
File "D:\29125\PYcharm\keyanmodule\stylegan3\stylegan3-main\train.py", line 97, in launch_training
subprocess_fn(rank=0, c=c, temp_dir=temp_dir)
File "D:\29125\PYcharm\keyanmodule\stylegan3\stylegan3-main\train.py", line 48, in subprocess_fn
training_loop.training_loop(rank=rank, **c)
File "D:\29125\PYcharm\keyanmodule\stylegan3\stylegan3-main\training\training_loop.py", line 168, in training_loop
img = misc.print_module_summary(G, [z, c])
File "D:\29125\PYcharm\keyanmodule\stylegan3\stylegan3-main\torch_utils\misc.py", line 216, in print_module_summary
outputs = module(*inputs)
File "C:\Users\29125\anaconda3\envs\stylegan\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "C:\Users\29125\anaconda3\envs\stylegan\lib\site-packages\torch\nn\modules\module.py", line 1561, in _call_impl
result = forward_call(*args, **kwargs)
File "D:\29125\PYcharm\keyanmodule\stylegan3\stylegan3-main\training\networks_stylegan3.py", line 511, in forward
ws = self.mapping(z, c, truncation_psi=truncation_psi, truncation_cutoff=truncation_cutoff, update_emas=update_emas)
File "C:\Users\29125\anaconda3\envs\stylegan\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "C:\Users\29125\anaconda3\envs\stylegan\lib\site-packages\torch\nn\modules\module.py", line 1561, in _call_impl
result = forward_call(*args, **kwargs)
File "D:\29125\PYcharm\keyanmodule\stylegan3\stylegan3-main\training\networks_stylegan3.py", line 151, in forward
x = getattr(self, f'fc{idx}')(x)
File "C:\Users\29125\anaconda3\envs\stylegan\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "C:\Users\29125\anaconda3\envs\stylegan\lib\site-packages\torch\nn\modules\module.py", line 1561, in _call_impl
result = forward_call(*args, **kwargs)
File "D:\29125\PYcharm\keyanmodule\stylegan3\stylegan3-main\training\networks_stylegan3.py", line 100, in forward
x = bias_act.bias_act(x, b, act=self.activation)
File "D:\29125\PYcharm\keyanmodule\stylegan3\stylegan3-main\torch_utils\ops\bias_act.py", line 84, in bias_act
if impl == 'cuda' and x.device.type == 'cuda' and _init():
File "D:\29125\PYcharm\keyanmodule\stylegan3\stylegan3-main\torch_utils\ops\bias_act.py", line 41, in _init
_plugin = custom_ops.get_plugin(
File "D:\29125\PYcharm\keyanmodule\stylegan3\stylegan3-main\torch_utils\custom_ops.py", line 136, in get_plugin
torch.utils.cpp_extension.load(name=module_name, build_directory=cached_build_dir,
File "C:\Users\29125\anaconda3\envs\stylegan\lib\site-packages\torch\utils\cpp_extension.py", line 1306, in load
return _jit_compile(
File "C:\Users\29125\anaconda3\envs\stylegan\lib\site-packages\torch\utils\cpp_extension.py", line 1710, in _jit_compile
_write_ninja_file_and_build_library(
File "C:\Users\29125\anaconda3\envs\stylegan\lib\site-packages\torch\utils\cpp_extension.py", line 1823, in _write_ninja_file_and_build_library
_run_ninja_build(
File "C:\Users\29125\anaconda3\envs\stylegan\lib\site-packages\torch\utils\cpp_extension.py", line 2111, in _run_ninja_build
message += f": {error.output.decode(*SUBPROCESS_DECODE_ARGS)}" # type: ignore[union-attr]
File "C:\Users\29125\anaconda3\envs\stylegan\lib\encodings\oem.py", line 15, in decode
return oem_decode(input, errors, True)
UnicodeDecodeError: 'cp1' codec can't decode bytes in position 0--1: No mapping for the Unicode character exists in the target code page.

  • OS:Windows 11
  • PyTorch version pytorch 2.2.2
  • CUDA toolkit version CUDA 12.1
  • GPU RTX 3060
@Liuwuyang1026
Copy link
Author

I really need your help urgently! Please!

@davu1da
Copy link

davu1da commented May 6, 2024

Perhaps you can change the encoding *SUBPROCESS_DECODE_ARGS to some other explicitly defined encoding, such as "gbk" or "utf-8".

@LiGuo12
Copy link

LiGuo12 commented Jul 13, 2024

same issue

@Nothingbutfish
Copy link

to record my experience:
First,I find that ninja and cl is not working as my expect. So I add them to the system path. In addition, don't change the cpp_extension.py.Then the error changes to:

RuntimeError: Error building extension 'bias_act_plugin': [1/3] C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\bin\nvcc --generate-dependencies-with-compile --dependency-output bias_act.cuda.o.d -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcompiler /EHsc -Xcompiler /wd4068 -Xcompiler /wd4067 -Xcompiler /wd4624 -Xcompiler /wd4190 -Xcompiler /wd4018 -Xcompiler /wd4275 -Xcompiler /wd4267 -Xcompiler /wd4244 -Xcompiler /wd4251 -Xcompiler /wd4819 -Xcompiler /MD -DTORCH_EXTENSION_NAME=bias_act_plugin -DTORCH_API_INCLUDE_EXTENSION_H -ID:\Software\anaconda3\envs\stylegan3\lib\site-packages\torch\include -ID:\Software\anaconda3\envs\stylegan3\lib\site-packages\torch\include\torch\csrc\api\include -ID:\Software\anaconda3\envs\stylegan3\lib\site-packages\torch\include\TH -ID:\Software\anaconda3\envs\stylegan3\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\include" -ID:\Software\anaconda3\envs\stylegan3\Include -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++17 --use_fast_math --allow-unsupported-compiler -c C:\Users\zmserver\AppData\Local\torch_extensions\torch_extensions\Cache\py38_cu121\bias_act_plugin\3cb576a0039689487cfba59279dd6d46-nvidia-geforce-rtx-3090\bias_act.cu -o bias_act.cuda.o
FAILED: bias_act.cuda.o

ch_extensions\torch_extensions\Cache\py38_cu121\bias_act_plugin\3cb576a0039689487cfba59279dd6d46-nvidia-geforce-rtx-3090\bias_act.cu -o bias_act.cuda.o
CreateProcess failed: The system cannot find the file specified.

Secondly, I find there is a param in my cpp_extension.py, which was named "CUDA_CLANG_VERSIONS".(different environmen seems produce difference content in the file). The cuda is listed from 11.1 to 11.7.

I don't what it actually mean but I guess the cuda version 12.1 is not supported or it can't be successfully recognized in the code.
What's more, I accidentally came across it online that vs2022 seems to needs cuda version>=11.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants