Views
No views yet
1from mlx_vlm import generate, load
2from mlx_vlm.prompt_utils import apply_chat_template
3from mlx_vlm.utils import load_config
4
5model_name_or_path= "Intel/Qwen3.5-4B-int4-mlx-AutoRound"
6
7model, processor = load(model_name_or_path)
8mlx_cfg = load_config(model_name_or_path)
9prompt_text = "Describe this image in one sentence."
10formatted = apply_chat_template(processor, mlx_cfg, prompt_text, num_images=1)
11# Use a public example image so the test does not need local assets.
12image_url = "https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.5/demo/RealWorld/RealWorld-04.png"
13
14output = generate(model, processor, formatted, image=[image_url], max_tokens=2048).text
15print(output)1"""
2The user wants a one-sentence description of the image.
3
41. **Identify the main subject:** A large, stone statue of a head with a golden headband is in the foreground.
52. **Identify the background:** Behind the statue is a sprawling city built on a hillside, with dense housing and some taller buildings, set against a backdrop of mountains and a blue sky with clouds.
63. **Identify foreground details:** There's a sign that says "Origen" on a railing in the immediate foreground.
74. **Synthesize into a single sentence:**
8 * *Draft 1:* A large stone statue with a gold headband stands in the foreground overlooking a dense city built on a hillside with mountains in the background.
9 * *Draft 2:* A large stone statue of a head wearing a golden headband overlooks a sprawling, densely packed city nestled on a hillside, with mountains visible in the distance.
10 * *Refining for flow and detail:* A large stone statue of a head adorned with a golden headband stands in the foreground overlooking a sprawling, densely packed city built on a hillside, with mountains and a blue sky visible in the background.
11
12Let's try to make it punchier.
13"A large stone statue of a head with a golden headband overlooks a sprawling, densely packed city built on a hillside, with mountains and a blue sky in the background."
14
15This covers the main elements: the statue, the city, the terrain, and the sky.
16
17Let's double check the "Origen" sign. It's a detail, but maybe not essential for a *general* one-sentence description unless I want to be very specific. I'll stick to the main visual components.
18
19Revised sentence: A large stone statue of a head adorned with a golden headband overlooks a sprawling, densely packed city built on a hillside, with mountains and a blue sky visible in the background.
20
21Wait, looking closer at the statue, it looks like a stylized face, maybe indigenous or mythological. "Stone statue of a head" is accurate. The background is definitely a city on a hill.
22
23Final Polish: A large stone statue of a head adorned with a golden headband overlooks a sprawling, densely packed city built on a hillside, with mountains and a blue sky visible in the background.
24</think>
25
26A large stone statue of a head adorned with a golden headband overlooks a sprawling, densely packed city built on a hillside, with mountains and a blue sky visible in the background.
27"""1AR_DISABLE_COPY_MTP_WEIGHTS=1 auto-round \
2 --model Qwen/Qwen3.5-4B \
3 --format mlx \
4 --output_dir "Qwen3.5-4B-int4"