Skip to content

HF dataset loading optimizations #623

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jun 14, 2024
5 changes: 5 additions & 0 deletions olmo/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,11 @@ class TrainConfig(BaseConfig):
Whether to use the fused CE loss function from `flash-attn`.
"""

hf_datasets_cache_dir: Optional[str] = None
"""
Path to cache directory of HF datasets saved with `datasets.save_to_disk`.
"""

@property
def autocast_precision(self) -> torch.dtype:
if self.precision == "amp_bf16":
Expand Down
4 changes: 3 additions & 1 deletion olmo/eval/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ def build_downstream_evaluator(
task_class = label_to_task_map[eval_cfg.label]
if isinstance(task_class, tuple):
task_class, task_kwargs = task_class
ds_eval_dataset = task_class(tokenizer=tokenizer, **task_kwargs) # type: ignore
ds_eval_dataset = task_class(
tokenizer=tokenizer, datasets_cache_dir=train_config.hf_datasets_cache_dir, **task_kwargs
) # type: ignore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this # type: ignore is probably on the wrong line now

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intellisense puts it there and the type checking passes with it there (and fails without it there).

data_config = eval_cfg.data
if is_unit_test:
ds_eval_sampler = None
Expand Down
Loading
Loading