Skip to main content

Vision LLMs on Apple silicon with MLX and the Hugging Face Hub

Project description

MLX-VLM

MLX-VLM a package for running Vision LLMs on your Mac using MLX.

Get started

The easiest way to get started is to install the mlx-vlm package:

With pip:

pip install mlx-vlm

Inference

CLI

python -m mlx_vlm.generate --model qnguyen3/nanoLLaVA --max-tokens 100 --temp 0.0

Chat UI with Gradio

python -m mlx_vlm.chat_ui --model qnguyen3/nanoLLaVA

Script

import mlx.core as mx
from mlx_vlm import load, generate

model_path = "mlx-community/llava-1.5-7b-4bit"
model, processor = load(model_path)

prompt = processor.tokenizer.apply_chat_template(
    [{"role": "user", "content": f"<image>\nWhat are these?"}],
    tokenize=False,
    add_generation_prompt=True,
)

output = generate(model, processor, "http://images.cocodataset.org/val2017/000000039769.jpg", prompt, verbose=False)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mlx_vlm-0.0.11.tar.gz (52.0 kB view details)

Uploaded Source

Built Distribution

mlx_vlm-0.0.11-py3-none-any.whl (75.9 kB view details)

Uploaded Python 3

File details

Details for the file mlx_vlm-0.0.11.tar.gz.

File metadata

  • Download URL: mlx_vlm-0.0.11.tar.gz
  • Upload date:
  • Size: 52.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for mlx_vlm-0.0.11.tar.gz
Algorithm Hash digest
SHA256 677f476d58cc6bc4fcf3aac7c78633d59dbd3e207a70fabe0b7f51c9ffcd06c1
MD5 74b0576d31d1e2058c375c4b18dad8fd
BLAKE2b-256 7f61b332428878317c115e1ed2bedcd4af661f0389dfe413a67786953e3eb8cc

See more details on using hashes here.

File details

Details for the file mlx_vlm-0.0.11-py3-none-any.whl.

File metadata

  • Download URL: mlx_vlm-0.0.11-py3-none-any.whl
  • Upload date:
  • Size: 75.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for mlx_vlm-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 ab2d2272dfdaeb1cf05689f7e2de7f0884b884a98ebbb8505c7c4f394bb1abc8
MD5 aaccbe59a2bb1b951a04faae6b896b38
BLAKE2b-256 393cf2865c61d036cd214b3e3a32b661dd6ad9501bd4e6ce326d2f80b834608d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page