Skip to content

[bugfix] fix tool_call loss_scale#9266

Merged
Jintao-Huang merged 3 commits into
modelscope:mainfrom
Jintao-Huang:fix_tool_call_loss_scale
May 6, 2026
Merged

[bugfix] fix tool_call loss_scale#9266
Jintao-Huang merged 3 commits into
modelscope:mainfrom
Jintao-Huang:fix_tool_call_loss_scale

Conversation

@Jintao-Huang
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the _preprocess_function_call method in swift/template/base.py to ensure that loss and loss_scale fields are preserved when merging multiple tool_call messages into a single assistant message. The review feedback suggests refactoring the field preservation logic using a loop over keys to improve code extensibility and reduce repetition.

Comment thread swift/template/base.py Outdated
@Jintao-Huang
Copy link
Copy Markdown
Collaborator Author

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the documentation and implementation for handling 'loss' and 'loss_scale' fields in custom datasets. It clarifies that these fields apply to the assistant role and ensures that when consecutive 'tool_call' messages are merged, the 'loss' and 'loss_scale' configurations from the first message are preserved. I have no feedback to provide.

@Jintao-Huang Jintao-Huang merged commit 2c3e083 into modelscope:main May 6, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants