DPOTrainer does not work for multimodal Gemma 4
### Reproduction
[This notebook](https://colab.research.google.com/drive/19LT3CkbWs87VLwV1keM6lBMZXYo_UHD3?usp=sharing)
outputs:
```
[/usr/local/lib/python3.12/dist-packages/transformers/tokenization_utils_base.py](https://localhost:8080/#) in pad(self, encoded_inputs, padding, max_length, pad_to_multiple_of, padding_side, return_attention_mask, return_tensors, verbose)
2632 # The model's main input name, usually `input_ids`, has been passed for padding
2633 if self.model_input_names[0] not in encoded_inputs:
-> 2634 raise ValueError(
2635 "You should supply an encoding or a list of encodings to this method "
2636 f"that includes {self.model_input_names[0]}, but you provided {list(encoded_inputs.keys())}"
ValueError: You should supply an encoding or a list of encodings to this method that includes input_ids, but you provided ['prompt', 'chosen', 'rejected', 'mm_token_type_ids', 'prompt_ids', 'chosen_ids', 'rejected_ids']
```
### System Info
- Platform: Linux-6.6.113+-x86_64-with-glibc2.35
- Python version: 3.12.13
- TRL version: 1.2.0
- PyTorch version: 2.10.0+cu128
- accelerator(s): NVIDIA RTX PRO 6000 Blackwell Server Edition
- Transformers version: 5.5.0
- Accelerate version: 1.13.0
- Accelerate config: not found
- Datasets version: 4.8.4
- HF Hub version: 1.10.1
- bitsandbytes version: not installed
- DeepSpeed version: not installed
- Liger-Kernel version: not installed
- PEFT version: 0.18.1
- vLLM version: not installed
### Checklist
- [x] I have checked that my issue isn't already filed (see [open issues](https://github.com/huggingface/trl/issues?q=is%3Aissue))
- [x] I have included my system information
- [x] Any code provided is minimal, complete, and reproducible ([more on MREs](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks))
- [x] Any code provided is properly formatted in code blocks, (no screenshot, [more on code blocks](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks))
- [x] Any traceback provided is complete
关闭于 2026-07-18 2 条评论