Skip to content

Fix CohereASR training loss double shift#46947

Closed
w-Jessamine wants to merge 1 commit into
huggingface:mainfrom
w-Jessamine:codex/cohere-asr-loss-shift
Closed

Fix CohereASR training loss double shift#46947
w-Jessamine wants to merge 1 commit into
huggingface:mainfrom
w-Jessamine:codex/cohere-asr-loss-shift

Conversation

@w-Jessamine

@w-Jessamine w-Jessamine commented Jun 28, 2026

Copy link
Copy Markdown

CI

Summary

CohereASR right-shifts labels into decoder_input_ids, then used self.loss_function (ForCausalLMLoss) to compute the training loss. That loss shifts labels internally again, so training targets were effectively labels[..., 1:].

This switches CohereASR to a plain CrossEntropyLoss, matching the Moonshine fix and seq2seq models that already align decoder inputs from labels before computing loss.

Fixes #46894.

Tests

  • PYTHONPATH=src /tmp/transformers-pr-venv/bin/python -m pytest tests/models/cohere_asr/test_modeling_cohere_asr.py::CohereAsrModelTest::test_training_loss_no_double_shift -q

CI recap

Dashboard: View test results in Grafana
Latest run: 28335138925
Result: success | Grafana metrics are not available yet.

@github-actions

Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: cohere_asr

@w-Jessamine w-Jessamine changed the title [codex] Fix CohereASR training loss double shift Fix CohereASR training loss double shift Jun 28, 2026
@w-Jessamine
w-Jessamine marked this pull request as ready for review June 28, 2026 20:42
@w-Jessamine
w-Jessamine deleted the codex/cohere-asr-loss-shift branch June 29, 2026 10:10
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.

CohereASR training-loss double-shift bug (same pattern as Moonshine #46784)

1 participant