Skip to content
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

Internal eval fixes #788

Merged
merged 3 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/gpt2_small_fast_supervised.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ data:
supervised_data:
validation_urls:
- "gs://marin-us-central2/benchmarks/mmlu/mmlu-*-dev-evaluation.jsonl.gz"
- "gs://marin-us-central2/benchmarks/mmlu/mmlu-*-validation-evaluation.jsonl.gz"
cache_dir: "gs://marin-us-central2/benchmarks/tokenized-gpt2/mmlu/"
input_field: "input"
output_field: "output"
Expand Down
2 changes: 1 addition & 1 deletion src/levanter/data/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ def mk_supervised_dataset(config: LMSupervisedDatasetConfig, tokenizer: PreTrain
input_field = config.input_field
output_field = config.output_field

output_exemplar = {"input_ids": np.zeros((0,), dtype=np.int32), "sources_len": np.zeros((), dtype=np.int32)}
output_exemplar = {"input_ids": np.zeros((0,), dtype=np.int32), "sources_len": np.zeros((0,), dtype=np.int32)}

dataset = dataset.map_batches(lambda ex: preprocess_supervised_example(ex, tokenizer, input_field, output_field), batch_size=128, num_cpus=num_cpus_used_by_tokenizer(tokenizer), output_exemplar=output_exemplar) # type: ignore
dataset = dataset.build_or_load_cache(config.cache_dir, await_finished=True) # type: ignore
Expand Down
8 changes: 4 additions & 4 deletions src/levanter/main/train_lm.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,13 @@ def main(config: TrainLmConfig):

levanter.tracker.log_summary({"parameter_count": parameter_count(state.model)})

max_eval_examples_per_ds = config.trainer.max_eval_batches
if max_eval_examples_per_ds is not None:
max_eval_examples_per_ds *= config.trainer.eval_batch_size

if len(tagged_eval_datasets) == 0:
logger.warning("No evaluation datasets provided.")
else:
max_eval_examples_per_ds = config.trainer.max_eval_batches
if max_eval_examples_per_ds is not None:
max_eval_examples_per_ds *= config.trainer.eval_batch_size

causal_datasets = [
(CausalLmDataset(ds, Pos, KeyPos, ignore_index=config.data.ignore_token_id), tags)
for ds, tags in tagged_eval_datasets
Expand Down
Loading