Instructions to use Sawfwair/Infinity-Parser2-Pro-Int8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Sawfwair/Infinity-Parser2-Pro-Int8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Sawfwair/Infinity-Parser2-Pro-Int8") 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)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("Sawfwair/Infinity-Parser2-Pro-Int8") model = AutoModelForMultimodalLM.from_pretrained("Sawfwair/Infinity-Parser2-Pro-Int8") 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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - MLX
How to use Sawfwair/Infinity-Parser2-Pro-Int8 with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("Sawfwair/Infinity-Parser2-Pro-Int8") config = load_config("Sawfwair/Infinity-Parser2-Pro-Int8") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- vLLM
How to use Sawfwair/Infinity-Parser2-Pro-Int8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Sawfwair/Infinity-Parser2-Pro-Int8" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Sawfwair/Infinity-Parser2-Pro-Int8", "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/Sawfwair/Infinity-Parser2-Pro-Int8
- SGLang
How to use Sawfwair/Infinity-Parser2-Pro-Int8 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 "Sawfwair/Infinity-Parser2-Pro-Int8" \ --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": "Sawfwair/Infinity-Parser2-Pro-Int8", "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 "Sawfwair/Infinity-Parser2-Pro-Int8" \ --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": "Sawfwair/Infinity-Parser2-Pro-Int8", "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" } } ] } ] }' - Pi
How to use Sawfwair/Infinity-Parser2-Pro-Int8 with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "Sawfwair/Infinity-Parser2-Pro-Int8"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "Sawfwair/Infinity-Parser2-Pro-Int8" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use Sawfwair/Infinity-Parser2-Pro-Int8 with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "Sawfwair/Infinity-Parser2-Pro-Int8"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default Sawfwair/Infinity-Parser2-Pro-Int8
Run Hermes
hermes
- Docker Model Runner
How to use Sawfwair/Infinity-Parser2-Pro-Int8 with Docker Model Runner:
docker model run hf.co/Sawfwair/Infinity-Parser2-Pro-Int8
Infinity-Parser2-Pro Int8
This repository contains a MLX affine int8 quantization of
infly/Infinity-Parser2-Pro
prepared for native mere.run Q35 OCR evaluation.
Changes From The Base Model
- Quantized eligible language-model linear weights to int8.
- Used group size 64 with MLX affine quantization metadata.
- Split Infinity-Parser2-Pro fused expert tensors into the native
switch_mlplayout expected bymere.run. - Preserved vision tower and tokenizer sidecar files required by the native Qwen-family OCR runtime.
- Added
mererun_model.jsonmetadata for managed local installation.
Intended Use
Use this model as the quality-focused native Infinity-Parser2 Pro OCR option in
mere.run:
mere.run model pull vision-ocr-infinity-pro-int8
mere.run vision ocr ./page.png \
--backend infinity \
--infinity-model vision-ocr-infinity-pro-int8 \
--infinity-task doc2md \
--temperature 0
mere.run keeps LightOnOCR as the default OCR backend because it is smaller and
more predictable across the local smoke set. This quantized Pro model is for
document types where Pro's layout and parsing quality justify higher latency and
memory use.
Local Evaluation Notes
On local samples, this int8 model improved over Infinity-Parser2-Flash on some metadata-heavy article layouts, while LightOnOCR remained stronger on the tested default-OCR mix. Treat this as an eval target rather than a universal default.
License
The base model is licensed under Apache-2.0. This quantized derivative is
distributed under Apache-2.0 as well. See LICENSE and NOTICE.
- Downloads last month
- -
8-bit
Model tree for Sawfwair/Infinity-Parser2-Pro-Int8
Base model
infly/Infinity-Parser2-Pro