lm-sys / lm-sys/FastChat

Training processing when tokenization mismatch

Open
#2,614 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
39.5k
Forks
4.8k
PR merge metrics
No merged PRs in 30d

Description

```python
if cur_len < tokenizer.model_max_length:
if cur_len != total_len:
--> target[:] = IGNORE_TOKEN_ID
rank0_print(
f"WARNING: tokenization mismatch: {cur_len} vs. {total_len}."
f" #turn = {len(turns) - 1}. (ignored)"
)
```

Line 158 of https://github.com/lm-sys/FastChat/blob/main/fastchat/train/train.py set all the target tokens to ignore_token_id.
Why not mask out mismatch turn (usually the last turn) only? `target[cur_len:] = IGNORE_TOKEN_ID`

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 in fastchat/train/train.py around line 158, where the tokenization-mismatch branch assigns IGNORE_TOKEN_ID to the full target. Review how cur_len and total_len determine the mismatch, then verify that only the mismatched portion is ignored while valid target tokens remain available for training.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.