Skip to content

Commit

Permalink
fix pixtral image prompt order for doc VQA (#99)
Browse files Browse the repository at this point in the history
* fix pixtral image prompt order for doc VQA

* fix code style
  • Loading branch information
ndurner authored Oct 22, 2024
1 parent 4da085e commit f0812b5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mlx_vlm/prompt_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ def add_image_tokens(message, token_format):
return message
if role == "user" and not skip_image_token:
if isinstance(message["content"], list):
message["content"].extend([{"type": "image"}] * num_images)
if model_name == "pixtral":
message["content"] = [{"type": "image"}] * num_images + message[
"content"
]
else:
message["content"].extend([{"type": "image"}] * num_images)
else:
if model_name == "phi3_v":
message["content"] = f"{token_format}{message['content']}"
Expand Down

0 comments on commit f0812b5

Please sign in to comment.