Views
No views yet

uv run --with mlx-vlm mlx_vlm.generate --model LiquidAI/LFM2.5-VL-3B-MLX-8bit --max-tokens 100 --temperature 0.2 --image https://placecats.com/neo/300/200 --prompt "how many animals are in the picture?"1from mlx_vlm import apply_chat_template, generate, load
2from mlx_vlm.utils import load_image
3
4model, processor = load("LiquidAI/LFM2.5-VL-3B-MLX-8bit")
5
6image = load_image("https://placecats.com/neo/300/200")
7
8messages = [
9 {
10 "role": "user",
11 "content": [
12 {"type": "image"},
13 {"type": "text", "text": "What do you see in this image?"},
14 ],
15 }
16]
17prompt = apply_chat_template(
18 processor,
19 model.config,
20 messages,
21 add_generation_prompt=True,
22 num_images=1,
23)
24
25result = generate(
26 model,
27 processor,
28 prompt,
29 [image],
30 temp=0.2,
31 top_k=50,
32 repetition_penalty=1.0,
33 verbose=True,
34)
35print(result.text)