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

[Examples] Computing FID in unconditional image generation #9245

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

alirezadizaji
Copy link

@alirezadizaji alirezadizaji commented Aug 22, 2024

What does this PR do?

Since sometimes there's a need for quantitative assessment of image generation, this PR brings an example of FID computation, particularly for unconditional image generation. Using it is quite straightforward: simply by passing the --compute_fid argument in CLI, now it's possible to log the FID score in the tracker.

Before submitting

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@alirezadizaji
Copy link
Author

@sayakpaul

Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Would it not make sense to default to clean-fid instead?

Comment on lines +625 to +626
if global_step % args.checkpointing_steps == 0:
if accelerator.is_main_process:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe both of these could be clubbed together?

@alirezadizaji
Copy link
Author

Thank you! Would it not make sense to default to clean-fid instead?

Yes, it's a great idea to include clean FID. We could also add an option for clean-fid to let the user decide. It could be implemented in a separate PR after this one.

@@ -618,6 +647,41 @@ def transform_images(examples):
save_path = os.path.join(args.output_dir, f"checkpoint-{global_step}")
accelerator.save_state(save_path)
logger.info(f"Saved state to {save_path}")

# Compute FID
if args.compute_fid:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think because of this line, it's better to keep them separate

@alirezadizaji
Copy link
Author

@sayakpaul

Copy link

github-actions bot commented Oct 5, 2024

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@github-actions github-actions bot added the stale Issues that haven't received updates label Oct 5, 2024
@sayakpaul
Copy link
Member

@alirezadizaji gentle ping regarding the open comments.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@github-actions github-actions bot removed the stale Issues that haven't received updates label Oct 6, 2024
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

Successfully merging this pull request may close these issues.

3 participants