Image-Text-to-Text
Transformers
Joblib
Safetensors
English
qwen3_5
ocr
pdf
markdown
document-parsing
tables
charts
parsebench
autoround
w4a16
gptq
llm-compressor
compressed-tensors
quantized
vllm
conversational
Run this model with HF Jobs
Run OpenTensorLab/OCRia-1-W4A16-LLM-Compressor on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/OpenTensorLab/OCRia-1-W4A16-LLM-Compressor. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/OpenTensorLab/OCRia-1-W4A16-LLM-Compressor on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/OpenTensorLab/OCRia-1-W4A16-LLM-Compressor. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Instructions to use OpenTensorLab/OCRia-1-W4A16-LLM-Compressor with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenTensorLab/OCRia-1-W4A16-LLM-Compressor with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="OpenTensorLab/OCRia-1-W4A16-LLM-Compressor") 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, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("OpenTensorLab/OCRia-1-W4A16-LLM-Compressor") model = AutoModelForMultimodalLM.from_pretrained("OpenTensorLab/OCRia-1-W4A16-LLM-Compressor", 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 OpenTensorLab/OCRia-1-W4A16-LLM-Compressor with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenTensorLab/OCRia-1-W4A16-LLM-Compressor" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenTensorLab/OCRia-1-W4A16-LLM-Compressor", "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/OpenTensorLab/OCRia-1-W4A16-LLM-Compressor
- SGLang
How to use OpenTensorLab/OCRia-1-W4A16-LLM-Compressor 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 "OpenTensorLab/OCRia-1-W4A16-LLM-Compressor" \ --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": "OpenTensorLab/OCRia-1-W4A16-LLM-Compressor", "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 "OpenTensorLab/OCRia-1-W4A16-LLM-Compressor" \ --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": "OpenTensorLab/OCRia-1-W4A16-LLM-Compressor", "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 OpenTensorLab/OCRia-1-W4A16-LLM-Compressor with Docker Model Runner:
docker model run hf.co/OpenTensorLab/OCRia-1-W4A16-LLM-Compressor
File size: 3,568 Bytes
d8db4d8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | // Copyright (c) 2026 LlamaIndex, Inc. All rights reserved.
// Licensed under the OCRia-1 Model and Code License (LICENSE at the root of this repository).
// This is not open-source software: see the license for permitted uses.
use std::slice;
// Caller supplies contiguous float32 attention and same-shape float64 density.
// Seed is a positive maximum; bounds are exclusive cell edges in x/y order.
#[no_mangle]
pub unsafe extern "C" fn add_component_centroid(
h: usize,
w: usize,
map: *const f32,
seed: usize,
density: *mut f64,
bounds: *mut i64,
center: *mut f64,
) -> usize {
let m = slice::from_raw_parts(map, h * w);
let d = slice::from_raw_parts_mut(density, h * w);
let threshold = 0.3f32 * m[seed];
let mut total = 0.0f64;
let mut visited = vec![false; m.len()];
let mut queue = vec![seed];
visited[seed] = true;
let mut k = 0;
let mut x0 = seed % w;
let mut y0 = seed / w;
let mut x1 = x0 + 1;
let mut y1 = y0 + 1;
while k < queue.len() {
let j = queue[k];
k += 1;
total += m[j] as f64;
let x = j % w;
let y = j / w;
x0 = x0.min(x);
y0 = y0.min(y);
x1 = x1.max(x + 1);
y1 = y1.max(y + 1);
for yy in y.saturating_sub(1)..(y + 2).min(h) {
for xx in x.saturating_sub(1)..(x + 2).min(w) {
let p = yy * w + xx;
if !visited[p] && m[p] >= threshold {
visited[p] = true;
queue.push(p);
}
}
}
}
for j in queue {
d[j] += m[j] as f64 / total;
}
for (k, v) in [x0, y0, x1, y1].iter().enumerate() {
*bounds.add(k) = *v as i64;
}
let y = seed / w;
let x = seed % w;
let mut mass = 0.0;
let mut weighted_x = 0.0;
let mut weighted_y = 0.0;
for yy in y.saturating_sub(1)..(y + 2).min(h) {
for xx in x.saturating_sub(1)..(x + 2).min(w) {
let value = m[yy * w + xx] as f64;
mass += value;
weighted_x += value * (xx as f64 + 0.5);
weighted_y += value * (yy as f64 + 0.5);
}
}
*center = weighted_x / mass;
*center.add(1) = weighted_y / mass;
seed
}
// Sparse rows share one scratch grid; accumulation follows transcript order.
// Python validates offsets, cell indices, seeds, and output capacities.
#[no_mangle]
pub unsafe extern "C" fn add_components(
h: usize,
w: usize,
words: usize,
offsets: *const i64,
indices: *const i64,
values: *const f32,
seeds: *const i64,
density: *mut f64,
bounds: *mut i64,
centers: *mut f64,
) -> bool {
let offsets = slice::from_raw_parts(offsets, words + 1);
let indices = slice::from_raw_parts(indices, offsets[words] as usize);
let values = slice::from_raw_parts(values, indices.len());
let mut grid = vec![0.0f32; h * w];
for u in 0..words {
let start = offsets[u] as usize;
let end = offsets[u + 1] as usize;
for j in start..end {
grid[indices[j] as usize] = values[j];
}
let seed = *seeds.add(u) as usize;
if !grid[seed].is_finite() || grid[seed] <= 0.0 {
return false;
}
add_component_centroid(
h,
w,
grid.as_ptr(),
seed,
density,
bounds.add(u * 4),
centers.add(u * 2),
);
for j in start..end {
grid[indices[j] as usize] = 0.0;
}
}
true
}
|