IdeficsProcessor has wrong __call__ args and the docstring is not updated
Author: Kamichanw
Pull request: no
Labels: name: Documentation

name: bug

name: Vision

### System Info

- `transformers` version: 4.46.0
- Platform: Linux-4.15.0-76-generic-x86_64-with-glibc2.27
- Python version: 3.12.5
- Huggingface_hub version: 0.24.7
- Safetensors version: 0.4.5
- Accelerate version: 0.34.2
- Accelerate config:    not found
- PyTorch version (GPU?): 2.4.1+cu121 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using distributed or parallel set-up in script?: <fill in>
- Using GPU in script?: <fill in>
- GPU type: NVIDIA GeForce RTX 3090

### Who can help?

@zucchini-nlp 


### Information

- [X] The official example scripts
- [ ] My own modified scripts

### Tasks

- [X] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

As shown below, the `images` can only be `List[Image]` instead of `List[List[Image]]`, which will result in unexpected exception when passing batch texts.

https://github.com/huggingface/transformers/blob/7bbc62474391aff64f63fcc064c975752d1fa4de/src/transformers/models/idefics/processing_idefics.py#L260-L262

### Expected behavior

just fix it, zucchini

Comments:
Hey @Kami-chanw, would you like to open a PR to fix the docstring?

It seems that someone will update the entire docstring later:
https://github.com/huggingface/transformers/blob/7bbc62474391aff64f63fcc064c975752d1fa4de/src/transformers/models/idefics/processing_idefics.py#L263-L265
I just want to notice the maintainer not to forget fix it as well. Besides, this line for got to add `layer_idx` to `IdeficsGatedCrossAttentionLayer`, which will lead an unexpected warning at [here](https://github.com/huggingface/transformers/blob/7bbc62474391aff64f63fcc064c975752d1fa4de/src/transformers/models/idefics/modeling_idefics.py#L516-L521)
https://github.com/huggingface/transformers/blob/7bbc62474391aff64f63fcc064c975752d1fa4de/src/transformers/models/idefics/modeling_idefics.py#L1052
I have found this bug for a long time, hopefully @zucchini-nlp can fix it by the way.

Hey @Kami-chanw ,

thanks for the issue. Yes, we might fix it later as part of a bigger standardization process but feel free to open a PR as the workflow we have in mind needs more time. 

And for the `layer_idx`, the gated cross attn module has no dependency on cache and thus should not be raising a warning. The link you provided is for the `Attention` module which has the `layer_idx` kwarg at init time :)

However, the gated cross attn is implemented with `IdeficsAttention` which will raise a warning if `layer_idx` is `None`. Perhaps you should consider assigning a default value or something else to suppress this warning.
https://github.com/huggingface/transformers/blob/7bbc62474391aff64f63fcc064c975752d1fa4de/src/transformers/models/idefics/modeling_idefics.py#L754

@Kami-chanw oh, i see, that makes sense. In that case we can pass the layer idx to gates cross attn to suppress warning, but the value will not be used anyway. 

Feel free to open a PR to fix these two issues if you want to, or I can fix them later this week :)


@Kamichanw hey, you are closing as completed because there was a PR merged?

Oh, You said you would fix them that week. I thought you had solved that.

Nah, I didn't have time, I will close it when fixed :)

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.