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.15.tar.gz (58.5 kB view details)

Uploaded Source

Built Distribution

mlx_vlm-0.0.15-py3-none-any.whl (85.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mlx_vlm-0.0.15.tar.gz
Algorithm Hash digest
SHA256 057a1c02e7eed693667ced8760548fa3f194b9e2b0e777aaaac6fa944876117c
MD5 1302eb97748b764c32d080e68f1fcc03
BLAKE2b-256 383a7effd108ed5e56acf4b477ffe2897fdb7dd8526bae46c8f821c093aedd52

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for mlx_vlm-0.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 63cbab23f0d764f536c53bd7aadc5c7ca590c38b6878c331f0fb43a0fce1ab97
MD5 55896a4d2579b5bb27deeb7ea3707d66
BLAKE2b-256 c5c3a7593cfe4aee7120400dca687cfcb7644c4d8eb1befb1775bee4277a8d3e

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