[serge] Fix 20 integration tests for model `whisper` failing with `output_mismatch` (list output differs (10), other (6)
Author: sergereview[bot]
Pull request: yes

<!-- ci-dashboard-badge:start -->
[![CI](https://transformers-ci.lor-e.huggingface.cool/badge/pr?pr=47150)](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=47150)
<!-- ci-dashboard-badge:end -->

## Original CI failure

- Failure group: `1/1: 20 integration tests for model `whisper` failing with `output_mismatch` (list output differs (10), other (6), tensor values differ (4))`
- `tests/models/whisper/test_modeling_whisper.py::WhisperModelIntegrationTests::test_small_token_timestamp_generation` [multi-gpu] (output_mismatch, seen 7/7)

<!-- serge-task:integration-failure-triage:sha256:5fadcce436e9661beff5fcd474637d5b7fa396b3dce9aa43378cdabad2cfb05d -->
Relates to #47120

Whisper integration tests fail because generated sequences are truncated too early. In `WhisperGenerationMixin._set_max_new_tokens_and_length`, the computed `max_length` (which accounts for initial/prompt tokens in `decoder_input_ids`) is logged but never assigned back to `generation_config.max_length`. As a result, `generate` uses the original, shorter `max_length`, cutting off the last tokens in short-form generation and corrupting long-form segmentation.

This patch adds the missing assignment `generation_config.max_length = max_length`, restoring the intended behavior and fixing the output mismatches.

Note: the `docstrings` normalizer failure (`ModuleNotFoundError: No module named 'transformers.models.tipsv2'`) is unrelated to this Whisper change; it is a pre-existing environment/import issue for the `tipsv2` model that cannot be addressed by modifying Whisper code.

---
_This change was produced automatically by serge from a CI failure report. The patch was generated by an LLM and applied by serge; review before merging._

_serge `v0.1.0` · model: `moonshotai/Kimi-K2.7-Code` · 51 LLM turns · 51 tool calls · 177.1s · 2231443 in / 15857 out tokens_

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_47150). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

run-slow: whisper

[Workflow Run ⚙️](https://github.com/huggingface/transformers/actions/runs/29315705575)

This comment contains `run-slow`, running the specified jobs: 

models: ["models/whisper"]
quantizations: []

## CI Results
[Workflow Run ⚙️](https://github.com/huggingface/transformers/actions/runs/29315705575)

### Commit Info
| Context | Commit | Description |
|---------|--------|-------------|
| RUN | [ffa48f99](https://github.com/huggingface/transformers/commit/ffa48f990a0e78e7ed198b731a952b3d39131f6c) | workflow commit (merge commit) |
| PR | [de9e27d1](https://github.com/huggingface/transformers/commit/de9e27d11392d912d092bb12a23af23b344775a9) | branch commit (from PR) |
| main | [6805d433](https://github.com/huggingface/transformers/commit/6805d433ef66b5419429eb081b6321415e29d781) | base commit (on `main`) |

⚠️ **Model CI failed to report results**

The test failure analysis could not be completed. Please check the [workflow run](https://github.com/huggingface/transformers/actions/runs/29315705575) for details.


## CI Results
[Workflow Run ⚙️](https://github.com/huggingface/transformers/actions/runs/29315705575)

### Commit Info
| Context | Commit | Description |
|---------|--------|-------------|
| RUN | [ffa48f99](https://github.com/huggingface/transformers/commit/ffa48f990a0e78e7ed198b731a952b3d39131f6c) | workflow commit (merge commit) |
| PR | [de9e27d1](https://github.com/huggingface/transformers/commit/de9e27d11392d912d092bb12a23af23b344775a9) | branch commit (from PR) |
| main | [6805d433](https://github.com/huggingface/transformers/commit/6805d433ef66b5419429eb081b6321415e29d781) | base commit (on `main`) |

⚠️ **Model CI failed to report results**

The test failure analysis could not be completed. Please check the [workflow run](https://github.com/huggingface/transformers/actions/runs/29315705575) for details.


run-slow: whisper

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

run-slow: whisper

[Workflow Run ⚙️](https://github.com/huggingface/transformers/actions/runs/29515319089)

This comment contains `run-slow`, running the specified jobs: 

models: ["models/whisper"]
quantizations: []

<!-- ci-dashboard-recap:start -->

---

### CI recap

**Dashboard:** [View test results in Grafana](https://transformers-ci.lor-e.huggingface.cool/d/pytest-observability-by-pr/pytest-observability-branch?var-pr=47150)
**Latest run:** [29515300685:2](https://github.com/huggingface/transformers/actions/runs/29515300685)
**Result:** `success` | **Jobs:** 1 | **Tests:** 35 | **Failures:** 0 | **Duration:** 6m 42s

<!-- ci-dashboard-recap:end -->

## CI Results
[Workflow Run ⚙️](https://github.com/huggingface/transformers/actions/runs/29515319089)

### Commit Info
| Context | Commit | Description |
|---------|--------|-------------|
| RUN | [1058ae56](https://github.com/huggingface/transformers/commit/1058ae563b22896444faccc5db268871ad2e40b0) | workflow commit (merge commit) |
| PR | [620f3ee0](https://github.com/huggingface/transformers/commit/620f3ee03dbec369a9459f80957b532d11f855a6) | branch commit (from PR) |
| main | [191c44a7](https://github.com/huggingface/transformers/commit/191c44a72bec5e5250d9fadb47b6a0e429db75ca) | base commit (on `main`) |

✅ No failing test specific to this PR 🎉 👏 !