Skip to content

Commit

Permalink
fix issue #111. Thanks to @djghosh13.
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdidc committed Dec 2, 2023
1 parent 3adf1da commit 832e17d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions clip_benchmark/datasets/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,14 +768,14 @@ def read_txt(fname):
# Get class names if present
classnames_fname = os.path.join(metadata_dir, "classnames.txt")
try:
dataset.classes = [line.strip() for line in read_txt(classnames_fname).splitlines() if line.strip()]
dataset.classes = [line.strip() for line in read_txt(classnames_fname).splitlines()]
except FileNotFoundError:
print("WARNING: classnames.txt not found")
dataset.classes = None
# Get zeroshot classification templates if present
templates_fname = os.path.join(metadata_dir, "zeroshot_classification_templates.txt")
try:
dataset.templates = [line.strip() for line in read_txt(templates_fname).splitlines() if line.strip()]
dataset.templates = [line.strip() for line in read_txt(templates_fname).splitlines()]
except FileNotFoundError:
print("WARNING: zeroshot_classification_templates.txt not found")
dataset.templates = None
Expand Down

0 comments on commit 832e17d

Please sign in to comment.