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

[Bugfix] Avoid truncating the outputs based on string lengths #201

Merged
merged 6 commits into from
Jul 8, 2024

Conversation

anton-l
Copy link
Member

@anton-l anton-l commented Jun 11, 2024

This fixes a bug where max_new_tokens was set to 1 due to biggest_context = max(len(c) for c in context) instead of biggest_context = <max number of tokens>.

This meant that a 4-shot gsm8k eval was generating single-token predictions if the model's context size is 2048.

To reproduce:

accelerate launch --num_processes=1 "run_evals_accelerate.py" --model_args="pretrained=HuggingFaceFW/ablation-model-fineweb-edu" \
      --output_dir $OUTPUT_DIR --max_samples 1000 --override_batch_size 32 \
      --tasks "leaderboard|gsm8k|4|1"

And check for single-token predictions in $OUTPUT_DIR/details/HuggingFaceFW/ablation-model-fineweb-edu/2024-06-11T15-34-10.689447/details_leaderboard|gsm8k|4_2024-06-11T15-34-10.689447.parquet

@anton-l anton-l requested a review from clefourrier June 11, 2024 15:52
hlog_warn(
f"The smallest context of your batch ({smallest_context}) is bigger than the maximum context size allowed by the model ({self.max_length}) for a task in"
f"The context size of your batch ({context_size}) is bigger than the maximum context size allowed by the model ({self.max_length}) for a task in"
Copy link
Member Author

Choose a reason for hiding this comment

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

Replaced smallest_context here because the real issues are caused by biggest_context (renamed to context_size)

Copy link
Member

@clefourrier clefourrier left a comment

Choose a reason for hiding this comment

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

It overall LGTM, I'd welcome a second look by @NathanHB
Side note - we need to add a long context eval to the test suite, though gpt2 has so small a context that anything is long context I guess XD

@anton-l anton-l requested a review from NathanHB June 12, 2024 10:46
@clefourrier clefourrier merged commit 6064695 into huggingface:main Jul 8, 2024
2 checks passed
hynky1999 pushed a commit to hynky1999/lighteval that referenced this pull request Jul 12, 2024
…gface#201)

* Fix context size

* - redundant condition

---------

Co-authored-by: Clémentine Fourrier <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants