Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colab Interactively edit scenes error (indices should be either on cpu or on the same device as the indexed tensor (cpu)) #12

Open
kevinzhao81 opened this issue Jun 30, 2023 · 1 comment

Comments

@kevinzhao81
Copy link

kevinzhao81 commented Jun 30, 2023

Hi Dr. Epstein,

Thank you for this great work and published codes.

I tried to manipulate blobs using your BlobGAN Playground Colab (Last cell: Interactively edit scenes). I also ran the code on the server.

They both gave the same error message

RuntimeError Traceback (most recent call last)
in <cell line: 37>()
35 layout, orig_img = model.gen(z=z, truncate=truncate, layout=layout, **render_kwargs)
36 orig_blobs = for_canvas(layout['feature_img'].mul(255))
---> 37 labeled_blobs, labeled_blobs_img = draw_labels(orig_blobs, layout, size_threshold, COLORS)
38
39 blobs = DraggableBlobMap(locals())

/content/blobgan/./src/utils/colab.py in draw_labels(img, layout, T, colors, layout_i)
88 # draw = ImageDraw.Draw(img)
89 # mask = layout['sizes'][layout_i, 1:] > T
---> 90 # idmap = torch.arange(len(mask))[mask]
91 # blob = {k: layout[k][layout_i][mask].mul(255).tolist() for k in ('xs', 'ys')}
92 # for i, (x, y) in enumerate(zip(blob['xs'], blob['ys'])):

RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)

I searched online and no solutions work for me. Could you please tell me how to solve this for manipulating blobs and generating the corresponding images?

I appreciate any help from you.

@limeng-1234
Copy link

I have encountered the same issue. Do you have a solution for it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants