Skip to content

Tokenizer config fix for dynamic mode (#144)#1903

Merged
regisss merged 1 commit into
huggingface:mainfrom
HabanaAI:auto-pr-8ed3883
Apr 23, 2025
Merged

Tokenizer config fix for dynamic mode (#144)#1903
regisss merged 1 commit into
huggingface:mainfrom
HabanaAI:auto-pr-8ed3883

Conversation

@pramodkumar-habanalabs
Copy link
Copy Markdown
Contributor

Issue:
For the Llama2 7B Dynamic mode, with padding="max_length", the tokenizer produces 'input_ids' without padding and having actual tokens only in the list. This is expected and works fine.

For the Llama3.1 8B Dynamic mode, with padding="max_length", the tokenizer produces 'input_ids' with padding and having 128K tokens (which is the max model input length. This is not expected.

Fix: The tokenizer configuration has been changed to address this issue.

@libinta libinta added the run-test Run CI for PRs from external contributors label Apr 9, 2025
@libinta libinta changed the title [SW-218176]: Tokenizer config fix for dynamic mode (#144) Tokenizer config fix for dynamic mode (#144) Apr 9, 2025
@regisss
Copy link
Copy Markdown
Collaborator

regisss commented Apr 16, 2025

@pramodkumar-habanalabs Can you share a code snippet that enables me to reproduce this issue with Llama 3.1 please?

@libinta
Copy link
Copy Markdown
Collaborator

libinta commented Apr 23, 2025

@regisss You can try with below
PT_HPU_LAZY_MODE=0 python3 /root/repos/optimum-habana-fork/examples/text-generation/run_generation.py --model_name_or_path /mnt/weka/data/pytorch/llama3.1/Meta-Llama-3.1-8B-Instruct/  --attn_softmax_bf16  --use_kv_cache --max_new_tokens 128 --bf16 --batch_size 8 --trim_logits --max_input_tokens -1  --warmup 2  --torch_compile --dataset_name tatsu-lab/alpaca --run_partial_dataset --n_iterations 10

Copy link
Copy Markdown
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 b6c0691 into huggingface:main Apr 23, 2025
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-test Run CI for PRs from external contributors synapse 1.21

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants