[Fix] Remove old automatic cross attn pattern from output recorders
Author: remi-or
Pull request: yes

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

This PR cleans up `_can_record_outputs` and output capturing in general.
  
  - Removed the implicit "2-element `attentions` list rule: it used to be that if there is a list of two recorders as a value of the "attention" key, it would be considered that one was for the attention and the other for the cross attention. This is not longer the case, and the models that relied on that now use the proper "cross-attention" key.
  - `layer_name` matching is now accounts for module boundaries: if you say the `layer_name` for a recorder is `attention`, the check will only match if `.attention.` (or `.attention` for trailing case) is in the module name. For instance, no more fake match with `crossattention`. 
  - `patch_output_recorders` now handles every recorder form (lists, class-name strings, `target_class=None`) without crashing or overwriting recorders, and only writes back on an actual replacement.
  - Deprecated tuple values in `_can_record_outputs` in favor of lists (few instances of tuple use have been taken care of)
  - Simplified mllama's recorders to plain classes, since cross-attention there is a layer type recorded under `attentions` for BC.
  - Removed useless `_can_record_outputs` dict for t5gemma/t5gemma2
  - Un-skipped the minimax `test_attention_outputs` with per-layer-type shape checks.
  - Added `patch_output_recorders` tests for list/string/non-matching recorder forms and documented the expected formatting of the dict values in the docstrings and docs (en + ro (thx claude for that one)).

Backwards compatibility notes:
1. encoder-only BigBird model now returns an empty tuple instead of None, which would mirror other multimodal model behavior
2. decoder BigBird cross attentions capture was broken, because the "2 attn to capture interpreted as attn, cross-attn" checked if the iterable containing the 2 attn was a list, and BigBird's was a tuple. So cross-attention container stayed empty. It is now fixed.
  
Tests: 
- [x] `RUN_SLOW=1 pytest tests/test_monkey_patching.py` 
- [x]  `pytest tests/models/ -k "test_attention_outputs or test_hidden_states_output or test_capture_outputs_decorator or features_hidden_states or features_attentions or image_features_output or generate_dict_output or generate_compilation_all_outputs"`
- [x]  `RUN_SLOW=1 pytest tests/models/minimax`
- [x]  `RUN_SLOW=1 pytest tests/models/mllama`

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

run-slow: autoformer, big_bird, clvp, dia, florence2, lw_detr, minimax, mllama, olmo_hybrid, rf_detr, t5gemma, t5gemma2

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

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

models: ["models/autoformer", "models/big_bird", "models/clvp", "models/dia", "models/florence2", "models/lw_detr", "models/minimax", "models/mllama", "models/olmo_hybrid", "models/rf_detr", "models/t5gemma", "models/t5gemma2"]
quantizations: []

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

### Commit Info
| Context | Commit | Description |
|---------|--------|-------------|
| RUN | [be525956](https://github.com/huggingface/transformers/commit/be52595671223c0a2f6760eeaaad902ffad3cb6c) | workflow commit (merge commit) |
| PR | [3be274b7](https://github.com/huggingface/transformers/commit/3be274b71c1ae5862b97420c521270f5bbb1173c) | branch commit (from PR) |
| main | [246ed266](https://github.com/huggingface/transformers/commit/246ed266fc0f600b508a19e1d270c27e1b525c45) | base commit (on `main`) |

### Model CI Report

❌ **[1 new failed tests from this PR](https://huggingface.co/datasets/hf-internal-testing/transformers_pr_ci/raw/99b379d4a00818a6745d96b99568a5bd391f91b2/2026-07-07/runs/37425-28849252133/ci_results_run_models_gpu/new_failures_with_bad_commit.json)** 😭

- [florence2](https://github.com/huggingface/transformers/actions/runs/28849252133/job/85561376125):
    tests/models/florence2/test_modeling_florence2.py::Florence2ForConditionalGenerationModelTest::test_sdpa_can_dispatch_on_flash (✅ ⟹ ❌)



Reverted the florence 2 test changes, slow tests pass apart from those (I tried something and it did not work out)

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

run-slow: autoformer, big_bird, clvp, dia, lw_detr, minimax, mllama, olmo_hybrid, rf_detr, t5gemma, t5gemma2

<!-- 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=47117)
**Latest run:** [28984136974:1](https://github.com/huggingface/transformers/actions/runs/28984136974)
**Result:** `success` | **Jobs:** 15 | **Tests:** 148,961 | **Failures:** 0 | **Duration:** 18h 45m

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