Skip to content

lm-eval polishing and speed-up#2361

Merged
regisss merged 9 commits intohuggingface:mainfrom
12010486:lm_eval_impro
Jan 7, 2026
Merged

lm-eval polishing and speed-up#2361
regisss merged 9 commits intohuggingface:mainfrom
12010486:lm_eval_impro

Conversation

@12010486
Copy link
Collaborator

@12010486 12010486 commented Jan 7, 2026

This pull request updates the Habana model adapter in examples/text-generation/model_adapter.py to improve device handling, logging, and padding logic for text generation on HPU devices.

More importantly, it speeds up both loglikelihood and generate_until based tasks at 0% change in accuracy.

Some examples:

PT_HPU_LAZY_MODE=1  python run_lm_eval.py --model_name_or_path meta-llama/Llama-3.2-1B-instruct \
--attn_softmax_bf16 --use_hpu_graphs --limit_hpu_graphs   --use_kv_cache --bf16 --sdp_on_bf16 --trim_logits \
--batch_size=32 --tasks gsm8k_cot_llama -o eval_gsm8k.json --num_fewshot=8 \
--fewshot_as_multiturn --apply_chat_template True 

Improves throughput from 8.57it/s to 20.83it/s

PT_HPU_LAZY_MODE=1  python run_lm_eval.py --model_name_or_path meta-llama/Llama-3.2-1B-instruct --attn_softmax_bf16 --use_hpu_graphs --limit_hpu_graphs   --use_kv_cache --bf16 --sdp_on_bf16 --trim_logits --batch_size=16 --tasks ifeval -o eval_ifeval.json --num_fewshot=0 --fewshot_as_multiturn --apply_chat_template True

Improves throughput from 2.73it/s to 3.39it/s

PT_HPU_LAZY_MODE=1  python run_lm_eval.py --model_name_or_path meta-llama/Llama-3.2-1B-instruct --attn_softmax_bf16 --use_hpu_graphs --limit_hpu_graphs   --use_kv_cache --bf16 --sdp_on_bf16 --trim_logits --batch_size=32 --tasks hellaswag -o eval_hellaswag.json

Improves throughput from 46.36it/s to 198.44it/s

@12010486 12010486 requested a review from regisss as a code owner January 7, 2026 16:41
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Collaborator

@regisss regisss left a comment

Choose a reason for hiding this comment

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

LGTM

@regisss regisss merged commit 472e93d into huggingface:main Jan 7, 2026
2 of 4 checks passed
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.

3 participants