botp
/

File size: 853 Bytes
1d2de8a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""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