DragGAN icon indicating copy to clipboard operation
DragGAN copied to clipboard

RuntimeError: Expected !is_symbolic() to be true, but got false.

Open kaneyxx opened this issue 2 years ago • 2 comments

Hi, thanks for the implementation first.

Just installed the requirements and give it a try.

I met this error as title after running some steps.

55 3.7432401180267334 [tensor([755., 361.]), tensor([502., 404.]), tensor([470., 635.])] [tensor([755., 361.]), tensor([497., 442.]), tensor([471., 675.])] Traceback (most recent call last): File "/home/fangyi/miniconda3/envs/DragGan/lib/python3.8/site-packages/gradio/routes.py", line 399, in run_predict output = await app.get_blocks().process_api( File "/home/fangyi/miniconda3/envs/DragGan/lib/python3.8/site-packages/gradio/blocks.py", line 1299, in process_api result = await self.call_function( File "/home/fangyi/miniconda3/envs/DragGan/lib/python3.8/site-packages/gradio/blocks.py", line 1036, in call_function prediction = await anyio.to_thread.run_sync( File "/home/fangyi/.local/lib/python3.8/site-packages/anyio/to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "/home/fangyi/.local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "/home/fangyi/.local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 867, in run result = context.run(func, *args) File "/home/fangyi/miniconda3/envs/DragGan/lib/python3.8/site-packages/gradio/utils.py", line 488, in async_iteration return next(iterator) File "/data/fangyi/DragGAN/draggan/web.py", line 133, in on_drag for sample2, latent, F, handle_points in drag_gan(model.g_ema, latent, noise, F, File "/data/fangyi/DragGAN/draggan/api.py", line 195, in drag_gan f2 = bilinear_interpolate_torch(F2, qi[0] + di[0], qi[1] + di[1]) File "/data/fangyi/DragGAN/draggan/api.py", line 154, in bilinear_interpolate_torch Ia = im[:, :, y0, x0] RuntimeError: Expected !is_symbolic() to be true, but got false. (Could this error message be improved? If so, please report an enhancement request to PyTorch.) Model: stylegan2-ffhq-config-f.pt Max interations: 100 This error occured at around 5x steps.

Any idea?

kaneyxx avatar May 28 '23 07:05 kaneyxx

same issue too

hhhhuuuuuaaaaa avatar Jun 19 '23 03:06 hhhhuuuuuaaaaa

I found out it happens when ti==pi. The norm becomes 0, therefore di becomes nan (divided by 0). I added epsilon to the denominator(1e-6) and the error never occurred.

bobaejeon avatar Jun 19 '23 18:06 bobaejeon