nkolkin13 / NeuralNeighborStyleTransfer

Optimization based style transfer
MIT License
250 stars 31 forks source link

RuntimeError: CUDA error: out of memory #11

Open minghong-X opened 2 years ago

minghong-X commented 2 years ago

Why do I get this error using 3090 with 24GB of memory RuntimeError: CUDA error: out of memory Thank you for your answer!!!

nkolkin13 commented 2 years ago

Hi Minghong-X, I'm sorry, but I don't know why you're running out of memory with that GPU, it should have plenty of memory for NNST. Are you running anything else at the same time on the GPU (driving a monitor etc?). I may be able to help more if you post the exact command you are running that is giving the error (but also might not be able to help). Best, Nick

minghong-X commented 2 years ago

Thank you for your reply! I'm not running any other programs on this GPU.Just the "NeuralNeighborStyleTransfer-main" program.I tried some ways to solve it, but all failed.

The run command I use is:"python styleTransfer.py --content_path PATH_TO_CONTENT_IMAGE --style_path PATH_TO_STYLE_IMAGE --output_path PATH_TO_OUTPUT."

And all the error messages are as follows:

File "styleTransfer.py", line 55, in cnn = misc.to_device(Vgg16Pretrained()) File "/hy-tmp/utils/misc.py", line 17, in to_device return tensor.cuda() File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 680, in cuda return self._apply(lambda t: t.cuda(device)) File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 570, in _apply module._apply(fn) File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 570, in _apply module._apply(fn) File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 593, in _apply param_applied = fn(param) File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 680, in return self._apply(lambda t: t.cuda(device)) RuntimeError: CUDA error: out of memory CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect. For debugging consider passing CUDA_LAUNCH_BLOCKING=1.

nkolkin13 commented 2 years ago

I assume you are replacing the PATH_TO_X arguments with actual file paths?

minghong-X commented 2 years ago

I tried to do this with a CPU Thank you! I can't seem to figure it out!