modelscope / modelscope/ms-swift

seq-cls微调qwen3模型,multi-label推理出错

Open
#6,059 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
15.7k
Forks
1.7k
Avg merge
1d 16h
Merged PRs (30d)
136

Description

为什么有的输出三个label,有的输出两个label?三个label训练,理应是输出三个label

ChatMessage(role='assistant', content=[0, 1, 35], tool_calls=None, reasoning_content=None)
ChatMessage(role='assistant', content=[0, 1], tool_calls=None, reasoning_content=None)
ChatMessage(role='assistant', content=[0, 1], tool_calls=None, reasoning_content=None)
ChatMessage(role='assistant', content=[0, 1], tool_calls=None, reasoning_content=None)
ChatMessage(role='assistant', content=[0, 1], tool_calls=None, reasoning_content=None)
ChatMessage(role='assistant', content=[0, 1, 2], tool_calls=None, reasoning_content=None)
ChatMessage(role='assistant', content=[0, 1, 2], tool_calls=None, reasoning_content=None)
....

批量推理代码片段:

outputs = engine.infer(
    [InferRequest(messages=vd["messages"]) for vd in val_data[i : i + bs]],
    req_cfg,
    use_tqdm=False,
)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported behavior with the shown batch call to engine.infer, using the same InferRequest messages and req_cfg. Compare the varying label lists with the expected multi-label outputs and trace how inference handles the batch. Done means the cause of the inconsistent label counts is identified and the intended three-label behavior is verified or clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.