Skip to content

Commit

Permalink
fix: add directory filter to os.walk to ignore 'ipynb_checkpoints' (E…
Browse files Browse the repository at this point in the history
…leutherAI#1956)

* fix: add filter to os.walk to ignore 'ipynb_checkpoints

* Update __init__.py

* Update __init__.py

---------

Co-authored-by: Lintang Sutawika <[email protected]>
  • Loading branch information
johnwee1 and lintangsutawika authored Jun 13, 2024
1 parent ed72238 commit 568af94
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lm_eval/tasks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,13 @@ def _get_task_and_group(self, task_dir: str):
:return
Dictionary of task names as key and task metadata
"""
ignore_dirs = [
"__pycache__",
".ipynb_checkpoints",
]
tasks_and_groups = collections.defaultdict()
for root, _, file_list in os.walk(task_dir):
for root, dirs, file_list in os.walk(task_dir):
dirs[:] = [d for d in dirs if d not in ignore_dirs]
for f in file_list:
if f.endswith(".yaml"):
yaml_path = os.path.join(root, f)
Expand Down

0 comments on commit 568af94

Please sign in to comment.