OpenGVLab / DragGAN

Unofficial Implementation of DragGAN - "Drag Your GAN: Interactive Point-based Manipulation on the Generative Image Manifold" (DragGAN 全功能实现,在线Demo,本地部署试用,代码、模型已全部开源,支持Windows, macOS, Linux)
5k stars 491 forks source link

CUDA out of memory. Tried to allocate 130.00 MiB (GPU 0; 6.00 GiB total capacity; 4.83 GiB already allocated; #85

Open jiangningqu70 opened 1 year ago

jiangningqu70 commented 1 year ago

When I click "Drag it" button, it has an error as follow. How can I do? Thanks.

Traceback (most recent call last): File "D:\Soft\python\lib\site-packages\gradio\routes.py", line 406, in run_predict event_data=event_data, File "D:\Soft\python\lib\site-packages\gradio\blocks.py", line 1300, in process_api fn_index, inputs, iterator, request, event_id, event_data File "D:\Soft\python\lib\site-packages\gradio\blocks.py", line 1037, in call_function utils.async_iteration, iterator, limiter=self.limiter File "D:\Soft\python\lib\site-packages\anyio\to_thread.py", line 34, in run_sync func, args, cancellable=cancellable, limiter=limiter File "D:\Soft\python\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "D:\Soft\python\lib\site-packages\anyio_backends_asyncio.py", line 807, in run result = context.run(func, args) File "D:\Soft\python\lib\site-packages\gradio\utils.py", line 488, in async_iteration return next(iterator) File "E:/workspace/python_workspace/DragGAN-main/gradio_app.py", line 135, in on_drag max_iters=max_iters): File "E:\workspace\python_workspace\DragGAN-main\drag_gan.py", line 183, in drag_gan sample2, F2 = g_ema.generate(latent, noise) File "E:\workspace\python_workspace\DragGAN-main\drag_gan.py", line 107, in generate out = conv1(out, latent[:, i], noise=noise1) File "D:\Soft\python\lib\site-packages\torch\nn\modules\module.py", line 1051, in _call_impl return forward_call(*input, kwargs) File "E:\workspace\python_workspace\DragGAN-main\stylegan2\model.py", line 376, in forward out = self.conv(input, style) File "D:\Soft\python\lib\site-packages\torch\nn\modules\module.py", line 1051, in _call_impl return forward_call(*input, *kwargs) File "E:\workspace\python_workspace\DragGAN-main\stylegan2\model.py", line 297, in forward out = self.blur(out) File "D:\Soft\python\lib\site-packages\torch\nn\modules\module.py", line 1051, in _call_impl return forward_call(input, kwargs) File "E:\workspace\python_workspace\DragGAN-main\stylegan2\model.py", line 104, in forward out = upfirdn2d(input, self.kernel, pad=self.pad) File "E:\workspace\python_workspace\DragGAN-main\stylegan2\op\upfirdn2d.py", line 186, in upfirdn2d_native out = _upfirdn2d_native(input, kernel, up, down, *pad) File "E:\workspace\python_workspace\DragGAN-main\stylegan2\op\upfirdn2d.py", line 205, in _upfirdn2d_native out, [0, 0, max(pad_x0, 0), max(pad_x1, 0), max(pad_y0, 0), max(pad_y1, 0)] File "D:\Soft\python\lib\site-packages\torch\nn\functional.py", line 4153, in _pad return _VF.constant_pad_nd(input, pad, value) RuntimeError: CUDA out of memory. Tried to allocate 130.00 MiB (GPU 0; 6.00 GiB total capacity; 4.83 GiB already allocated; 0 bytes free; 5.17 GiB reserved in total by PyTorch)