From 4fff720ffef82cae2ee01cca39b1889deb8ff9f4 Mon Sep 17 00:00:00 2001 From: David-Wu1119 <133224895+David-Wu1119@users.noreply.github.com> Date: Thu, 3 Sep 2026 11:01:29 -0400 Subject: [PATCH] Restore IMAGE_EXTENSIONS in the text_to_image FID helper 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. --- text_to_image/tools/fid/fid_score.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/text_to_image/tools/fid/fid_score.py b/text_to_image/tools/fid/fid_score.py index 1df208dd84..6666b30bd9 100644 --- a/text_to_image/tools/fid/fid_score.py +++ b/text_to_image/tools/fid/fid_score.py @@ -46,6 +46,20 @@ import sys from .inception import InceptionV3 +# Extensions accepted when a path points at a directory of images. Kept in +# sync with the upstream pytorch-fid this module is derived from. +IMAGE_EXTENSIONS = { + "bmp", + "jpg", + "jpeg", + "pgm", + "png", + "ppm", + "tif", + "tiff", + "webp", +} + try: from tqdm import tqdm