modelscope / modelscope/ms-swift
ToolCallScheduler response_token_ids问题
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 1.7k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 136
Description
# append tool result to the completion
infer_request.messages[-1]['content'] += (tool_results[0])
tokenizer = self.tokenizer
result_tokens = tokenizer.encode(tool_results[0], add_special_tokens=False)
token_ids.extend(result_tokens)
loss_mask.extend([0] * len(result_tokens))
这里不见得能对得上吧?比如str_a的编码ids为str_a_ids,str_b的编码ids为str_b_ids,str_c=str_a+str_b,但是str_c_ids不见得等于str_a_ids+str_b_ids把?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at examples/train/grpo/plugin/plugin.py around line 1203 and inspect how ToolCallScheduler builds token_ids after appending the tool result. Compare tokenizer.encode(tool_results[0], add_special_tokens=False) with encoding the complete concatenated content, then identify the expected token and loss-mask behavior and validate it with the relevant GRPO tool-call tests, if available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100