deepspeedai / deepspeedai/DeepSpeedExamples

[PROBLEM] DeepSpeedChat Create HF Model FOR LLAMA Token ID Question

Open
#719 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
6.8k
Forks
1.1k
Avg merge
2d 16h
Merged PRs (30d)
1

Description

Hello, I wish you good work.

I got stuck at a point here and wanted to get an answer from you. When we first set up the tokenizer structure, these were our token information for the OPT Models.

OPT TOKEN ID:
{'bos_token': '</s>',
 'eos_token': '</s>',
 'unk_token': '</s>',
 'pad_token': '</s>'}

 
And then in "create_hf_model" when calling the model;

model.config.eos_token_id = tokenizer.eos_token_id
model.config.pad_token_id = model.config.eos_token_id

as we equate.

But as far as I normally see in LLama Models, pad_token is not included and we add it later, in the "load_hf_tokenizer" section.

In short;

LLAMA TOKEN ID BEFORE ADD PAD TOKEN ID:
{'bos_token': '<s>', 
'eos_token': '</s>', 
'unk_token': '<unk>'}

...
tokenizer.add_special_tokens({"pad_token" : "[PAD]"})
.....


But while we are calling the LLAMA model in the "create_hf_model" section in this model section, it doesn't seem to apply our change in the pad_token section.

model.config.eos_token_id = tokenizer.eos_token_id ----> </s>
model.config.pad_token_id = model.config.eos_token_id --> </s>

Isn't that what it should be?

as model.config.pad_token_id = tokenizer.pad_token_id--> [PAD]
doesn't it need to be set?


Can you explain if there is a different approach for the MODEL TOKEN ID and TOKENIZER ID?

@awan-10

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the create_hf_model and load_hf_tokenizer sections named in the issue, then trace how tokenizer and model configuration token IDs are assigned for OPT and Llama. Compare the tokenizer's pad_token_id with model.config.pad_token_id and check the related DeepSpeedExamples code paths. Done requires a maintainer-confirmed explanation or a clearly specified change.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
18/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.