Instructions to use tiny-random/minicpm-ocr-jev with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tiny-random/minicpm-ocr-jev with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="tiny-random/minicpm-ocr-jev") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForSequenceClassification processor = AutoProcessor.from_pretrained("tiny-random/minicpm-ocr-jev") model = AutoModelForSequenceClassification.from_pretrained("tiny-random/minicpm-ocr-jev", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tiny-random/minicpm-ocr-jev with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tiny-random/minicpm-ocr-jev" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tiny-random/minicpm-ocr-jev", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/tiny-random/minicpm-ocr-jev
- SGLang
How to use tiny-random/minicpm-ocr-jev with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "tiny-random/minicpm-ocr-jev" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tiny-random/minicpm-ocr-jev", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "tiny-random/minicpm-ocr-jev" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tiny-random/minicpm-ocr-jev", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use tiny-random/minicpm-ocr-jev with Docker Model Runner:
docker model run hf.co/tiny-random/minicpm-ocr-jev
This is a randomly initialized tiny model based on openbmb/MiniCPM-OCR-Jev for testing and debugging.
| Feature | Source | This repo |
|---|---|---|
| Checkpoint tensor elements | 2.21B BF16 | 6.64M BF16 |
| Safetensors weight files | 4.43 GB (model.safetensors) | 13.31 MB (model.safetensors) |
| Architecture / input | Qwen3.5 vision-language correctness scorer | Same |
| Vocabulary rows / tied embeddings | 248,320 / false | Same |
| Backbone layers / layer cadence | 24 / six 3-linear + 1-full cycles | 8 / two complete cycles |
| Hidden width / MLP width | 2,048 / 6,144 | 16 / 32 |
| Q heads / KV heads / head dimension | 8 / 2 / 256 | Same |
| Linear-attention key/value heads and dimensions | 16/16, 128/128 | Same |
| Vision depth / width / output width | 24 / 1,024 / 2,048 | 4 / 128 / 16 |
| Vision patch / temporal patch / spatial merge | 16 / 2 / 2 | Same |
| Task head | binary score [2, 2,048]; no lm_head |
binary score [2, 16]; no lm_head |
| MTP | config declares one layer; no MTP tensors | Same |
| Checkpoint precision | BF16 | Same |
Load this checkpoint with AutoModelForSequenceClassification; it keeps the source binary score head and does not contain lm_head. Two complete linear/linear/linear/full cycles are retained. The Qwen3.5 linear-attention path requires CUDA and Triton. The exact public snippet was verified on an NVIDIA A800-SXM4-80GB.
| File path | Size |
|---|---|
| model.safetensors | 13.3MB |
Example usage
Transformers (โ verified)
The example sends two images: the original block and a rendered image of the candidate text. Load with AutoModelForSequenceClassification; the checkpoint has a binary score head instead of lm_head. Install transformers>=5.10.4 and Pillow; the Qwen3.5 linear-attention path requires CUDA and Triton.
def run_transformers(model_id: str):
import torch
from PIL import Image, ImageDraw
from transformers import AutoModelForSequenceClassification, AutoProcessor
model_id = str(model_id)
processor = AutoProcessor.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(
model_id,
dtype=torch.bfloat16,
device_map="cuda",
attn_implementation="sdpa",
)
candidate = "Hello"
original = Image.new("RGB", (448, 448), "white")
ImageDraw.Draw(original).text((20, 20), candidate, fill="black")
rendered = Image.new("RGB", (448, 448), "white")
ImageDraw.Draw(rendered).text((20, 20), candidate, fill="black")
instruction = (
"็ฌฌไธๅผ ๅพๆฏๅๅพ๏ผ็ฌฌไบๅผ ๅพๆฏไธ่ฟฐ OCR ๆๆฌๆธฒๆๅพๅฐ็ๅพ็ใ\n"
"่ฏทๅคๆญ่ฏฅ OCR ๆๆฌๅๅ
ถๅฏนๅบๆธฒๆๅพๆฏๅฆไธๅๅพๅ
ๅฎนไธ่ดใ\n"
"่ฟๆฏไธไธชไบๅ็ฑปไปปๅก๏ผไธ่ดๆ ไธบ 1๏ผไธไธ่ดๆ ไธบ 0ใ"
)
messages = [
{
"role": "user",
"content": [
{"type": "image", "image": original},
{"type": "text", "text": f"\nOCRๆๆฌ๏ผ\n{candidate}\n"},
{"type": "image", "image": rendered},
{"type": "text", "text": "\n" + instruction},
],
}
]
inputs = processor.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
with torch.no_grad():
logits = model(**inputs).logits
assert torch.isfinite(logits).all()
score = torch.softmax(logits.float(), dim=-1)[:, 1]
print(float(score[0]))
if __name__ == "__main__":
run_transformers(model_id="tiny-random/minicpm-ocr-jev")
Creating this repo
- Code: .meta/create_model.py
- Model structure: .meta/model.log
- Environment: .meta/env.json
Change log
- 2026-11-01: Initial tiny MiniCPM-OCR Jev checkpoint.
This repo is generated by DeepSeek-V4.1-Flash.
- Downloads last month
- -