-
Notifications
You must be signed in to change notification settings - Fork 87
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
RuntimeError: The size of tensor a (814) must match the size of tensor b (815) at non-singleton dimension 3 #112
Comments
I am using Windows 11 |
please also update your code with latest version of packages |
(Project_Image_Inpainting_3_7) PS E:\MAT Image Inpainting\MAT> python --version Traceback (most recent call last): The above exception was the direct cause of the following exception: Traceback (most recent call last): warnings.warn('Failed to build CUDA kernels for bias_act. Falling back to slow reference implementation. Details:\n\n' + traceback.format_exc()) Traceback (most recent call last): The above exception was the direct cause of the following exception: Traceback (most recent call last): warnings.warn('Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:\n\n' + traceback.format_exc()) |
python generate_image.py --network "E:\MAT Image Inpainting\MAT\pretrained\CelebA-HQ_512.pkl" --dpath "C:\Users\spx016\Downloads\data\img" --outdir "C:\Users\spx016\Downloads\" --mpath "C:\Users\spx016\Downloads\data\mask"
torch.cuda.is_available() True
Loading data from: C:\Users\spx016\Downloads\data\img
['C:\\Users\\spx016\\Downloads\\data\\img\Image.png']
Loading mask from: C:\Users\spx016\Downloads\data\mask
Loading networks from: E:\MAT Image Inpainting\MAT\pretrained\CelebA-HQ_512.pkl
['C:\\Users\\spx016\\Downloads\\data\\img\Image.png']
Prcessing: Image.png
image.shape (3, 1227, 1629)
mask shape (1227, 1629)
Setting up PyTorch plugin "bias_act_plugin"... Failed!
E:\MAT Image Inpainting\MAT\torch_utils\ops\bias_act.py:50: UserWarning: Failed to build CUDA kernels for bias_act. Falling back to slow reference implementation. Details:
Traceback (most recent call last):
File "E:\MAT Image Inpainting\MAT\torch_utils\ops\bias_act.py", line 48, in _init
_plugin = custom_ops.get_plugin('bias_act_plugin', sources=sources, extra_cuda_cflags=['--use_fast_math'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MAT\torch_utils\custom_ops.py", line 110, in get_plugin
torch.utils.cpp_extension.load(name=module_name, verbose=verbose_build, sources=sources, **build_kwargs)
File "E:\MAT Image Inpainting\MatVenv\Lib\site-packages\torch\utils\cpp_extension.py", line 1306, in load
return _jit_compile(
^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MatVenv\Lib\site-packages\torch\utils\cpp_extension.py", line 1710, in _jit_compile
_write_ninja_file_and_build_library(
File "E:\MAT Image Inpainting\MatVenv\Lib\site-packages\torch\utils\cpp_extension.py", line 1800, in _write_ninja_file_and_build_library
extra_ldflags = _prepare_ldflags(
^^^^^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MatVenv\Lib\site-packages\torch\utils\cpp_extension.py", line 1887, in _prepare_ldflags
extra_ldflags.append(f'/LIBPATH:{_join_cuda_home("lib", "x64")}')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MatVenv\Lib\site-packages\torch\utils\cpp_extension.py", line 2407, in _join_cuda_home
raise OSError('CUDA_HOME environment variable is not set. '
OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root.
warnings.warn('Failed to build CUDA kernels for bias_act. Falling back to slow reference implementation. Details:\n\n' + traceback.format_exc())
Setting up PyTorch plugin "upfirdn2d_plugin"... Failed!
E:\MAT Image Inpainting\MAT\torch_utils\ops\upfirdn2d.py:34: UserWarning: Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:
Traceback (most recent call last):
File "E:\MAT Image Inpainting\MAT\torch_utils\ops\upfirdn2d.py", line 32, in _init
_plugin = custom_ops.get_plugin('upfirdn2d_plugin', sources=sources, extra_cuda_cflags=['--use_fast_math'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MAT\torch_utils\custom_ops.py", line 110, in get_plugin
torch.utils.cpp_extension.load(name=module_name, verbose=verbose_build, sources=sources, **build_kwargs)
File "E:\MAT Image Inpainting\MatVenv\Lib\site-packages\torch\utils\cpp_extension.py", line 1306, in load
return _jit_compile(
^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MatVenv\Lib\site-packages\torch\utils\cpp_extension.py", line 1710, in _jit_compile
_write_ninja_file_and_build_library(
File "E:\MAT Image Inpainting\MatVenv\Lib\site-packages\torch\utils\cpp_extension.py", line 1800, in _write_ninja_file_and_build_library
extra_ldflags = _prepare_ldflags(
^^^^^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MatVenv\Lib\site-packages\torch\utils\cpp_extension.py", line 1887, in _prepare_ldflags
extra_ldflags.append(f'/LIBPATH:{_join_cuda_home("lib", "x64")}')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MatVenv\Lib\site-packages\torch\utils\cpp_extension.py", line 2407, in _join_cuda_home
raise OSError('CUDA_HOME environment variable is not set. '
OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root.
warnings.warn('Failed to build CUDA kernels for upfirdn2d. Falling back to slow reference implementation. Details:\n\n' + traceback.format_exc())
Traceback (most recent call last):
File "E:\MAT Image Inpainting\MAT\generate_image.py", line 163, in
generate_images() # pylint: disable=no-value-for-parameter
^^^^^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MatVenv\Lib\site-packages\click\core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MatVenv\Lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MatVenv\Lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MatVenv\Lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MatVenv\Lib\site-packages\click\decorators.py", line 33, in new_func
return f(get_current_context(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MAT\generate_image.py", line 155, in generate_images
output = G(image, mask, z, label, truncation_psi=truncation_psi, noise_mode=noise_mode)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MatVenv\Lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MatVenv\Lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MAT\networks\mat.py", line 895, in forward
img = self.synthesis(images_in, masks_in, ws, noise_mode=noise_mode)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MatVenv\Lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MatVenv\Lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MAT\networks\mat.py", line 831, in forward
out_stg1 = self.first_stage(images_in, masks_in, ws, noise_mode=noise_mode)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MatVenv\Lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MatVenv\Lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MAT\networks\mat.py", line 760, in forward
x, mask = block(x, mask)
^^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MatVenv\Lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MatVenv\Lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\MAT Image Inpainting\MAT\networks\mat.py", line 103, in forward
x = torch.mul(x, mask_ratio)
^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: The size of tensor a (814) must match the size of tensor b (815) at non-singleton dimension 3
The text was updated successfully, but these errors were encountered: