Support Granite Speech NAR (NLE)
Author: avihu111
Pull request: yes
Labels: name: New model

name: Audio

# What does this PR do?

Adds **GraniteSpeechNar** — a non-autoregressive LLM-based ASR model. 
Unlike the autoregressive `GraniteSpeech` model (which uses `GenerationMixin`), this model performs non-autoregressive transcript editing, and refines the speech encoder transcript using a bidirectionally-augmented LLM. 
GraniteSpeechNar consists of an encoder (conformer), a q-former projector, and a bidirectional LLM (non-causal mask).
The paper is based on the following paper: [NLE: Non-autoregressive LLM-based ASR by Transcript Editing](https://arxiv.org/abs/2603.08397)

It's a bit different than most of the models in the hub (due to its non-autoregressive nature), but achieves high transcription throughput and competative accuracy. 
It is ranked 3rd on the [Open ASR Leaderboard](https://huggingface.co/spaces/hf-audio/open_asr_leaderboard) with faster inference speeds. The speedups are even more significant with a batch size of 1 (e.g. in latency critical real-time settings).

The model is available with bundled code here:
https://huggingface.co/ibm-granite/granite-speech-4.1-2b-nar

## Key design decisions
- Inherit Granite classes, changing the attention pattern to bidirectional.
- Inherit the base conformer encoder from GraniteSpeech, which is shared.
- `output_encoder_logits=False` (default): Free the encoder BPE logits tensor (~T/4 × 100K) to reduce peak memory. Pass `True` to retain it.
- Flat sequence batching: All batch items are concatenated into `[1, N_total, D]` with per-sample position resets, avoiding padding waste on variable-length audio.
- CTC collapse (deduplication and blank removal) is done in the model, decoding is done in the processor.
- Supports finetuning the model - exposes the editing loss, encoder loss and the copying-regularization loss described in the paper above.

## Code Agent Policy
- [x] I confirm that this is not a pure code agent PR.

## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#create-a-pull-request),
      Pull Request section?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [x] Did you write any new necessary tests?


## Who can review?
- audio models: @eustlb @ebezzam @vasqu
Thanks!
CC: @gsaon


Comments:
@eustlb I finished another pass of updates:
- renamed transcribe to generate
- renamed ForASR to ForCTC
- refactored to use base_model with the lm_head separated
- shared ctc_loss/collapse helper functions for the encoder/editor
- multi-editing inference support (exposed via `num_editing_steps=1` in generate)

Ready for the next iteration 🤗 

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

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

run-slow: auto, granite_speech_nar

Hi @eustlb!
Can you give this PR a look? 🙏 
Thanks!