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

RuntimeError: CUDA error: an illegal memory access was encountered #39

Open
mountain-shui opened this issue Jan 9, 2022 · 2 comments
Open

Comments

@mountain-shui
Copy link

I am using your save_obj function, expecting to save the .obj as well as its texture generated from your model.

I get the following error:

(venv) H:\workSpace\pythonCode\Texformer-master>python demo.py --img_path demo_imgs/img.png --seg_path demo_imgs/seg.png
H:\workSpace\pythonCode\Texformer-master\venv\lib\site-packages\torch\nn\modules\container.py:597: UserWarning: Setting attributes on ParameterDict is not supported.
warnings.warn("Setting attributes on ParameterDict is not supported.")
H:\workSpace\pythonCode\Texformer-master\transformers\net_utils.py:83: UserWarning: floordiv is deprecated, and its behavior will change in a future version of pytorch. It currently rounds toward 0 (like the 'trunc' function NOT 'floor'). This results in incorrect rounding for negative values. To keep the current behavior, use torch.div(a, b, rounding_mode='trunc'), or for actual floor division, use torch.div(a, b, rounding_mode='floor').
dim_t = self.temperature ** (2 * (dim_t // 2) / self.num_pos_feats)
H:\workSpace\pythonCode\Texformer-master\venv\lib\site-packages\torch\nn\functional.py:4004: UserWarning: Default grid_sample and affine_grid behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desired. See the documentation of grid_sample for details.
"Default grid_sample and affine_grid behavior has changed "
H:\workSpace\pythonCode\Texformer-master\venv\lib\site-packages\torch\functional.py:445: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ..\aten\src\ATen\native\TensorShape.cpp:2157.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]

(venv) H:\workSpace\pythonCode\Texformer-master>python demo.py --img_path demo_imgs/img.png --seg_path demo_imgs/seg.png
H:\workSpace\pythonCode\Texformer-master\venv\lib\site-packages\torch\nn\modules\container.py:597: UserWarning: Setting attributes on ParameterDict is not supported.
warnings.warn("Setting attributes on ParameterDict is not supported.")
H:\workSpace\pythonCode\Texformer-master\transformers\net_utils.py:83: UserWarning: floordiv is deprecated, and its behavior will change in a future version of pytorch. It cu
rrently rounds toward 0 (like the 'trunc' function NOT 'floor'). This results in incorrect rounding for negative values. To keep the current behavior, use torch.div(a, b, rounding_mode='trunc'), or for actual floor division, use torch.div(a, b, rounding_mode='floor').
dim_t = self.temperature ** (2 * (dim_t // 2) / self.num_pos_feats)
H:\workSpace\pythonCode\Texformer-master\venv\lib\site-packages\torch\nn\functional.py:4004: UserWarning: Default grid_sample and affine_grid behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desired. See the documentation of grid_sample for details.
"Default grid_sample and affine_grid behavior has changed "
H:\workSpace\pythonCode\Texformer-master\venv\lib\site-packages\torch\functional.py:445: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ..\aten\src\ATen\native\TensorShape.cpp:2157.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
Error in create_texture_image: an illegal memory access was encountered
Error in create_texture_image_boundary: an illegal memory access was encountered
Traceback (most recent call last):
File "demo.py", line 182, in
demo.run_demo(args)
File "H:\workSpace\pythonCode\Texformer-master\venv\lib\site-packages\torch\autograd\grad_mode.py", line 28, in decorate_context
return func(*args, **kwargs)
File "demo.py", line 146, in run_demo
rendered_img, _, _ = self.renderer.render(self.pred_vertices, self.pred_cam_t, uvmap)
File "H:\workSpace\pythonCode\Texformer-master\NMR\neural_render_test.py", line 128, in render
nr.save_obj("myTest" + str(self.count), tempVerts, tempFaces, textures=tex_tensor)
File "H:\workSpace\pythonCode\Texformer-master\venv\lib\site-packages\neural_renderer_pytorch-1.1.3-py3.7-win-amd64.egg\neural_renderer\save_obj.py", line 48, in save_obj
texture_image, vertices_textures = create_texture_image(textures)
File "H:\workSpace\pythonCode\Texformer-master\venv\lib\site-packages\neural_renderer_pytorch-1.1.3-py3.7-win-amd64.egg\neural_renderer\save_obj.py", line 30, in create_texture_image
vertices[:, :, 0] /= (image.shape[1] - 1)
RuntimeError: CUDA error: an illegal memory access was encountered

@logicsh
Copy link

logicsh commented Jul 7, 2022

me too

@logicsh
Copy link

logicsh commented Jul 7, 2022

Have you solved it now?

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

2 participants