Add Universal Transformers Distillation Trainer To Train Any(CausalLM… #4
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.
📝 Suggested PR Description
What does this PR add?
This PR introduces
transformers_distillation, a lightweight library built on top of the 🤗 Transformers ecosystem to make knowledge distillation of language models simple, flexible, and reproducible.Key features:
transformers.Trainer, so researchers and practitioners can reuse the familiar API with minimal overhead.examples/) and tests (tests/) for CausalLM, Seq2SeqLM, and MLM tasks.Example usage
I’ve demonstrated this in a Kaggle public notebook using a small dataset, showing how easy it is to run end-to-end distillation with just a few lines of code.
(Link: [https://www.kaggle.com/code/dignity45/transformer-distill-trainer-knowledge-distillation])
Why this matters
Distillation is becoming increasingly important for efficient model deployment.
Current pipelines often require custom code, but this library leverages the Trainer directly, meaning practitioners can:
Next steps / Future directions
transformers.✅ Overall, this PR lowers the barrier for practitioners who want to experiment with knowledge distillation without needing large teams or custom infrastructure, while remaining fully compatible with the Hugging Face ecosystem.