Restore IMAGE_EXTENSIONS in the text_to_image FID helper - #2665
Open
David-Wu1119 wants to merge 1 commit into
Open
Restore IMAGE_EXTENSIONS in the text_to_image FID helper#2665David-Wu1119 wants to merge 1 commit into
David-Wu1119 wants to merge 1 commit into
Conversation
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.
Contributor
|
MLCommons CLA bot: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
text_to_image/tools/fid/fid_score.pyglobs an image directory usingIMAGE_EXTENSIONS, but that name is never defined anywhere in the module:So
compute_statistics_of_path()— and through it the publiccalculate_fid_given_paths()— raisesNameError: name 'IMAGE_EXTENSIONS' is not definedfor any path that is not a.npz.ruff --select F821flags 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.pypassesstatistics_path, which takes the.npzbranch. The broken branch is reached whencalculate_fid_given_pathsis 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
NameErroron a supported input is worth having fixed, not because anything is currently failing.