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

Inference with sample size >1 fails #83

Open
VisionaryMind opened this issue Apr 30, 2022 · 1 comment
Open

Inference with sample size >1 fails #83

VisionaryMind opened this issue Apr 30, 2022 · 1 comment

Comments

@VisionaryMind
Copy link

VisionaryMind commented Apr 30, 2022

This would appear to be a repeat of #60, however, deleting the output directly (or clearing it) does not fix the problem. If option --n_sample is set to any number higher than 1, the following error arises:

Traceback (most recent call last):
File "scripts/inference.py", line 133, in
main(args)
File "scripts/inference.py", line 37, in main
generate_inversions(args, generator, latent_codes, is_cars=is_cars)
File "/home/visionarymind/anaconda3/envs/e4e_env/lib/python3.6/site-packages/torch/autograd/grad_mode.py", line 26, in decorate_context
return func(*args, **kwargs)
File "scripts/inference.py", line 105, in generate_inversions
imgs, _ = g([latent_codes[i].unsqueeze(0)], input_is_latent=True, randomize_noise=False, return_latents=True)
IndexError: index 1 is out of bounds for dimension 0 with size 1

Deleting the output directory or ensuring there is no pre-existing latents.pt file does not fix the problem. Do you have any idea what the issue could be?

@omertov
Copy link
Owner

omertov commented May 19, 2022

Hi @VisionaryMind,
Sorry for the long response time, haven't had the time to maintain this repo for a while.

In case this is still relevant, I wonder if the images directory you point to contains only a single image, in which case there is only one latent code (index 0) and when you specify n_samples > 1 it fails to find the second latent code (index 1) since there is no such code.

I commited a change relevant to the above, let me know if the problem still persist.

Best,
Omer

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