More export friendly rewrites and skipping the failing ones
Author: IlyasMoutawwakil
Pull request: yes

# What does this PR do?

We can see all the failing tests by removing `test_torch_exportable = False` from the code base.
There are different reasons for the failures, mostly related to very dynamic processing (looping over the batch dimension and processing each sample differently). There are also some cuda kernels (ssm) that can't be disabled (bamba, granitemoehybrid, mamba2). Overall we have around +90% coverage.

```
=========================== short test summary info ============================
FAILED tests/models/clvp/test_modeling_clvp.py::ClvpModelForConditionalGenerationTest::test_torch_export
FAILED tests/models/fastspeech2_conformer/test_modeling_fastspeech2_conformer.py::FastSpeech2ConformerModelTest::test_torch_export
FAILED tests/models/fastspeech2_conformer/test_modeling_fastspeech2_conformer.py::FastSpeech2ConformerWithHifiGanTest::test_torch_export
FAILED tests/models/lfm2_vl/test_modeling_lfm2_vl.py::Lfm2VlModelTest::test_torch_export
FAILED tests/models/funnel/test_modeling_funnel.py::FunnelModelTest::test_torch_export
FAILED tests/models/lightglue/test_modeling_lightglue.py::LightGlueModelTest::test_torch_export
FAILED tests/models/llava_next_video/test_modeling_llava_next_video.py::LlavaNextVideoForConditionalGenerationModelTest::test_torch_export
FAILED tests/models/lighton_ocr/test_modeling_lighton_ocr.py::LightOnOcrForConditionalGenerationModelTest::test_torch_export
FAILED tests/models/llava_onevision/test_modeling_llava_onevision.py::LlavaOnevisionForConditionalGenerationModelTest::test_torch_export
FAILED tests/models/funnel/test_modeling_funnel.py::FunnelBaseModelTest::test_torch_export
FAILED tests/models/led/test_modeling_led.py::LEDModelTest::test_torch_export
FAILED tests/models/hiera/test_modeling_hiera.py::HieraModelTest::test_torch_export
FAILED tests/models/longformer/test_modeling_longformer.py::LongformerModelTest::test_torch_export
FAILED tests/models/emu3/test_modeling_emu3.py::Emu3Vision2TextModelTest::test_torch_export
FAILED tests/models/mistral3/test_modeling_mistral3.py::Mistral3ModelTest::test_torch_export
FAILED tests/models/mimi/test_modeling_mimi.py::MimiModelTest::test_torch_export
FAILED tests/models/encodec/test_modeling_encodec.py::EncodecModelTest::test_torch_export
FAILED tests/models/esm/test_modeling_esmfold.py::EsmFoldModelTest::test_torch_export
FAILED tests/models/llava_next/test_modeling_llava_next.py::LlavaNextForConditionalGenerationModelTest::test_torch_export
FAILED tests/models/ibert/test_modeling_ibert.py::IBertModelTest::test_torch_export
FAILED tests/models/eomt/test_modeling_eomt.py::EomtForUniversalSegmentationTest::test_torch_export
FAILED tests/models/mra/test_modeling_mra.py::MraModelTest::test_torch_export
FAILED tests/models/evolla/test_modeling_evolla.py::EvollaModelTest::test_torch_export
FAILED tests/models/oneformer/test_modeling_oneformer.py::OneFormerModelTest::test_torch_export
FAILED tests/models/pe_audio_video/test_modeling_pe_audio_video.py::PeAudioVideoEncoderTest::test_torch_export
FAILED tests/models/phi4_multimodal/test_modeling_phi4_multimodal.py::Phi4MultimodalModelTest::test_torch_export
FAILED tests/models/omdet_turbo/test_modeling_omdet_turbo.py::OmDetTurboModelTest::test_torch_export
FAILED tests/models/pixtral/test_modeling_pixtral.py::PixtralVisionModelModelTest::test_torch_export
FAILED tests/models/reformer/test_modeling_reformer.py::ReformerLocalAttnModelTest::test_torch_export
FAILED tests/models/reformer/test_modeling_reformer.py::ReformerLSHAttnModelTest::test_torch_export
FAILED tests/models/rwkv/test_modeling_rwkv.py::RwkvModelTest::test_torch_export
FAILED tests/models/superglue/test_modeling_superglue.py::SuperGlueModelTest::test_torch_export
FAILED tests/models/superpoint/test_modeling_superpoint.py::SuperPointModelTest::test_torch_export
FAILED tests/models/tapas/test_modeling_tapas.py::TapasModelTest::test_torch_export
FAILED tests/models/vilt/test_modeling_vilt.py::ViltModelTest::test_torch_export
FAILED tests/models/timesfm/test_modeling_timesfm.py::TimesFmModelTest::test_torch_export
FAILED tests/models/vilt/test_modeling_vilt.py::ViltForImagesAndTextClassificationModelTest::test_torch_export
===== 37 failed, 442 passed, 27 skipped, 26 warnings in 205.46s (0:03:25) ======
```



## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [ ] 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).
- [ ] Did you write any new necessary tests?


## Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

<!-- Your PR will be replied to more quickly if you can figure out the right person to tag with @

 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.

Models:

- text models: @ArthurZucker @Cyrilvallez
- vision models: @yonigozlan @molbap
- audio models: @eustlb @ebezzam @vasqu
- multimodal models: @zucchini-nlp
- graph models: @clefourrier

Library:

- generate: @zucchini-nlp (visual-language models) or @gante (all others)
- continuous batching: @remi-or @ArthurZucker @McPatate
- pipelines: @Rocketknight1
- tokenizers: @ArthurZucker and @itazap
- trainer: @SunMarc
- attention: @vasqu @ArthurZucker @CyrilVallez
- model loading (from pretrained, etc): @CyrilVallez
- distributed: @3outeille @ArthurZucker
- CIs: @ydshieh

Integrations:

- ray/raytune: @richardliaw, @amogkam
- Big Model Inference: @SunMarc
- quantization: @SunMarc @MekkCyber
- kernels: @MekkCyber @drbh
- peft: @BenjaminBossan @githubnemo

Devices/Backends:

- AMD ROCm: @ivarflakstad
- Intel XPU: @IlyasMoutawwakil
- Ascend NPU: @ivarflakstad 

Documentation: @stevhliu

Research projects are not maintained and should be taken as is.

 -->


Comments:
View the CircleCI Test Summary for this PR:

https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=43436&sha=3c2a75

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

Ah yea, let's also do https://github.com/huggingface/transformers/pull/43631#discussion_r2746663227 - modernbert has been refactored

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

run-slow: bamba, bark, clvp, emu3, encodec, eomt, esm, evolla, falcon_h1, fastspeech2_conformer, flaubert, funnel, granite_speech, granitemoehybrid, mamba2, paddleocr_vl