Skip to content

Restore IMAGE_EXTENSIONS in the text_to_image FID helper - #2665

Open
David-Wu1119 wants to merge 1 commit into
mlcommons:masterfrom
David-Wu1119:fix/fid-missing-image-extensions
Open

Restore IMAGE_EXTENSIONS in the text_to_image FID helper#2665
David-Wu1119 wants to merge 1 commit into
mlcommons:masterfrom
David-Wu1119:fix/fid-missing-image-extensions

Conversation

@David-Wu1119

Copy link
Copy Markdown

Summary

text_to_image/tools/fid/fid_score.py globs an image directory using IMAGE_EXTENSIONS, but that name is never defined anywhere in the module:

else:
    path = pathlib.Path(path)
    files = sorted(
        [file for ext in IMAGE_EXTENSIONS for file in path.glob(
            "*.{}".format(ext))]
    )

So compute_statistics_of_path() — and through it the public calculate_fid_given_paths() — raises NameError: name 'IMAGE_EXTENSIONS' is not defined for any path that is not a .npz. ruff --select F821 flags it.

The constant is defined in the upstream pytorch-fid this file is derived from; it looks like it was dropped when the module was vendored. This adds it back with the same extension set.

Reachability, honestly

The repo's own accuracy path is unaffected: tools/accuracy_coco.py passes statistics_path, which takes the .npz branch. The broken branch is reached when calculate_fid_given_paths is given a directory of images — the standard pytorch-fid usage and a documented shape for this public helper, but not something the benchmark's own scripts do.

So this is a latent defect rather than something breaking a submission run today. Filing it because a public function raising NameError on a supported input is worth having fixed, not because anything is currently failing.

compute_statistics_of_path globs a directory using IMAGE_EXTENSIONS,
but the name is never defined in this module, so passing an image
directory to calculate_fid_given_paths raises NameError. The constant
exists in the upstream pytorch-fid this file is derived from and was
lost when it was vendored; add it back with the same extension set.
@David-Wu1119
David-Wu1119 requested a review from a team as a code owner September 3, 2026 15:01
Copilot AI lite review requested due to automatic review settings September 3, 2026 15:01
@David-Wu1119
David-Wu1119 requested a review from a team as a code owner September 3, 2026 15:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

MLCommons CLA bot:
Thank you very much for your submission; we really appreciate it. Before we can accept your contribution,
we ask that you sign the MLCommons CLA (Apache 2). Please submit your GitHub ID to our onboarding form to initiate
authorization. If you are from a MLCommons member organization, we will request that you be added to the CLA.
If you are not from a member organization, we will email you a CLA to sign. For any questions, please contact
support@mlcommons.org.
0 out of 1 committers have signed the MLCommons CLA.
@David-Wu1119
You can retrigger this bot by commenting recheck in this Pull Request

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.

2 participants