Skip to content

fix(cs): initialize score heads and correct training metric reporting - #362

Closed
Yunnglin wants to merge 1 commit into
dev-swift-v5from
cs-score-head-fix
Closed

Yunnglin wants to merge 1 commit into
dev-swift-v5from
cs-score-head-fix

Conversation

@Yunnglin

@Yunnglin Yunnglin commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Split out of #361 (unrelated to the async multi-turn agentic rollout).

  • prepare_seq_cls_model.py: explicitly initialize the new score head (seeded normal init with initializer_range) instead of relying on implicit missing-weight initialization.
  • seq_cls.py / reranker.py cookbooks: report training metrics via calculate_metric(is_training=True) after the optimizer step instead of reading loss from the forward_backward result.
  • server/model/app.py: drop the deployment-only task_type / num_labels keys before constructing a Transformers model (the head is validated from the persisted config by _validate_model_task; HF constructors do not accept these keys).
  • Tests: tests/server/model/test_task_head.py, tests/server/integration/task_http_validation.py.

Validation

  • pytest tests/server/model/test_task_head.py: 19 passed (PPU env).

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