Fix llava model when using text-only prompt (#998)

This commit is contained in:
Cheng 2024-09-25 23:19:41 +09:00 committed by GitHub
parent 9bb2dd62f3
commit e776c970f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -68,11 +68,10 @@ class LlavaModel(nn.Module):
input_ids: Optional[mx.array] = None,
pixel_values: Optional[mx.array] = None,
):
if pixel_values is None:
return self.language_model(input_ids)
# Get the input embeddings from the language model
inputs_embeds = self.language_model.model.embed_tokens(input_ids)
if pixel_values is None:
return inputs_embeds
# Get the ouptut hidden states from the vision model
*_, hidden_states = self.vision_tower(