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

Question with inferencing stage #13

Open
Michael-H777 opened this issue Feb 25, 2023 · 2 comments
Open

Question with inferencing stage #13

Michael-H777 opened this issue Feb 25, 2023 · 2 comments

Comments

@Michael-H777
Copy link

Hi,

I was able to get the code to run and train on cifar 10. However, I am struggling to understand how would I inference with the model.

Lets say I have a trained model, and a random noise of size (64, 3, 32, 32) (B,C,H,W). how would I use the existing model and the restore_checkpoint('from utils import restore_checkpoint') to create 64 new images?

feel free to refer to any function in the repo.

Thanks,
Michael

@Newbeeer
Copy link
Owner

Hi Michael,

Please use the --config.eval.save_images flag in the command line, as well as setting the eval batch size --config.eval.batch_size to 64. Generated images would be saved to eval_dir/ode_images_{ckpt}.png. Please refer to

Poisson_flow/run_lib.py

Lines 472 to 476 in bb51603

if config.eval.save_images:
# Saving a few generated images for debugging / visualization
image_grid = make_grid(samples_torch, nrow=int(np.sqrt(len(samples_torch))))
save_image(image_grid, os.path.join(eval_dir, f'ode_images_{ckpt}.png'))
exit(0)

Please consider using the more advanced PFGM++ model 😃 : https://github.com/Newbeeer/pfgmpp

Best,
Yilun

@Newbeeer
Copy link
Owner

For command line of restoration of existing models, please see the Checkpoint section in README.

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