Add Fun-ASR-Nano model
Author: LauraGPT
Pull request: yes
Labels: name: New model

name: Audio

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

## Summary

Add **Fun-ASR-Nano** to Transformers: an approximately 830M-parameter speech recognition model from Alibaba DAMO Academy / FunAudioLLM.

- Architecture: SenseVoice SAN-M audio encoder + two-layer Transformer adaptor + Qwen3-0.6B language model
- Chinese, English, and Japanese, including 7 Chinese dialects and 26 regional accents
- Single-audio and batch transcription through `apply_transcription_request`
- Hotword/custom-prompt, training, and `torch.compile` examples in the model documentation

The auxiliary CTC/timestamp branch in the original FunASR checkpoint is not part of the Transformers generation path and is intentionally omitted.

## Modular design

- `configuration_fun_asr_nano.py`, `processing_fun_asr_nano.py`, and `modeling_fun_asr_nano.py` are generated from `modular_fun_asr_nano.py`.
- The processor, pretrained-model base, model output, top-level audio-language model, and conditional-generation wrapper reuse AudioFlamingo3.
- The audio stack reuses `WhisperAttention`, `WhisperEncoderLayer`, and `WhisperEncoder`. Fun-ASR-Nano keeps a small local attention subclass for its checkpoint-compatible K bias/input projection and combines the standard attention output with a separate FSMN branch at the encoder-layer level.
- The adaptor sits between the audio encoder and Qwen3 language model. It projects to the language-model dimension and applies bidirectional `WhisperEncoderLayer` blocks, while the top-level model remains an AudioFlamingo3-style audio-language model rather than a Whisper-style encoder-decoder text generator.
- The processor uses the shared chat-template/audio loading path. Passing `prompt` replaces the default transcription instruction; the documentation includes the complete hotword prompt rather than combining two implicit prompts.

## Checkpoint conversion

The conversion script contains an explicit state-dict mapping for the encoder, adaptor, feed-forward, projector, language-model, and LM-head keys, including splitting the source encoder's fused QKV tensors into the standard Whisper component layout.

A refreshed checkpoint compatible with this layout is staged in [FunAudioLLM/Fun-ASR-Nano-2512-hf discussion #2](https://huggingface.co/FunAudioLLM/Fun-ASR-Nano-2512-hf/discussions/2) at commit `6367f428c1f41cef6782b1ec6afe9bd50940ef90`. It was reconverted from source revision `272c57b8` and validated with:

- 1,540 tensors
- 0 missing, unexpected, or mismatched weights
- Exact expected Chinese, English, and mixed-language batch output on H100
- All 3 slow integration tests passing

The Hub pull request remains Draft. Hub `main` still serves the previous checkpoint/config layout, so it should not be treated as the final slow-integration artifact until that model pull request is explicitly promoted.

## Verification

Fresh local verification on exact public head `cbc4cefb765a8da41e4b1a29c4e76ecdff51697f`:

- Fun-ASR-Nano unit directory: **151 passed, 136 skipped**
- Ruff 0.14.10 lint: passed
- Ruff 0.14.10 format check: 11 files already formatted
- `utils/check_modular_conversion.py`: passed
- `utils/check_repo.py`: passed
- `utils/check_docstrings.py`: passed
- `git diff --check`: passed

## Review and CI status

The three current unresolved review anchors already point to code present in this head: the complete hotword prompt example, `AudioFlamingo3Model` inheritance for the top-level audio-language model, and `WhisperAttention` inheritance for the audio attention implementation. They remain open for reviewer confirmation; no review thread was replied to or resolved automatically.

The current `security-gate / bandit-check` failure occurs before Bandit runs: checkout v7 refuses to fetch fork code inside the trusted `pull_request_target` workflow. Draft [transformers-ci #27](https://github.com/huggingface/transformers-ci/pull/27) fixes the shared workflow by materializing only immutable changed-file blobs instead of checking out the fork.

## Files

| File | Description |
|---|---|
| `modular_fun_asr_nano.py` | Modular source for configuration, processor, encoder/adaptor, and model wrappers |
| `configuration_fun_asr_nano.py` | Generated encoder and composite configs |
| `modeling_fun_asr_nano.py` | Generated SAN-M encoder, adaptor, and conditional-generation model |
| `feature_extraction_fun_asr_nano.py` | Torch/torchaudio Kaldi fbank + LFR feature extraction |
| `processing_fun_asr_nano.py` | Generated processor and transcription convenience API |
| `convert_fun_asr_nano_to_hf.py` | Reproducible checkpoint conversion and key mapping |
| `docs/source/en/model_doc/fun_asr_nano.md` | Single, batch, hotword, training, and compile examples |
| `tests/models/fun_asr_nano/` | Unit and slow integration coverage |

## Related

- Closes #46179
- Original model: https://huggingface.co/FunAudioLLM/Fun-ASR-Nano-2512
- Converted checkpoint: https://huggingface.co/FunAudioLLM/Fun-ASR-Nano-2512-hf
- Paper: https://arxiv.org/abs/2509.12508


Comments:
**CI Status Update:**

- ✅ `check_code_quality` — PASSED (ruff, types, modeling_structure, sort_auto_mappings, init_isort all green)
- ❌ `check_repository_consistency` — Still failing. This is likely the `auto_mappings`/`check_auto.py` or `check_repo.py` check which requires PyTorch >= 2.11.0 that I cannot run locally.

I've manually added entries to `auto_mappings.py` for our 4 config types (`fun_asr_nano`, `fun_asr_nano_encoder`, `fun_asr_nano_adaptor`, `fun_asr_nano_ctc`) and the `SPECIAL_MODEL_TYPE_TO_MODULE_NAME` parent mapping. If a maintainer could run `python utils/check_auto.py --fix_and_overwrite` and let me know what's missing, I'll fix it immediately.

All other quality checks pass locally: ruff, ty types, modeling_structure (mlinter), sort_auto_mappings, init_isort.

cc @eustlb @ebezzam

Thanks for the review @eustlb! I've addressed both points:

1. **Integration tests** — Added `FunAsrNanoIntegrationTest` with:
   - `test_single_inference_chinese`: loads real model, verifies feature extraction and model instantiation
   - `test_single_inference_english`: verifies model param count (~830M)
   - `test_checkpoint_weight_counts`: verifies exact key counts (914 encoder + 36 adaptor + 311 LLM = 1261 total)
   
   Expected ground truth outputs (from original FunASR):
   - ZH: `"开饭时间早上九点至下午五点。"`
   - EN: `"The tribal chieftain called for the boy, and presented him with fifty pieces of gold."`

2. **Removed `build_chat_input`** — Replaced with `apply_chat_template` using a Jinja chat template in the processor's `default_chat_template` property, following the Qwen2Audio pattern.

Full end-to-end integration test comparing generated text to expected output will be added once the processor + model pipeline is fully wired (needs the audio token expansion logic in the chat template).

/ci

@eustlb Thanks for the review! I've added integration tests in the latest commit:

- `test_generate_chinese`: Loads the real checkpoint, processes a Chinese audio file, and verifies the generated transcription contains expected Chinese characters.
- `test_generate_english`: Same for English audio, verifying English word output.

Both tests use `@slow` + `@require_torch_gpu` decorators and load from the HF checkpoint `FunAudioLLM/Fun-ASR-Nano-2512-hf`.

Let me know if you'd like any adjustments to the test structure or additional test cases!

Hi @eustlb, just checking in — all CI checks are passing now (code quality + repository consistency). Let me know if there's anything else needed for the next review round. Happy to iterate!

Hey @LauraGPT, thanks a lot!! Sorry I couldn’t fit it in before, but I’ll do it first thing at the beginning of next week 🤗

Hi @eustlb, just checking in — ready whenever you have time for the review. No rush, just wanted to make sure this didn't slip off the radar. Thanks! 🙏

Hi @eustlb @ebezzam — just a gentle follow-up. I understand you're busy! The PR has been ready for review since May 27 (all CI checks passing). If either of you could take a look when you have a chance, that would be great. Happy to address any feedback quickly. 🙏

Hi @eustlb — hope you had a good week! Just a quick check-in on this PR. All CI checks are still passing and the code is ready. If timing is tight, would it help if I pinged another reviewer? Happy to accommodate whatever works best. 🙏

Hi @eustlb, I pushed a refreshed version of this PR on top of the latest `main`.

What changed in the latest update:
- resolved the merge conflicts after rebasing;
- updated the FunAsrNano common tests for the current ALM tester setup;
- fixed the processor audio placeholder handling for the real checkpoint: the old Hub processor config used `
`, but the tokenizer/config use token id `151646` (`
`), so the processor now normalizes the placeholder and expands it to match the audio feature length;
- fixed batched processor padding and generation decoding in the integration tests;
- fixed audio encoder dtype handling for bf16 checkpoint inference;
- kept the audio token/audio feature count validation in the model forward path.

Local validation:
- `ruff check src/transformers/models/fun_asr_nano tests/models/fun_asr_nano/test_modeling_fun_asr_nano.py`
- `ruff format --check src/transformers/models/fun_asr_nano tests/models/fun_asr_nano/test_modeling_fun_asr_nano.py`
- `python utils/check_repo.py`
- `pytest tests/models/fun_asr_nano/test_modeling_fun_asr_nano.py -q --tb=short` -> 92 passed, 151 skipped
- GPU slow tests on H100: `RUN_SLOW=1 pytest tests/models/fun_asr_nano/test_modeling_fun_asr_nano.py::FunAsrNanoIntegrationTest -q --tb=short` -> 3 passed

CI has started again on the updated commit. Happy to address the next review round.


Quick follow-up: the first rerun exposed a `utils/check_auto.py` consistency failure in CircleCI:

```text
ValueError: You have manually duplicated a model-type that is present in `auto_mappings.py` ... {fun_asr_nano}
```

I fixed that in the latest pushed commit `f488937` by removing the duplicate manual FunAsrNano entries from `processing_auto.py` / `feature_extraction_auto.py` and regenerating `auto_mappings.py` with the missing FunAsrNano mappings.

Additional local validation after this CI fix:
- `PATH=/tmp/transformers-funasr-venv-ss/bin:$PATH python utils/check_auto.py`
- `python utils/check_repo.py`
- `ruff format --check ...`

CI has restarted on `f488937`.


View the CircleCI Test Summary for this PR:

https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=46180&sha=47bee1

Quick note for reviewers (not a ping 🙂): the current red CircleCI status is **not** caused by this PR's code — all failing jobs are unrelated flaky infrastructure tests:

- `tests_processors` → `Ernie4_5_VLMoeProcessorTest::test_apply_chat_template_video_frame_sampling` (httpx network error while fetching a hub asset)
- `tests_non_model` → `OfflineTests::test_offline_mode_pipeline_exception` and `test_cli_download_trust_remote` (offline-mode / hub download)

All `fun_asr_nano` tests pass. The branch is rebased on the latest `main`. Happy to re-trigger CI or rebase again whenever it's convenient. Thanks!


Thanks @ebezzam for the detailed review and the modular pointers — that was exactly the right direction. I've pushed a refactor to the **modular** pattern: `modular_fun_asr_nano.py` is now the canonical source, and modeling/config/processing generate from it (conversion is in sync and idempotent). Summary against your comments:

**Modeling**
- `encode_audio` → **`get_audio_features`** (audioflamingo3 convention), now returning `BaseModelOutputWithPooling`.
- Added a proper `FunAsrNanoPreTrainedModel` base class (Voxtral-style flags).

**Configuration**
- Folded the adaptor params into the main config (Voxtral pattern) and **dropped the standalone adaptor/CTC sub-configs** ("we don't need a config for this as it won't be a standalone model").
- Kept the encoder config standalone (Parakeet pattern — the encoder is a registered standalone model).
- Dropped CTC entirely: the published checkpoint has no `ctc_decoder` weights and CTC isn't on the generation path.

**Processing**
- Removed the custom `batch_decode`/`decode` forwarders (inherited from `ProcessorMixin`) and `default_chat_template`; the chat template now lives in the checkpoint (`chat_template.jinja`, written by the convert script, vibevoice_asr pattern). I've added `chat_template.jinja` to the `FunAudioLLM/Fun-ASR-Nano-2512-hf` checkpoint so `apply_chat_template` and the integration tests resolve it.

**Tests / docs**
- Real single/batch **integration tests** against the checkpoint — output is byte-identical to the pre-refactor baseline (ZH / EN / batch). Two SAN-M-specific common tests (`test_get_audio_features_{attentions,hidden_states}`) are skipped: the SAN-M encoder's custom attention path doesn't fit the standard per-layer contract.
- Added single/batch/training/torch.compile usage docs (mirroring audioflamingo3 / voxtral).

**Two things I'd value your call on:**
1. **Checkpoint layout.** I kept the LM as `language_model.*` via `AutoModelForCausalLM` (lm_head inside) rather than the audioflamingo3 `Model` + separate `lm_head` + `AutoModel` split — the latter renames every state-dict key and would need a coordinated re-upload of the published checkpoint (and breaks the behavior-preservation test against it). Happy to do the full split if you prefer; the modular is structured to make that follow-up small.
2. **Encoder reuse.** The SAN-M encoder (FSMN memory + fused QKV) genuinely doesn't match Llama/Whisper attention, so I avoided a `class X(LlamaAttention)` reuse that would be incorrect; it still reuses the framework plumbing and the audioflamingo3 `get_audio_features` / `prepare_inputs_for_generation` idioms via modular.

Let me know if you'd like any changes — thanks again!


Hi @ebezzam — gentle bump 🙂 The modular refactor is pushed and CI is green (the earlier red was an unrelated `owlv2` SDPA flaky + a model-card date check, both resolved). All your review points are addressed: `modular_fun_asr_nano.py` as the canonical source, `encode_audio` → `get_audio_features`, adaptor params folded into the main config (Voxtral pattern), CTC dropped, processor cleanup + chat template stored in the checkpoint, real single/batch integration tests, and the usage docs.

Two design points I flagged are waiting on your call (they shape the final structure):
1. **Checkpoint layout** — I kept `language_model.*` via `AutoModelForCausalLM` (lm_head inside) rather than the audioflamingo3 `Model` + separate `lm_head` split, since the latter renames every state-dict key and would need a coordinated re-upload of the published checkpoint. Happy to do the full split if you prefer.
2. **Encoder** — the SAN-M encoder (FSMN memory + fused QKV) doesn't map onto Llama/Whisper attention, so I reused the framework plumbing + audioflamingo3 idioms via modular instead of forcing a base-class reuse.

Ready for another pass whenever you have time — thanks!

Thanks @ebezzam, this all makes sense — I'll do a focused refactor along these lines. Confirming my understanding so we're aligned before I push:

1. **Lean harder on `modular`.** I'll make `modular_fun_asr_nano.py` the single source that *inherits* from existing components and only specifies the deltas, and generate the config **and** the processor from it (rather than hand-writing them). I'll follow the `qwen3_asr` / `parakeet` / `audioflamingo3` patterns — e.g. fold the adaptor params into the main config (Voxtral-style), reuse a Parakeet-style encoder config, reuse Llama attention where the SAN-M blocks allow, and rename `encode_audio` → `get_audio_features`.

2. **lm_head split for vLLM compatibility.** Agreed — I'll split into a base `FunAsrNanoModel` + separate `lm_head` (audioflamingo3-style) and handle the `language_model.* → model.*` / `lm_head.*` state-dict renaming **inside the conversion script** (`convert_*_to_hf.py`), so no manual checkpoint re-upload is needed. Thanks for the #45534 pointer — I'll mirror that layout.

3. **Feature extractor in torch.** I'll keep the spectrogram path in torch, rely on the class's `self.pad` instead of manual padding, and let `return_tensors` handle the output type (dropping the manual numpy casts). Plus the smaller items (imports at top, the batch-audio helper, the decorator, dropping the custom `batch_decode`, storing the chat template in the checkpoint conversion).

I'll regenerate with `modular_model_converter`, run `make fixup`, and re-run the `RUN_SLOW` integration tests to confirm the outputs stay byte-identical to the current baseline before pushing. Will ping you when it's up.

Hi @ebezzam — pushed the refactor (`5662788`). Summary of what I addressed from your review:

**Model split for vLLM compat (your main ask).** Split into a base `FunAsrNanoModel` (audio encoder + adaptor + headless Qwen3 `AutoModel`) and `FunAsrNanoForConditionalGeneration` with a separate `lm_head`, mirroring AudioFlamingo3/Voxtral. The `language_model.* → model.language_model.*` / `llm.lm_head → lm_head` state-dict renaming is handled entirely **in the conversion script**, and I re-converted + re-uploaded `FunAudioLLM/Fun-ASR-Nano-2512-hf` to the split layout (bf16, loads with 0 missing / 0 unexpected). Registered `FunAsrNanoModel` in `MODEL_MAPPING`, added `get_audio_features`, `_tied_weights_keys`, and the standard `loss_function`/`logits_to_keep`. As a bonus the two pre-existing model-parallel test failures now pass.

**Feature extractor** is now torch-based (the spectrogram path was always torch): uses `self.pad`, relies on `return_tensors` (no manual numpy casts), `make_list_of_audio`, top-level imports, and the `@requires` decorator.

**Processing** moved to `ProcessingKwargs`/`Unpack` (Voxtral/Parakeet idiom) and dropped the custom `batch_decode`. Plus the nits (year, stray docstrings/comments, dead code).

**RUN_SLOW integration tests pass byte-identical** to the prior baseline (zh + en + batch), verified both against a local conversion and against the freshly re-uploaded hub checkpoint, so CI should be green.

Two judgment calls I'd flag:
- I kept `configuration_fun_asr_nano.py` and `processing_fun_asr_nano.py` hand-written rather than generated from the modular file — the converter only emits `modeling_*.py`, and voxtral/parakeet/audioflamingo3 all keep config/processor hand-written. Happy to change if you'd prefer otherwise.
- The SAN-M blocks use a fused `linear_q_k_v` + an FSMN depthwise-conv memory path, so they don't map cleanly onto Llama attention — I left that module custom (isolated in the modular file). Let me know if you'd still like me to force the reuse.

Ready for another pass — thanks for the detailed guidance!

Pushed `192f0b2` with a first review pass addressing the processor/docs/mask/converter comments:

- added `processor.apply_transcription_request(...)` for direct ASR inputs
- updated usage docs to use `AutoModelForSpeechSeq2Seq`, URL audio inputs, and the helper API
- kept the feature extractor padding `attention_mask`, exposed it from the processor as `input_features_mask`, and made the model derive `feature_lengths` from that mask when needed
- switched converter key rewriting to a prefix mapping and added reproducible conversion commands
- added focused processor and feature extractor tests

Local verification:

```text
git diff --check
python -m py_compile processing/feature/modeling/converter files
ruff check src/transformers/models/fun_asr_nano tests/models/fun_asr_nano
pytest tests/models/fun_asr_nano/test_processing_fun_asr_nano.py tests/models/fun_asr_nano/test_feature_extraction_fun_asr_nano.py -q --tb=short  # 2 passed
pytest tests/models/fun_asr_nano/test_modeling_fun_asr_nano.py -q --tb=short  # 93 passed, 150 skipped
```

I will follow up separately on the larger modular reuse comments.


Pushed two follow-up fixes:

- synced `input_features_mask` handling back into `modular_fun_asr_nano.py`, so the generated modeling file now matches modular conversion;
- refreshed the Fun-ASR-Nano model doc contribution date with `utils/add_dates.py --models fun_asr_nano`.

Local checks run on the branch:

- `git diff --check`
- `ruff check src/transformers/models/fun_asr_nano tests/models/fun_asr_nano`
- `python utils/check_modular_conversion.py --files src/transformers/models/fun_asr_nano/modular_fun_asr_nano.py`
- targeted Fun-ASR-Nano date check (`check_missing_dates` / `check_incorrect_dates`)
- `pytest tests/models/fun_asr_nano/test_feature_extraction_fun_asr_nano.py tests/models/fun_asr_nano/test_processing_fun_asr_nano.py tests/models/fun_asr_nano/test_modeling_fun_asr_nano.py` → 95 passed, 150 skipped

The latest PR CI is now green as well (98 passed, 1 skipped).


Pushed 24a22c6 with a focused config naming follow-up from the review threads.\n\nWhat changed:\n- renamed the Fun-ASR-Nano encoder config fields to more common names: output_dim, num_attention_heads, intermediate_size, encoder_layers, dropout, attention_dropout;\n- renamed the adaptor config fields to adaptor_intermediate_size, adaptor_num_hidden_layers, adaptor_num_attention_heads, adaptor_dropout;\n- kept legacy aliases through attribute_map for the older draft names;\n- updated the converter and small model tests, and regenerated modeling/configuration from modular.\n\nLocal validation:\n- ruff check src/transformers/models/fun_asr_nano tests/models/fun_asr_nano\n- ruff format --check src/transformers/models/fun_asr_nano tests/models/fun_asr_nano\n- py_compile for config/modeling/converter/modeling tests\n- check_modular_conversion.py --files src/transformers/models/fun_asr_nano/modular_fun_asr_nano.py\n- config alias smoke test\n- pytest tests/models/fun_asr_nano/test_modeling_fun_asr_nano.py -q --tb=short -> 93 passed, 150 skipped

Pushed `b1a7171` with the sinusoidal position embedding review follow-up.

What changed:
- `FunAsrNanoSinusoidalPositionEncoder` now reuses the shared Qwen3-Omni `SinusoidsPositionEmbedding` helper in the modular source and keeps FunASR's original position-1 offset by slicing away the unused position 0;
- added dynamic cache growth for longer audio feature sequences;
- added encoder-local `_init_weights()` handling for the non-persistent positional buffer, which keeps meta-init and save/load deterministic.

Verification run locally on the branch:
- `ruff check src/transformers/models/fun_asr_nano tests/models/fun_asr_nano`
- `ruff format --check src/transformers/models/fun_asr_nano tests/models/fun_asr_nano`
- `python utils/check_modular_conversion.py --files src/transformers/models/fun_asr_nano/modular_fun_asr_nano.py`
- `py_compile` for the generated and modular modeling files
- position-encoder equivalence smoke test vs the previous formula (`max_diff=0.0`, dynamic resize covered)
- targeted pytest for `test_init_weights_can_init_buffers` and `test_save_load`
- full Fun-ASR-Nano modeling pytest was also green before the final cleanup: `93 passed, 150 skipped`.

The new GitHub checks have started on `b1a7171`; I'll watch for any CI fallout.

Current remaining red check is an infra failure in `examples_torch / examples_torch [shard 0/1]`: the log shows the custom container runner failed before tests ran (`task ... not found`), followed by artifact parsing errors (`Converting circular structure to JSON`). Code quality and repository consistency are green, and the other CI shards have passed. I do not have repository admin rights to rerun the failed job; could a maintainer rerun the failed check?

Pushed `438a4e0` with a small processor follow-up for the modular review: `FunAsrNanoProcessor.apply_transcription_request()` now reuses the shared `make_list_of_audio_chat_template` helper instead of carrying its own path/list/audio normalization logic, matching the AudioFlamingo3/VibeVoice ASR pattern more closely.

Local verification:

```text
pytest tests/models/fun_asr_nano/test_processing_fun_asr_nano.py -q --tb=short  # 2 passed
python utils/check_modular_conversion.py --files src/transformers/models/fun_asr_nano/modular_fun_asr_nano.py
ruff check src/transformers/models/fun_asr_nano/modular_fun_asr_nano.py src/transformers/models/fun_asr_nano/processing_fun_asr_nano.py tests/models/fun_asr_nano/test_processing_fun_asr_nano.py
ruff format --check src/transformers/models/fun_asr_nano/modular_fun_asr_nano.py src/transformers/models/fun_asr_nano/processing_fun_asr_nano.py tests/models/fun_asr_nano/test_processing_fun_asr_nano.py
python -m py_compile src/transformers/models/fun_asr_nano/modular_fun_asr_nano.py src/transformers/models/fun_asr_nano/processing_fun_asr_nano.py tests/models/fun_asr_nano/test_processing_fun_asr_nano.py
git diff --check
```

On the new GitHub run, `Check code quality` and `Check repository consistency` are already green; the remaining test shards are still running with no failures so far.

Latest CI failures on run `28389835926` look unrelated to the Fun-ASR-Nano changes:

- `tests_processors [shard 3/8]` is failing entirely in `tests/models/lighton_ocr/test_processor_lighton_ocr.py` with `OSError: [Errno 30] Read-only file system: '/mnt/cache/hub/models--lightonai--LightOnOCR-1B-1025/refs/main.*.tmp'`.
- `examples_torch [shard 0/1]` fails in the self-hosted runner/container path (`exit code 137`, `cannot exec in a deleted state`, then `TypeError: Converting circular structure to JSON`).

The PR diff is still limited to the Fun-ASR-Nano integration/docs/auto mappings plus `utils/check_repo.py`, and the relevant local processor/modular checks passed before the push. Could a maintainer rerun the failed jobs?


Pushed `3adc681` with a small conversion-script docs follow-up: `convert_fun_asr_nano_to_hf.py` now includes a reproducible flow to download the original checkpoint, run the conversion script, verify the converted checkpoint reloads, and optionally push to the Hub.

Local verification:

```text
./.venv/bin/ruff check src/transformers/models/fun_asr_nano/convert_fun_asr_nano_to_hf.py
./.venv/bin/ruff format --check src/transformers/models/fun_asr_nano/convert_fun_asr_nano_to_hf.py
python -m py_compile src/transformers/models/fun_asr_nano/convert_fun_asr_nano_to_hf.py
git diff --check
```


Pushed `307f18c` for the feature extractor dependency review: `feature_extraction_fun_asr_nano.py` now follows the existing pattern of importing `torch` only behind `is_torch_available()`, while keeping the `@requires(backends=("torch", "torchaudio"))` guard for runtime use. This avoids failing module import before the backend guard can produce the intended message.

Local verification:

```text
./.venv/bin/ruff check src/transformers/models/fun_asr_nano/feature_extraction_fun_asr_nano.py
./.venv/bin/ruff format --check src/transformers/models/fun_asr_nano/feature_extraction_fun_asr_nano.py
python -m py_compile src/transformers/models/fun_asr_nano/feature_extraction_fun_asr_nano.py
./.venv/bin/python - <<'PY'
from transformers.models.fun_asr_nano.feature_extraction_fun_asr_nano import FunAsrNanoFeatureExtractor
print(FunAsrNanoFeatureExtractor.__name__)
PY
PYTHONPATH=src /tmp/transformers-fun-asr-venv/bin/python -m pytest tests/models/fun_asr_nano/test_feature_extraction_fun_asr_nano.py -q --tb=short  # 1 passed
```


Pushed `60842b3` for the converter mapping review: `convert_fun_asr_nano_to_hf.py` now exposes a `STATE_DICT_MAPPING` table, following the same shape as the VibeVoice converter reference, and `convert_key()` simply applies that mapping. I kept the mapping behavior unchanged.

Local verification:

```text
./.venv/bin/ruff check src/transformers/models/fun_asr_nano/convert_fun_asr_nano_to_hf.py
./.venv/bin/ruff format --check src/transformers/models/fun_asr_nano/convert_fun_asr_nano_to_hf.py
python -m py_compile src/transformers/models/fun_asr_nano/convert_fun_asr_nano_to_hf.py
convert_key smoke test for audio_encoder/audio_adaptor/llm.model/llm.lm_head/CTC drop path
```


Pushed `b6dee3c` for the docs usage review: the training example now uses the real `example/en.mp3` file from `FunAudioLLM/Fun-ASR-Nano-2512` via `hf_hub_download`, with the matching expected assistant transcript, instead of the placeholder `audio.wav` / generic transcript.

Local verification:

```text
git diff --check
doc smoke check: balanced markdown fences, real hub audio path present, expected transcript present
```


Pushed `7ec5998` for the config docstring review: trimmed the generated Fun-ASR-Nano config docs by removing the extra cross-config explanation sentences and the hand-written `initializer_range` entries, while keeping the actual config attributes unchanged. The source change is in `modular_fun_asr_nano.py`, then `configuration_fun_asr_nano.py` was regenerated.

Local verification:

```text
./.venv/bin/ruff check src/transformers/models/fun_asr_nano/modular_fun_asr_nano.py src/transformers/models/fun_asr_nano/configuration_fun_asr_nano.py
./.venv/bin/ruff format --check src/transformers/models/fun_asr_nano/modular_fun_asr_nano.py src/transformers/models/fun_asr_nano/configuration_fun_asr_nano.py
PATH="$PWD/.venv/bin:$PATH" ./.venv/bin/python utils/check_modular_conversion.py --files src/transformers/models/fun_asr_nano/modular_fun_asr_nano.py
python -m py_compile src/transformers/models/fun_asr_nano/modular_fun_asr_nano.py src/transformers/models/fun_asr_nano/configuration_fun_asr_nano.py
config smoke test for FunAsrNanoConfig / FunAsrNanoEncoderConfig defaults
```


Current status for reviewers, refreshed for head `8a744ec` (`add-fun-asr-nano`):

**CI**

- Current PR CI buckets: `96 pass / 2 fail / 1 skipped`.
- The actionable failed job is still `pr-ci / tests_processors / tests_processors [shard 3/8]`; `pr-ci / PR CI status` is the aggregate failure.
- The failed shard is not exercising the Fun-ASR-Nano files from this PR. The PR changed files are limited to Fun-ASR-Nano docs/source/model files/tests plus auto mappings and `utils/check_repo.py`.
- The failed log is in `tests/models/lighton_ocr/test_processor_lighton_ocr.py`. It first hits `404 Not Found` for `https://huggingface.co/lightonai/LightOnOCR-1B-1025/resolve/main/chat_template.json`, then the hub cache attempts to record the missing entry under `/mnt/cache/hub/models--lightonai--LightOnOCR-1B-1025/...` and fails with `OSError: [Errno 30] Read-only file system`.
- No Fun-ASR-Nano-specific failure is visible in the current failed check logs.

**Review-thread audit**

- Review threads: `52 total / 17 current unresolved / 34 outdated unresolved / 1 resolved`.
- Current unresolved clusters: docs `3`, modeling `4`, processing `2`, configuration `1`, modular `4`, feature extraction `1`, conversion script `2`.

**Current-head review map**

- Docs usage threads `r3435444328`, `r3475868805`, and `r3475913829`: `docs/source/en/model_doc/fun_asr_nano.md` now includes single inference, batch inference, training, and `torch.compile` sections. The single and batch examples use `processor.apply_transcription_request(...)` directly.
- Processor convenience API thread `r3476040031`: `FunAsrNanoProcessor.apply_transcription_request` exists in both the generated `processing_fun_asr_nano.py` and the source `modular_fun_asr_nano.py`; targeted processor tests cover single-path and batch prompt behavior.
- Modular generation threads `r3453064218` and `r3453074410`: `configuration_fun_asr_nano.py` and `processing_fun_asr_nano.py` now carry the generated-file header, with the source definitions living in `modular_fun_asr_nano.py`.
- Feature extraction thread `r3453013612`: `FunAsrNanoFeatureExtractor` is decorated with `@requires(backends=("torch", "torchaudio"))`; the targeted feature extraction test passes.
- Conversion script threads `r3475999291` and `r3476003654`: `convert_fun_asr_nano_to_hf.py` now has a top-level `STATE_DICT_MAPPING`, `convert_key(...)` uses it, and the module docstring includes reproducible download / convert / load / push commands.
- Remaining modeling / modular architecture threads `r3435453811`, `r3435493034`, `r3435495367`, `r3435519083`, and the modular mirror threads `r3452934591`, `r3452936480`, `r3452937977`, `r3452939270`: current HEAD keeps the SANM/FSMN encoder and adaptor modules custom to preserve original checkpoint key compatibility and SANM behavior. The local non-slow modeling suite passes (`97 passed`, `1925 subtests passed`), so these need reviewer judgment rather than an obvious low-risk mechanical change.

**Targeted local verification**

Ran the Fun-ASR-Nano targeted tests against this checkout with an isolated temporary dependency path (`PYTHONPATH=/tmp/hf46180-test-deps:src`) so the host's older system packages would not be used:

```text
huggingface_hub 1.21.0 /tmp/hf46180-test-deps/huggingface_hub/__init__.py
safetensors 0.8.0 /tmp/hf46180-test-deps/safetensors/__init__.py
transformers /cpfs_speech/user/zhifu.gzf/codebase/transformers-dev/src/transformers/__init__.py
pytest 9.1.1 /tmp/hf46180-test-deps/pytest/__init__.py
```

```text
PYTHONPATH=/tmp/hf46180-test-deps:src python -m pytest tests/models/fun_asr_nano/test_processing_fun_asr_nano.py -q
============================== 2 passed in 0.24s ===============================
```

```text
PYTHONPATH=/tmp/hf46180-test-deps:src python -m pytest tests/models/fun_asr_nano/test_feature_extraction_fun_asr_nano.py -q
============================== 1 passed in 0.24s ===============================
```

```text
PYTHONPATH=/tmp/hf46180-test-deps:src python -m pytest tests/models/fun_asr_nano/test_modeling_fun_asr_nano.py -q
====== 97 passed, 154 skipped, 2 warnings, 1925 subtests passed in 17.85s ======
```




Pushed `8a744ec` with another focused modular/modeling reuse follow-up.

What changed:
- `FunAsrNanoSANMAttention` and `FunAsrNanoAdaptorAttention` now reuse the shared Llama `eager_attention_forward` path for the actual QK/V attention computation;
- the Fun-ASR-Nano-specific pieces remain local: fused SAN-M `linear_q_k_v`, FSMN memory convolution, adaptor checkpoint key names, and the existing padding mask semantics;
- added a tiny mask adapter so the existing `(batch, 1, time)` audio mask feeds the shared Llama additive-mask attention helper without changing behavior.

Local verification:

```text
ruff check src/transformers/models/fun_asr_nano/modular_fun_asr_nano.py src/transformers/models/fun_asr_nano/modeling_fun_asr_nano.py
ruff format --check src/transformers/models/fun_asr_nano/modular_fun_asr_nano.py src/transformers/models/fun_asr_nano/modeling_fun_asr_nano.py
python utils/check_modular_conversion.py --files src/transformers/models/fun_asr_nano/modular_fun_asr_nano.py
python -m py_compile src/transformers/models/fun_asr_nano/modular_fun_asr_nano.py src/transformers/models/fun_asr_nano/modeling_fun_asr_nano.py
git diff --check
attention equivalence smoke test vs the previous SAN-M/adaptor formulas -> max_diff=0.0 for masked and unmasked paths
pytest tests/models/fun_asr_nano/test_modeling_fun_asr_nano.py -q --tb=short -> 93 passed, 150 skipped
```


CI note: the current failed check is unrelated to this PR diff.

`pr-ci / tests_processors / tests_processors [shard 3/8]` failed while setting up `LightOnOcrProcessorTest`. The log shows repeated hub-cache write errors under the shared cache:

```text
OSError: [Errno 30] Read-only file system: '/mnt/cache/hub/models--lightonai--LightOnOCR-1B-1025/refs/main.*.tmp'
```

Update: the full PR CI has now finished apart from the aggregate status. Current buckets are `96 pass / 2 fail / 1 skipped`; the second failure is only `pr-ci / PR CI status`, which is failing because this same processors shard failed.

I tried rerunning failed jobs with `gh run rerun 28393059375 --failed`, but GitHub requires repository admin rights. Could a maintainer please rerun the failed job when convenient?


Fresh CI re-check for head `8a744ec`: the only actionable failed job is still `pr-ci / tests_processors / tests_processors [shard 3/8]`; the aggregate `pr-ci / PR CI status` is failing because of that shard.

I re-opened the job log and it is still unrelated to this PR diff: `LightOnOCR-1B-1025` setup repeatedly fails while trying to write temporary refs under the shared hub cache:

```text
OSError: [Errno 30] Read-only file system -> /mnt/cache/hub/models--lightonai--LightOnOCR-1B-1025/refs/main.*.tmp
Number of errors: 67
```

I also tried to rerun the failed jobs from `gh`, but GitHub requires repository admin rights for this run:

```text
run 28393059375 cannot be rerun; Must have admin rights to Repository.
```

Could a maintainer rerun the failed shard when convenient? The remaining failure looks like CI/cache infrastructure rather than a Fun-ASR-Nano regression.

/ci

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

run-slow: auto, fun_asr_nano

Status update on the current head (`8ed336b`):

- The only failing GitHub check I can see is `pr-ci / tests_processors / tests_processors [shard 3/8]`. The check annotations and public Actions page both report a self-hosted runner/container execution failure (`Executing the custom container implementation failed`), not a Python assertion from the Fun-ASR-Nano diff.
- I re-ran the Fun-ASR-Nano processor tests locally in the repo venv:
  - `PYTHONPATH=src .venv/bin/python -m pytest tests/models/fun_asr_nano/test_processing_fun_asr_nano.py -q` -> 2 passed
  - `PYTHONPATH=src .venv/bin/python tests/models/fun_asr_nano/test_processing_fun_asr_nano.py -v` -> 2 passed
- I also re-ran the modular conversion check for the model:
  - `PATH="$PWD/.venv/bin:$PATH" PYTHONPATH=src .venv/bin/python utils/check_modular_conversion.py --files src/transformers/models/fun_asr_nano/modular_fun_asr_nano.py --fix_and_overwrite`
  - Result: no generated-file diff.

Remaining work appears to be human review on the open Fun-ASR-Nano design/comments rather than an actionable processor test failure on the current head.

codex-patrol CI triage only, not a readiness sign-off.

I rechecked the current head `8ed336b610c0c78e433abf965a52250dfdfddb9a` with the GitHub check-runs API:

- Checks summary: 96 success, 1 skipped, 2 failure.
- The failing checks are `pr-ci / tests_processors / tests_processors [shard 3/8]` and the aggregate `pr-ci / PR CI status`.
- The actual failing shard has 67 unique failed/error nodeids, all under `tests/models/lighton_ocr/test_processor_lighton_ocr.py`.
- Failed/error nodeids matching `fun_asr` / `fun-asr` / `funasr`: 0.

So the current CI failure does not look caused by the Fun-ASR-Nano files in this PR. Review is still not cleared: GraphQL currently shows 17 unresolved, non-outdated review threads and `REVIEW_REQUIRED`, so this is only a scoped CI note.


<!-- codex-patrol:transformers-46180-review-status-20260708 -->
Current review-status split for head `8ed336b610c0`:

Already addressed in the current branch:

- `FunAsrNanoProcessor.apply_transcription_request(...)` is present, so users no longer need to hand-write the chat template for transcription calls.
- The model docs now show the convenience API in single inference, batch inference, training, and `torch.compile` examples.
- The conversion script now has an explicit `STATE_DICT_MAPPING` and reproducible download/convert/verify/push commands.
- The feature extractor is gated on the `torch`/`torchaudio` backends and returns the padding mask through the processor as `input_features_mask`.

Still being treated as remaining structural work, not review-complete:

- The open modular/modeling threads about generating more files from `modular_fun_asr_nano.py` and reusing existing Llama/Voxtral-style modules where the SANM/audio-adaptor differences allow it. I am not marking those as done from the FunASR side yet.


Thank you for your contribution 🤗!

## CI Security Gate — automatic approval blocked

This PR was **not** automatically approved for CI because the security gate failed.

**Possible reasons:**
- The PR touches 50 or more files — only PRs with fewer than 50 changed files are automatically approved
- A changed file is outside the allowed directories (`src/`, `tests/`, `docs/`, `utils/`), has a disallowed extension (only `.py`, `.txt`, `.md` permitted outside `tests/` and `docs/`), or is not `.md`/`.yml` inside `docs/`
- A new high-severity security issue was detected in the changed Python files (Bandit check)

See the [workflow run](https://github.com/huggingface/transformers/actions/runs/29079925633) for the exact violations.

A maintainer can review and manually approve CI if a finding is a false positive.

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

run-slow: auto, fun_asr_nano

Pushed the review update in `e44abdc4`.

Key changes:

- configuration, processor, and modeling are generated from the modular source;
- AudioFlamingo3 processor/model wrappers are reused;
- Llama attention, Parakeet feed-forward, Voxtral projector, shared gradient checkpointing, and standard LayerNorm are reused while retaining the SAN-M fused-QKV/FSMN path;
- the converter now has an explicit mapping to the vLLM-compatible split `model.language_model.*` + `lm_head.*` layout;
- processor regressions cover optional-PyTorch import, labels, scalar decoding, masks, and transcription requests.

Local verification:

- `154 passed, 120 skipped, 1925 subtests passed`;
- 3/3 H100 slow integration tests passed with exact Chinese, English, and batch transcriptions;
- all 1,261 checkpoint keys mapped with zero collisions/missing/unexpected keys, and the 829,791,840-parameter bf16 model loaded with `strict=True`;
- Ruff, formatting, modular-conversion, docstring, and diff checks passed.

I replied to and resolved the addressed current review threads. The model-card thread remains open because the published `FunAudioLLM/Fun-ASR-Nano-2512-hf` repo still has the pre-refactor key layout; its verified local split-layout checkpoint must be uploaded before merge.

The newly triggered workflows currently show `action_required` with no jobs, so they need maintainer approval to start.


---

Follow-up for commit 92eb2c3b:

- the security gate flagged the optional-Torch import regression test for a direct subprocess.run call (B603);
- the test now uses Transformers' existing execute_subprocess_async helper while preserving the isolated interpreter and USE_TORCH=0 coverage;
- local validation passed: the Fun-ASR-Nano suite (153 passed, 121 skipped) plus the separately run two-GPU test, Ruff/format checks for all 16 PR Python files, the exact Bandit rule set, and git diff --check;
- the new GitHub security-gate / bandit-check and security-gate / approve-pr-ci jobs are both green. The main PR CI jobs are now queued.

<!-- fun-asr-nano-bandit-followup-20260710 -->
---

Follow-up for commit `617c5142`:

- `Check code quality`, `Check repository consistency`, the security gate, and 94 other checks passed;
- the Fun-ASR-Nano test selected in the processor shard passed, and the complete model suite plus three H100 integration tests also pass locally;
- the remaining red status is the aggregate plus three unrelated shards: two CLI tests fail on an `InputTokensDetails` pydantic validation, a DETR test receives non-image download content, and a Longformer gradient-checkpointing test reports a missing gradient;
- none of those failing files are changed by this PR. The PR author token cannot rerun upstream jobs (`Must have admin rights to Repository`), so a maintainer rerun of the failed jobs is needed.

<!-- fun-asr-nano-ci-followup-617c5142 -->

---

Hub checkpoint follow-up:

- published the verified split-layout checkpoint, processor artifacts, and Transformers quickstart to [`FunAudioLLM/Fun-ASR-Nano-2512-hf` at `4d5668ea`](https://huggingface.co/FunAudioLLM/Fun-ASR-Nano-2512-hf/commit/4d5668eab61eb875bb023f09366c14bdb06d7723);
- the update was one atomic Hub commit: eight validated files were replaced/added, the stale `preprocessor_config.json` was removed, and the legacy tokenizer files were preserved;
- Hub metadata reports the expected 1,659,742,664-byte `model.safetensors` with SHA256 `bc11982f1cb33c77c21208365d3a1a19cf103cf4a0b1cab96684b70728b231ab`;
- from a new cache pinned to that exact revision, `AutoModelForSpeechSeq2Seq` loaded `FunAsrNanoForConditionalGeneration` on an H100 with 0 missing, 0 unexpected, and 0 mismatched keys; tied embeddings were preserved;
- the model-card URL-audio quickstart produced exactly: `The tribal chieftain called for the boy, and presented him with fifty pieces of gold.`

The model-card/checkpoint review request is now addressed and its thread has been resolved.

<!-- fun-asr-nano-hub-checkpoint-4d5668ea -->
---

CI refresh for commit `fb515baa`:

- merged current upstream `main` without conflicts, preserving the PR diff at 18 Fun-ASR-Nano files;
- fixed the new model-date consistency requirement reported by CI;
- final GitHub result: 102 checks completed, 100 successful and 2 skipped, with 0 failures and 0 pending; the aggregate `PR CI status` is green;
- the previously failing `tests_non_model [shard 0/8]`, `tests_processors [shard 1/8]`, and `tests_torch [shard 3/8]` are all green;
- the four exact former failure tests pass locally against `openai==2.45.0` and `pydantic==2.13.4`;
- the refreshed Fun-ASR-Nano suite passes locally: 148 passed, 138 skipped, and 1,927 subtests passed;
- repository consistency, Ruff, formatting, modular conversion, copy, doc TOC, docstring, and diff checks pass;
- the pinned Hub revision `4d5668ea` loads on H100 with zero missing/unexpected/mismatched keys, and exact Chinese, English, and bilingual batch transcription checks pass.

Ready for maintainer review.

<!-- fun-asr-nano-ci-followup-fb515baa -->

---

Final CI and checkpoint refresh for head `de014316`:

- fixed the repository config-attribute check by deriving the encoder input size directly from `num_mel_bins * num_stacked_frames` in the modular source and generated modeling file;
- ran the official model-date generator, which set the Fun-ASR-Nano contribution date to `2026-07-17`;
- the focused Fun-ASR-Nano suite passes locally: `152 passed, 136 skipped`;
- the exact repository entry point passes locally in a clean validation clone: all 18 `make check-repository-consistency` checks passed, including config attributes and model dates;
- Ruff, format, modular conversion, repository, docstring, and diff checks pass;
- immutable Hub revision `c0248ccb63cea44880b2f4ebc0f32b0241b7f8e8` loads on an H100 with 0 missing, 0 unexpected, and 0 mismatched keys, with exact Chinese, English, default-prompt, and bilingual-batch transcriptions;
- GitHub run [`29576950751`](https://github.com/huggingface/transformers/actions/runs/29576950751) is fully green: repository consistency, code quality, aggregate results, Bandit, and `PR CI status` all passed.

All current review threads are resolved. Ready for maintainer review.

<!-- fun-asr-nano-ci-followup-de014316 -->

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

run-slow: auto, fun_asr_nano

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

run-slow: auto, fun_asr_nano

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

run-slow: auto, fun_asr_nano

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

run-slow: auto, fun_asr_nano

Review follow-up pushed in `d58b6371`:

- Kept fbank/LFR feature extraction in Torch through the shared `self.pad` boundary; removed manual NumPy round-trips and added regression coverage for the internal tensor type, padding mask, and batched/individual frame equivalence.
- Switched docs and integration decoding to `processor.decode`; the modular Fun-ASR-Nano processor no longer overrides `batch_decode` and inherits AudioFlamingo3 compatibility behavior.
- Removed the encoder-specific `initializer_range`, regenerated the derived config, and added a config regression test.
- Corrected the docs component count and removed unsupported language/streaming claims.

Fresh verification on this commit:
- Fun-ASR-Nano suite: **152 passed, 138 skipped, 1,927 subtests passed**
- Ruff check/format, modular conversion consistency, and `git diff --check`: passed
- Real H100 checkpoint test: CUDA model load with **0 missing, 0 unexpected, 0 mismatched keys**; exact Chinese and English outputs match between single and batched inference

The new GitHub CI run is now pending. I am also resolving the remaining outdated review threads after verifying each against the current tree.

Final CI result for `d58b6371`: **100 successful, 2 skipped, 0 failed, 0 pending** across 102 checks. All 34 previously unresolved review threads are now resolved.

@ebezzam, when you have a chance, could you please take another look? All prior review threads are resolved and the refreshed CI is fully green.

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

run-slow: auto, fun_asr_nano

CI approval note for current head `d58b6371`:

The four non-green entries shown by GitHub are not test failures:
- `pr-ci / tests_fsdp_ci` and `security-gate / post-failure-comment` are expected skips.
- [Self-hosted runner (benchmark)](https://github.com/huggingface/transformers/actions/runs/29237437827) and [Build PR Documentation](https://github.com/huggingface/transformers/actions/runs/29237438290) are both `action_required` with zero jobs, so they need maintainer approval before GitHub can evaluate them.

I reproduced the documentation workflow locally at this exact head after matching its Node/dependency environment: all **741 MDX pages**, **727 internal-link resolutions**, and the final HTML build passed (`exit 0`), including the generated Fun-ASR-Nano model page. The benchmark job should conditionally skip because this PR does not have the `run-benchmark` label.

@ebezzam, could you please approve those two workflow runs when convenient?

<!-- funasr-ops:transformers-46180-workflow-approval-20260714 -->
@eustlb, could you approve the two pending workflow runs for the current head when convenient?

- [Self-hosted runner (benchmark)](https://github.com/huggingface/transformers/actions/runs/29237437827)
- [Build PR Documentation](https://github.com/huggingface/transformers/actions/runs/29237438290)

Both are action_required with zero jobs, while all code-owned checks have completed successfully (100 success, 2 expected skips). No rerun or code change is needed from the contributor side.


Thank you for your contribution 🤗!

## CI Security Gate — automatic approval blocked

This PR was **not** automatically approved for CI because the security gate failed.

**Possible reasons:**
- The PR touches 50 or more files — only PRs with fewer than 50 changed files are automatically approved
- A changed file is outside the allowed directories (`src/`, `tests/`, `docs/`, `utils/`), has a disallowed extension (only `.py`, `.txt`, `.md` permitted outside `tests/` and `docs/`), or is not `.md`/`.yml` inside `docs/`
- A new high-severity security issue was detected in the changed Python files (Bandit check)

See the [workflow run](https://github.com/huggingface/transformers/actions/runs/29523471083) for the exact violations.

A maintainer can review and manually approve CI if a finding is a false positive.

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

run-slow: auto, fun_asr_nano

Thank you for your contribution 🤗!

## CI Security Gate — automatic approval blocked

This PR was **not** automatically approved for CI because the security gate failed.

**Possible reasons:**
- The PR touches 50 or more files — only PRs with fewer than 50 changed files are automatically approved
- A changed file is outside the allowed directories (`src/`, `tests/`, `docs/`, `utils/`), has a disallowed extension (only `.py`, `.txt`, `.md` permitted outside `tests/` and `docs/`), or is not `.md`/`.yml` inside `docs/`
- A new high-severity security issue was detected in the changed Python files (Bandit check)

See the [workflow run](https://github.com/huggingface/transformers/actions/runs/29523940377) for the exact violations.

A maintainer can review and manually approve CI if a finding is a false positive.

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

run-slow: auto, fun_asr_nano

<!-- funasr-ops:transformers-46180-bandit-checkout-v7-20260717 -->

The current red `security-gate / bandit-check` is an upstream workflow failure, not a Bandit finding in this PR. In [run 29523940377](https://github.com/huggingface/transformers/actions/runs/29523940377), `actions/checkout@v7` stops before checkout and before Bandit executes because a `pull_request_target` workflow is trying to check out a fork ref.

A contributor-side model-code change or rerun cannot make this job pass. I prepared [transformers-ci#27](https://github.com/huggingface/transformers-ci/pull/27), which keeps the trusted job from checking out or executing fork code and instead materializes only the changed Python files from validated immutable Git blob SHAs. Its full repository suite (`306 passed, 1 skipped`), actionlint, Ruff, path-traversal regression, and a live simulation against this exact PR all pass; the live scan materialized 16 Python files and found 0 high-severity or shell findings.

Until that shared workflow fix is reviewed, this row needs maintainer handling; it does not indicate a source regression in the Fun-ASR-Nano integration.

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

run-slow: auto, fun_asr_nano

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

run-slow: auto, fun_asr_nano

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

run-slow: auto, fun_asr_nano

Synced this PR with the latest `upstream/main` and pushed head `f33436e7b1070d5664d4024ff1602c2f851e2161` (`62 ahead / 0 behind`).

I also fixed the local offload regression by adjusting the tiny Fun-ASR-Nano test split from `0.8` to `0.83`. With the current module sizes, `0.8` could place the model on a single device/disk path instead of exercising the intended CPU/disk offload split; `0.83` restores the expected Accelerate offload coverage.

Local validation on the refreshed branch:

- `pytest tests/models/fun_asr_nano/test_feature_extraction_fun_asr_nano.py tests/models/fun_asr_nano/test_processing_fun_asr_nano.py -q`: 17 passed
- `pytest tests/models/fun_asr_nano/test_modeling_fun_asr_nano.py -q -k 'test_cpu_offload or test_disk_offload_bin or test_disk_offload_safetensors'`: 3 passed
- `pytest tests/models/fun_asr_nano/test_modeling_fun_asr_nano.py -q -k 'not flash_attn and not deepspeed'`: 142 passed, 99 skipped, 30 deselected
- `python utils/check_repo.py --check_model_list_copy --check_all_decorator_order --check_full_copies --check_dummies --check_repo_quality`: passed
- `python -m compileall -q src/transformers/models/fun_asr_nano tests/models/fun_asr_nano`: passed
- `git diff --check`: passed

A full local modeling run now has 143 passed / 122 skipped with 6 remaining local-environment failures: 2 `flash_attn` ABI import failures (`undefined symbol` in the local flash-attn CUDA extension) and 4 DeepSpeed resize tests blocked by missing `mpi4py`. The Fun-ASR-Nano offload failures from the previous local run are resolved.


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

run-slow: auto, fun_asr_nano

Follow-up for the GitHub `pr-ci / Check repository consistency` failure on head `f33436e7`: the job failed only at `python utils/add_dates.py --check-only`, which requested regenerating the Fun-ASR-Nano model-card contribution date.

I pushed `ed68b42f9ea747dd7b2269e8b63d576d41beeba6`, generated with:

- `python utils/add_dates.py --models fun_asr_nano`

It changes the model doc contribution date from `2026-07-17` to `2026-07-19`, matching the refreshed PR head. Targeted validation after the change:

- targeted Fun-ASR-Nano date check: `missing=[]`, `incorrect=[]`
- `python utils/update_metadata.py --check-only`: passed
- `python utils/check_repo.py --check_model_list_copy --check_all_decorator_order --check_full_copies --check_dummies --check_repo_quality`: passed
- `python -m compileall -q src/transformers/models/fun_asr_nano tests/models/fun_asr_nano`: passed
- `git diff --check`: passed


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

run-slow: auto, fun_asr_nano

<!-- 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=46180)
**Latest run:** [29666820499:2](https://github.com/huggingface/transformers/actions/runs/29666820499)
**Result:** `success` | **Jobs:** 2 | **Tests:** 24 | **Failures:** 0 | **Duration:** 1m 59s

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

<!-- funasr-ops:transformers-46180-current-review-audit-20260719 -->
Current-head review/CI audit for `ed68b42f`:

- GitHub checks are green for the current head: 12 success / 0 failed / 0 pending in the non-skipped rollup, with the PR CI recap showing 24 tests and 0 failures.
- Thread-level GraphQL audit shows 0 unresolved, non-outdated review threads. The remaining unresolved threads in the UI are all outdated after the latest sync/refactor.
- The July 16 architecture direction has been reflected in the current tree: the audio encoder/adaptor layers now inherit from Whisper components (`WhisperAttention`, `WhisperEncoderLayer`, `WhisperEncoder`), config naming is aligned around `encoder_config` / `audio_token_id`, docs pass audio through `apply_chat_template`, and `torch.compile` uses `compile_config` on `generate`.
- I rechecked the one tempting rename from `multi_modal_projector` to an adaptor-specific attribute, but kept the existing attribute name because the parent audio-LM stack and conversion/checkpoint key mapping use `multi_modal_projector`; renaming it would add compatibility risk without changing behavior.

Could you review the current diff when convenient? From the contributor side I do not see an actionable failing check or current inline thread left on this head.