fix bugs for clvp model
Author: kaixuanliu
Pull request: yes

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

Two bugs when I run clvp model using latest transformers:

1. Audio attention mask overwrite the text attention mask (processing_clvp.py)

After the processor refactor, ClvpProcessor uses the generic ProcessorMixin.__call__, which merges sub-processor outputs as {**text_inputs, **processed_audio}. Since ClvpFeatureExtractor also returns an attention_mask (for the raw audio, length ~132k), it overwrote the tokenizer's text attention_mask. The model then computed position_ids = attention_mask.cumsum(-1) - 1, producing indices far beyond max_text_tokens (404):


IndexError: index out of range in self  # text_position_embedding
Fix: when both text and audio are provided, pass return_attention_mask=False to the feature extractor so the tokenizer's attention mask (the one the model actually uses) is preserved. Audio-only calls still return the audio attention mask, so existing behavior/tests are unaffected.

2. fix_speech_decoder_output crashed on short sequences (modeling_clvp.py)

The vectorized rewrite hard-coded filler[-3:] = tensor(decoder_fixing_codes[1:]) (3 elements). Generation is stochastic and occasionally yields sequences shorter than 3 tokens, causing:


RuntimeError: The expanded size of the tensor (1) must match the existing size (3) ...
Fix: clamp the number of trailing fixing codes to min(len(decoder_fixing_codes) - 1, seq_len) and only assign when there is room. For normal-length sequences the behavior is identical to before.

Sample code to reproduce the bug:
```
import datasets
from transformers import ClvpProcessor, ClvpModelForConditionalGeneration

# Define the text
text = "This is an example text."

# Load audio (sampled at 22050 Hz as required by CLVP)
ds = datasets.load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
ds = ds.cast_column("audio", datasets.Audio(sampling_rate=22050))
sample = ds[0]["audio"]
audio_sample, sr = sample["array"], sample["sampling_rate"]

# Load processor and model
processor = ClvpProcessor.from_pretrained("susnato/clvp_dev")
model = ClvpModelForConditionalGeneration.from_pretrained("susnato/clvp_dev")

# Generate speech candidates and compute similarity
processor_output = processor(raw_speech=audio_sample, sampling_rate=sr, text=text, return_tensors="pt")
outputs = model.generate(**processor_output)

print("Logits per speech:", outputs.logits_per_speech)
print("Logits per text:", outputs.logits_per_text)
print("Speech IDs shape:", outputs.speech_ids.shape)
```

@vasqu @zucchini-nlp pls help review, thx!

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

run-slow: clvp

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

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