DragGAN icon indicating copy to clipboard operation
DragGAN copied to clipboard

[Bug] IndexError: index 508 is out of bounds for dimension 2 with size 256

Open kanseaveg opened this issue 2 years ago • 2 comments

I just put the photo below: 1

I tried to open the mouth of the kitten. And select the second one: the cat style gan. image

It reports the bug below: image

how to fix it ? thank you?

kanseaveg avatar May 21 '23 13:05 kanseaveg

Another bug is

/home/amax/miniconda3/envs/cyy/lib/python3.7/site-packages/torch/nn/functional.py:3063: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details.
  "See the documentation of nn.Upsample for details.".format(mode))
Traceback (most recent call last):
  File "/home/amax/miniconda3/envs/cyy/lib/python3.7/site-packages/gradio/routes.py", line 421, in run_predict
    event_data=event_data,
  File "/home/amax/miniconda3/envs/cyy/lib/python3.7/site-packages/gradio/blocks.py", line 1321, in process_api
    fn_index, inputs, iterator, request, event_id, event_data
  File "/home/amax/miniconda3/envs/cyy/lib/python3.7/site-packages/gradio/blocks.py", line 1064, in call_function
    prediction = await utils.async_iteration(iterator)
  File "/home/amax/miniconda3/envs/cyy/lib/python3.7/site-packages/gradio/utils.py", line 514, in async_iteration
    return await iterator.__anext__()
  File "/home/amax/miniconda3/envs/cyy/lib/python3.7/site-packages/gradio/utils.py", line 508, in __anext__
    run_sync_iterator_async, self.iterator, limiter=self.limiter
  File "/home/amax/miniconda3/envs/cyy/lib/python3.7/site-packages/anyio/to_thread.py", line 32, in run_sync
    func, *args, cancellable=cancellable, limiter=limiter
  File "/home/amax/miniconda3/envs/cyy/lib/python3.7/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread    return await future
  File "/home/amax/miniconda3/envs/cyy/lib/python3.7/site-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "/home/amax/miniconda3/envs/cyy/lib/python3.7/site-packages/gradio/utils.py", line 490, in run_sync_iterator_async
    return next(iterator)
  File "gradio_app.py", line 103, in on_drag
    max_iters=max_iters):
  File "/home/amax/euan/code/draggan/drag_gan.py", line 193, in drag_gan
    f1 = bilinear_interpolate_torch(F2, qi[0], qi[1]).detach()
  File "/home/amax/euan/code/draggan/drag_gan.py", line 153, in bilinear_interpolate_torch
    Ia = im[:, :, y0, x0]
IndexError: index 508 is out of bounds for dimension 2 with size 256
/home/amax/miniconda3/envs/cyy/lib/python3.7/site-packages/torch/nn/functional.py:3063: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details.
  "See the documentation of nn.Upsample for details.".format(mode))
Traceback (most recent call last):
  File "/home/amax/miniconda3/envs/cyy/lib/python3.7/site-packages/gradio/routes.py", line 421, in run_predict
    event_data=event_data,
  File "/home/amax/miniconda3/envs/cyy/lib/python3.7/site-packages/gradio/blocks.py", line 1321, in process_api
    fn_index, inputs, iterator, request, event_id, event_data
  File "/home/amax/miniconda3/envs/cyy/lib/python3.7/site-packages/gradio/blocks.py", line 1064, in call_function
    prediction = await utils.async_iteration(iterator)
  File "/home/amax/miniconda3/envs/cyy/lib/python3.7/site-packages/gradio/utils.py", line 514, in async_iteration
    return await iterator.__anext__()
  File "/home/amax/miniconda3/envs/cyy/lib/python3.7/site-packages/gradio/utils.py", line 508, in __anext__
    run_sync_iterator_async, self.iterator, limiter=self.limiter
  File "/home/amax/miniconda3/envs/cyy/lib/python3.7/site-packages/anyio/to_thread.py", line 32, in run_sync
    func, *args, cancellable=cancellable, limiter=limiter
  File "/home/amax/miniconda3/envs/cyy/lib/python3.7/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread    return await future
  File "/home/amax/miniconda3/envs/cyy/lib/python3.7/site-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "/home/amax/miniconda3/envs/cyy/lib/python3.7/site-packages/gradio/utils.py", line 490, in run_sync_iterator_async
    return next(iterator)
  File "gradio_app.py", line 103, in on_drag
    max_iters=max_iters):
  File "/home/amax/euan/code/draggan/drag_gan.py", line 197, in drag_gan
    loss += ((F2 - F0) * (1 - mask)).abs().mean() * lam
RuntimeError: The size of tensor a (1024) must match the size of tensor b (960) at non-singleton dimension 3

I think there's problem on uploading a image and drag the photo.

kanseaveg avatar May 21 '23 13:05 kanseaveg

This is a known issue, https://github.com/Zeqiang-Lai/DragGAN/issues/4

We need some time to support it.

Zeqiang-Lai avatar May 21 '23 13:05 Zeqiang-Lai