Fix teacher quantization kwargs and guard eval callback in GKD example#6251
Open
sergiopaniego wants to merge 2 commits into
Open
Fix teacher quantization kwargs and guard eval callback in GKD example#6251sergiopaniego wants to merge 2 commits into
sergiopaniego wants to merge 2 commits into
Conversation
|
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. |
634868a to
3b9a209
Compare
kashif
approved these changes
Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes two bugs in
examples/scripts/gkd.py:--load_in_4bit, the teacher's quantization block setmodel_kwargs(the student) instead ofteacher_model_kwargs, so the teacher loaded unquantized. Aligns withdistillation.py.LogCompletionsCallbackrequires apromptcolumn and crashed eval on conversational (messages) datasets (ValueError: Column 'prompt' doesn't exist.); it is now attached only when that column exists.Before submitting
AI writing disclosure
Note
Low Risk
Example-script-only fixes with no changes to core TRL training logic or APIs.
Overview
Fixes two bugs in the GKD example script (
gkd.py).When
--load_in_4bit(or other quantization) is enabled, quantization config is now applied toteacher_model_kwargsinstead of mistakenly updating the student’smodel_kwargs, so the teacher actually loads quantized—consistent withdistillation.py.LogCompletionsCallbackis only registered when the eval split has apromptcolumn, avoiding a crash on conversational datasets that only exposemessages.Reviewed by Cursor Bugbot for commit 758035b. Bugbot is set up for automated code reviews on this repo. Configure here.