Skip to content

Handle missing AgentFlan query for string suffixes - #9949

Open
taking-lying-flat wants to merge 1 commit into
modelscope:mainfrom
taking-lying-flat:agent/fix-agentflan-string-suffix
Open

Handle missing AgentFlan query for string suffixes#9949
taking-lying-flat wants to merge 1 commit into
modelscope:mainfrom
taking-lying-flat:agent/fix-agentflan-string-suffix

Conversation

@taking-lying-flat

@taking-lying-flat taking-lying-flat commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • allow calculate_loss_scale to receive a missing query
  • skip AgentFlan query-map matching when the current context has no query

Root cause

String template suffixes are processed as assistant contexts, but only response contexts receive the current query. AgentFlan therefore calls calculate_loss_scale with query=None for suffixes. The query-map lookup attempted key in query without guarding the optional value, raising a TypeError during template encoding.

Impact

AgentFlan loss scaling can process string suffixes such as Qwen ChatML's <|im_end|>\n while preserving query-specific loss scaling for response contexts.

@taking-lying-flat
taking-lying-flat marked this pull request as ready for review August 19, 2026 11:50
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.

1 participant