DragGAN
DragGAN copied to clipboard
error when importing custom image to the stylegan latents while working on cpu
if you run gradio demo on cpu in windows 11 and import custom image, there will be an error: RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument mat2 in method wrapper_CUDA_mm)
full error: Traceback (most recent call last): File "C:\Users\GM\Desktop\DragGAN-webui-zeqiang\miniconda3\lib\site-packages\gradio\routes.py", line 399, in run_predict output = await app.get_blocks().process_api( File "C:\Users\GM\Desktop\DragGAN-webui-zeqiang\miniconda3\lib\site-packages\gradio\blocks.py", line 1299, in process_api result = await self.call_function( File "C:\Users\GM\Desktop\DragGAN-webui-zeqiang\miniconda3\lib\site-packages\gradio\blocks.py", line 1022, in call_function prediction = await anyio.to_thread.run_sync( File "C:\Users\GM\Desktop\DragGAN-webui-zeqiang\miniconda3\lib\site-packages\anyio\to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "C:\Users\GM\Desktop\DragGAN-webui-zeqiang\miniconda3\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "C:\Users\GM\Desktop\DragGAN-webui-zeqiang\miniconda3\lib\site-packages\anyio_backends_asyncio.py", line 807, in run result = context.run(func, *args) File "gradio_app_cpu.py", line 221, in on_image_change result = inverse_image( File "C:\Users\GM\Desktop\DragGAN-webui-zeqiang\webui\stylegan2\inversion.py", line 117, in inverse_image latent_out = g_ema.style(noise_sample) File "C:\Users\GM\Desktop\DragGAN-webui-zeqiang\miniconda3\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl return forward_call(*args, **kwargs) File "C:\Users\GM\Desktop\DragGAN-webui-zeqiang\miniconda3\lib\site-packages\torch\nn\modules\container.py", line 217, in forward input = module(input) File "C:\Users\GM\Desktop\DragGAN-webui-zeqiang\miniconda3\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl return forward_call(*args, **kwargs) File "C:\Users\GM\Desktop\DragGAN-webui-zeqiang\webui\stylegan2\model.py", line 168, in forward out = F.linear(input, self.weight * self.scale) RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument mat2 in method wrapper_CUDA_mm)
Fixed with https://github.com/Zeqiang-Lai/DragGAN/pull/78