Skip to content

Commit 18436d0

Browse files
jaketaeVictorSanh
andauthored
Warning on nonexistent datasets + fix for requirements (black) (#684)
* fix: raise error on nonexistent datasets * style: run linters * fix: warn instead of returning * fix: `logger` -> `logging` * style: run linter * chore: fix typo * fix: specify subset name if possible * Update promptsource/templates.py * quick fix for the tests (black dependency) Co-authored-by: Victor SANH <victorsanh@gmail.com>
1 parent a4b500a commit 18436d0

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

promptsource/templates.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import logging
12
import os
23
import random
34
import uuid
@@ -361,6 +362,11 @@ def read_from_file(self) -> Dict:
361362
"""
362363

363364
if not os.path.exists(self.yaml_path):
365+
dataset_name = f"{self.dataset_name} {self.subset_name}" if self.subset_name else self.dataset_name
366+
logging.warning(
367+
f"Tried instantiating `DatasetTemplates` for {dataset_name}, but no prompts found. "
368+
"Please ignore this warning if you are creating new prompts for this dataset."
369+
)
364370
return {}
365371
yaml_dict = yaml.load(open(self.yaml_path, "r"), Loader=yaml.FullLoader)
366372
return yaml_dict[self.TEMPLATES_KEY]

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
black
1+
black<=21.12b0
22
datasets>=1.7.0
33
flake8
44
isort==5.8.0

0 commit comments

Comments
 (0)