Skip to content

Document how to load the Qwen4 tokenizer - #8776

Open
albertvillanova wants to merge 1 commit into
mainfrom
qwen4-docs
Open

albertvillanova wants to merge 1 commit into
mainfrom
qwen4-docs

Conversation

@albertvillanova

@albertvillanova albertvillanova commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

This PR documents how to load the Qwen4 tokenizer for training with TRL.

Motivation

The root tokenizer of Qwen/Qwen4-35B-A3B is remote code and has no chat template, so the trainers can't apply one to conversational datasets. The transformers tokenizer and its chat template are in the tokenizer-compat subfolder.

Changes

  • Add a Qwen4 section to the chat templates guide, with the snippet that loads the tokenizer from tokenizer-compat.

Note

Low Risk
Documentation-only change with no runtime or training logic impact.

Overview
Adds a Qwen4 section to the chat templates guide so TRL users can format conversational data correctly.

It explains that checkpoints like Qwen/Qwen4-35B-A3B expose a root tokenizer that requires trust_remote_code=True and ships without a chat template, which blocks trainers from applying one. The doc points readers to load AutoTokenizer with subfolder="tokenizer-compat" to get the transformers tokenizer and its chat template as the processing class.

Reviewed by Cursor Bugbot for commit bf419c0. Bugbot is set up for automated code reviews on this repo. Configure here.

@bot-ci-comment

bot-ci-comment Bot commented Dec 4, 2026

Copy link
Copy Markdown

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.

Pages changed in this PR:

This branch has not been deployed

No deployments
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.

1 participant