botp
/

Solomon / mlx /tests /test_processor.py
orz99's picture ArcherHume's picture
Duplicate from DoccyHealth/Solomon
1d2de8a
Raw
History Blame Contribute Delete
853 Bytes
"""Pinned tokenizer/image sidecars can be tested before large weights arrive."""
from pathlib import Path
import numpy as np
import pytest
from mlx_vlm.models.qwen3_vl.processing_qwen3_vl import Qwen3VLProcessor
from PIL import Image
@pytest.mark.skipif(
not Path("snapshots/base/tokenizer.json").exists(), reason="Pinned tokenizer not downloaded"
)
def test_torch_free_processor_and_image_token_count():
processor = Qwen3VLProcessor.from_pretrained("snapshots/base", trust_remote_code=False)
image = Image.new("RGB", (512, 512), "white")
out = processor.image_processor(images=[image])
assert out["image_grid_thw"].tolist() == [[1, 32, 32]]
assert np.asarray(out["pixel_values"]).shape == (1024, 1536)
assert np.isfinite(np.asarray(out["pixel_values"])).all()
assert processor.image_processor.max_pixels == 16777216