Make gradient-checkpoint enabling tolerant of models without get_input_embeddings
Author: molbap
Pull request: yes

# What does this PR do?

Ad title indicates, #42542 and likely a few other models are broken by merged #41993 . This adds an embedding getter and attempts to test the feature with more coverage.

Basically what it does 

 - Stop hard-failing gradient_checkpointing_enable when a model lacks a get_input_embeddings. We now just call enable_input_require_grads, let it attach hooks where it can, and issue a single warning if no embedding module is found.
 - Simplify enable_input_require_grads (and the InternVL/MLCD and a couple more model overrides/adjustments) by making them responsible for the warning.
-  Adds a big test to make sure all of that works (please take a look)

Should help GC for PEFT adapters for many VLMs hopefully (and normal models too)


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

added a test as well - but can't find a clean way around the models for which it is _not_ relevant to have a getter method and _not_ causing as many side-effects. WDYT @zucchini-nlp ? kind of stumped (try/excepting at higher level would always work but hides a lot)

Yes it's a good idea to raise/inform for downstream users. I reverted a couple things and will update the test so it actually checks that enabling GC works (probably add another test)

I reverted a few models to inner positional embeddings calls as mentioned in https://github.com/huggingface/transformers/pull/38913 . 

Modified a few others models as the test I added (`test_enable_input_require_grads_with_gradient_checkpointing` ) was a bit naive and I was just `continue`-ing, now it's a proper skip if the loss is undefined. 

Hopefully that helps VLMs + GC and does not break adapters 

run-slow: align, altclip, chinese_clip, clap, clvp, falcon_mamba, fast_vlm, internvl, layoutlm, layoutlmv3, lilt, mamba, markuplm, mlcd, poolformer, siglip

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

models: ["models/align", "models/altclip", "models/chinese_clip", "models/clap", "models/clvp", "models/falcon_mamba", "models/fast_vlm", "models/internvl", "models/layoutlm", "models/layoutlmv3", "models/lilt", "models/mamba", "models/markuplm", "models/mlcd", "models/poolformer", "models/siglip"]
quantizations: []

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

✅ No failing test specific to this PR 🎉 !


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

run-slow: align, altclip, chinese_clip, clap, clvp, falcon_mamba, fast_vlm, internvl, layoutlm, layoutlmv3, lilt, mamba, markuplm, mlcd, poolformer, siglip

run-slow: align, altclip, chinese_clip, clap, clvp, falcon_mamba, fast_vlm, internvl, layoutlm, layoutlmv3, lilt, mamba, markuplm, mlcd, poolformer, siglip

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

models: ["models/align", "models/altclip", "models/chinese_clip", "models/clap", "models/clvp", "models/falcon_mamba", "models/fast_vlm", "models/internvl", "models/layoutlm", "models/layoutlmv3", "models/lilt", "models/mamba", "models/markuplm", "models/mlcd", "models/poolformer", "models/siglip"]
quantizations: []

Comments addressed. Merging and keeping an eye on this :eyes: let's see if something breaks and how

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

✅ No failing test specific to this PR 🎉 !