Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pixtral LM only and tokenizer loading #165

Merged
merged 2 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mlx_vlm/models/pixtral/pixtral.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def get_input_embeddings(
pixel_values: Optional[mx.array] = None,
):
if pixel_values is None:
return self.language_model(input_ids)
return self.language_model.model.embed_tokens(input_ids)

# Get the input embeddings from the language model
inputs_embeds = self.language_model.model.embed_tokens(input_ids)
Expand Down
2 changes: 1 addition & 1 deletion mlx_vlm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ def stream_generate(
Yields:
Generator[Tuple[mx.array, mx.array]]: A generator producing text.
"""
tokenizer = processor if hasattr(processor, "encode") else processor.tokenizer
tokenizer = processor.tokenizer if hasattr(processor, "tokenizer") else processor
prompt_tokens = mx.array(tokenizer.encode(prompt))

resize_shape = kwargs.pop("resize_shape", None)
Expand Down