Makign qwen 2.5 7b compatible with old trl versions. #177
Conversation
Summary of ChangesHello @pluesclues, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces compatibility for older versions of the trl library by conditionally applying the chat template. The logic is sound and addresses the compatibility issue. I have one suggestion to improve maintainability by avoiding a duplicated version check. Additionally, there is a minor typo in the pull request title ('Makign').
| " max_tokens = 1024,\n", | ||
| ")\n", | ||
| "\n", | ||
| "if version.parse(trl.__version__) < version.parse(\"0.24.0\"):\n", |
There was a problem hiding this comment.
This version check is also performed in a previous cell (line 1091). To avoid code duplication and improve maintainability, it's a good practice to define a constant for this check once and reuse it. For example, you could define IS_OLD_TRL = version.parse(trl.__version__) < version.parse("0.24.0") in the cell at line 1091 and use if IS_OLD_TRL: in both places.
|
Thanks for this PR! The logic is correct. A few suggested improvements: 1. Use
|
For TRL >= 0.24.0, the library handles apply_chat_template internally.
This adds version checks to prevent double-application of chat template.
Changes:
- Wrap train_dataset.map() with Version("trl") < Version("0.24.0") check
- Add isinstance(prompt, list) check for vLLM inference prompts
- Ensures compatibility with both old and new TRL versions
Affected notebooks:
- Qwen2_5_7B_VL_GRPO.ipynb (+ HuggingFace/Kaggle variants)
- Gemma3_(4B)-Vision-GRPO.ipynb (+ HuggingFace/Kaggle variants)
68512f0 to
f2c4611
Compare
No description provided.