Skip to content

Solves #2598 #2599

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Solves #2598 #2599

wants to merge 10 commits into from

Conversation

nouranali
Copy link
Contributor

No description provided.

Copy link

pytorch-bot bot commented Apr 15, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/torchtune/2599

Note: Links to docs will display an error until the docs builds have been completed.

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 15, 2025
Copy link
Contributor

@ebsmothers ebsmothers left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Before giving a more detailed review, one high-level comment: I wonder if we really want to handle this for people in general. E.g. with pad_logits it is possible for me to run KD on two totally different tokenizers (and vocab spaces) without seeing any errors, right? This goes beyond just the case of "vocab of teacher model is subset of vocab of student model" (or vice versa).

Anyways I agree that mismatched vocab is an challenge (especially for Qwen models) -- it's come up in a couple issues on the repo before. But I also want to make sure we don't do something behind the scenes that allows someone to accidentally shoot themselves in the foot. Would be interested to hear your thoughts on this though.

@nouranali
Copy link
Contributor Author

nouranali commented Apr 16, 2025

Thanks for the PR! Before giving a more detailed review, one high-level comment: I wonder if we really want to handle this for people in general. E.g. with pad_logits it is possible for me to run KD on two totally different tokenizers (and vocab spaces) without seeing any errors, right? This goes beyond just the case of "vocab of teacher model is subset of vocab of student model" (or vice versa).

Anyways I agree that mismatched vocab is an challenge (especially for Qwen models) -- it's come up in a couple issues on the repo before. But I also want to make sure we don't do something behind the scenes that allows someone to accidentally shoot themselves in the foot. Would be interested to hear your thoughts on this though.

When I run KD for Qwen models that don't have the same tokenizer I get size mismatch exception, Qwen14B as teacher and Qwen3B as student, that's why I added the padding solution to my local code and after #2589 is accepted other people who run the recipe will face the same error.
I also agree with you that it's not necessary for this exception to happen but in my case, using a chat_dataset in openai format it does happen as not all entries have the same size

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants