Conversation
polish code polish code polish code polish code
Summary of ChangesHello, 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 significantly upgrades the data parsing capabilities to natively support advanced conversational patterns, specifically focusing on tool-use and explicit reasoning content. By introducing a specialized parser and enhancing chat templates, it ensures that models can be trained more effectively on complex agent-like interactions. The changes also refine the training process by correctly handling learning rate schedules during resumed training and providing mechanisms to ignore specific tokens during loss calculation, leading to more robust and accurate model training. 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
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 comprehensive support for 'thinking' or 'reasoning' models and tool calling within chat templates. Key changes include adding a ThinkingParser and enhancing the GeneralParser to handle ignore_tokens for loss masking, along with updating the ChatTemplate model to include ignore_token and tools definitions. The scripts/regenerate_train_data.py file renames a key from 'thinking' to 'reasoning_content' for consistency. In scripts/train_dflash.py, the logic for calculating remaining_steps for the optimizer during training resumption was refactored; however, a critical bug was identified where ckpt_info would be undefined if training is not resumed, causing a NameError. New test data and reference outputs were added to validate the new reasoning and tool-calling functionalities.
| start_epoch = ckpt_info[0] | ||
| global_step = ckpt_info[1] |
There was a problem hiding this comment.
The variable ckpt_info is only defined within the if args.resume ... block (L357-359). If training is started without the --resume flag, ckpt_info will be undefined, and accessing it here will raise a NameError, causing the script to crash. To fix this, ckpt_info should be initialized with default values (e.g., (0, 0)) before it's potentially assigned inside the conditional block, ensuring it's always available.
fix bug support dflash train and fix test_sglang_backend fix lint fix:train on ckpt fix:optimizer create when load from ckpt
Motivation
This PR currently supports tool-use and user-provided tool for data parsing. Besides, it fix the training bug from ckpt of
DFlash. Users can add tool information as the following format which should be add to each conversation:The format of dataset each line is :
The below are some suggestions:
tests/test_data/test_parsers.pyto make sure that your training content is ok.usermessage, but can have multipletoolandassistantmessages, which is common in current agent applications. The example is listed below:reasoning_contentfield (in a format consistent with sglang). Theregenerate_train_data.pyscript will also now include the thought process inreasoning_content. An example is shown below:Modifications
Related Issues
Accuracy Test
Benchmark & Profiling
Checklist