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.
OCRia-1-W4A16-LLM-Compressor / tests /check_legacy_layout.py
Vishva R
Update model weights, configs, and auxiliary files
d8db4d8 verified
Raw History Blame Contribute Delete
1.5 kB
# 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.
from pathlib import Path
import json,sys
import numpy as np
from PIL import Image,ImageDraw
from ocria_grounding import ground_layout,to_layout_items_page
class Capture:
def unit_maps(self,image,answer,units):
maps=np.zeros((len(units),12,16),dtype=np.float32)
for i in range(len(units)):maps[i,3+i//5,2+i%5]=1
return maps,(12,16),np.ones(len(units),dtype=bool)
image=Image.new('RGB',(320,240),'white')
d=ImageDraw.Draw(image)
for y in (60,80,100):
for x in range(40,160,24):d.rectangle((x,y,x+17,y+9),fill='black')
answer='# Heading\n\nOne two three four five six seven eight.'
regions=[{'label':'text','score':.95,'box':[20,40,200,140]}]
cases={}
for name,kw in [('fallback',{}),('detections',{'detections':regions}),('detector',{'detector':lambda image:regions}),('pdf_words',{'detections':regions,'words':[{'text':'One','box':[40,60,57,69]}]})]:
page=ground_layout(Capture(),image,answer,**kw)
cases[name]={'page':page,'serialized':to_layout_items_page(page,scale=.5)}
assert not any(k.startswith('parse_rl_utils') for k in sys.modules),'default imported fast backend'
expected=json.loads((Path(__file__).parent/'legacy_layout_expected.json').read_text())
assert cases == expected
print('Four legacy grounding modes and serializers match the original HF snapshot')