Fix: AttributeError when `input_ids` is None during multimodal LLM training

#77
by lyulumos - opened

When training a multimodal language model, such as MiniGPT-4, the model utilizes inputs_embeds instead of input_ids. This is because the multimodal embeddings are aligned with the LLM's text space and are concatenated with the text embeddings, rendering input_ids unnecessary and thus None.

This leads to the following error:

AttributeError: 'NoneType' object has no attribute 'shape'

This commit addresses the issue by modifying the code to handle cases where input_ids is None, ensuring that the model can properly process the provided inputs_embeds without relying on input_ids.

For those asking about API access — I've been using Crazyrouter as a unified gateway. One API key, OpenAI SDK compatible. Works well for testing different models without managing multiple accounts.

Ready to merge
This branch is ready to get merged automatically.

Sign up or log in to comment