This is a randomly initialized tiny model based on microsoft/Phi-3-vision-128k-instruct for testing and debugging.

Feature Source This repo
Checkpoint tensor elements 4.15B BF16 10.04M BF16
Safetensors weight files 8.29 GB (2 files) 20.09 MB (model.safetensors)
Text layers 32 4
Text hidden / MLP width 3,072 / 8,192 128 / 352
Text Q heads / KV heads / head_dim 32 / 32 / 96 4 / 4 / 32
Vision encoder CLIP-ViT-L/14-336: 24 layers, width 1024 4 layers, width 128
Vision input / patch grid 336px / 24x24, 144 HD tokens Same
HD feature width / projector 4,096 / 2-layer MLP 512 / 2-layer MLP
Vocabulary rows / embedding tying 32,064 / untied Same
Stored precision BF16 Same

This Phi-3-Vision revision is not registered in the installed Transformers release, so the pinned upstream remote code is included (load with trust_remote_code=True) with targeted Transformers 5.x Cache API compatibility shims. The 336px/14-patch image contract and the HD 2x2 patch merge are preserved, including the 144 image-token placeholder per global crop; only the CLIP encoder width and depth shrink.

SGLang 0.5.10 registers no native implementation for Phi3VForCausalLM (no EntryClass in sglang/srt/models), so only the generic TransformersForCausalLM fallback exists, which does not shard the model across tensor-parallel ranks. Serving evidence for this repository is the Transformers example.

File path Size
model.safetensors 20.1MB

Example usage

Transformers (βœ… verified)

Load the included pinned Phi-3-Vision implementation with trust_remote_code=True.

def run_transformers(model_id: str):
    import torch
    from PIL import Image
    from transformers import AutoModelForCausalLM, AutoProcessor

    model_id = str(model_id)
    processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
    model = (
        AutoModelForCausalLM.from_pretrained(
            model_id, trust_remote_code=True, dtype=torch.bfloat16, attn_implementation="eager"
        )
        .eval()
        .cuda()
    )

    image = Image.new("RGB", (336, 336), color=(200, 60, 60))
    messages = [{"role": "user", "content": "<|image_1|>\nWhat is shown in this image?"}]
    prompt = processor.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
    inputs = processor(prompt, images=[image], return_tensors="pt").to("cuda")

    with torch.no_grad():
        assert torch.isfinite(model(**inputs).logits).all()
        output = model.generate(
            **inputs, do_sample=False, max_new_tokens=8, eos_token_id=processor.tokenizer.eos_token_id
        )
    print(processor.batch_decode(output[:, inputs["input_ids"].shape[1] :], skip_special_tokens=True)[0])


if __name__ == "__main__":
    run_transformers(model_id="tiny-random/phi-3-vision")

Creating this repo

Change log

  • 2026-11-07: Initial version rebuilt from the official microsoft/Phi-3-vision-128k-instruct source, shipping its pinned remote code with a four-layer text tower and a four-layer 128-wide CLIP vision encoder.

This repo is generated by GPT-6.1-Sol.

Downloads last month
29
Safetensors
Model size
10M params
Tensor type
BF16
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for tiny-random/phi-3-vision

Finetuned
(6)
this model

Collection including tiny-random/phi-3-vision