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.
File size: 1,658 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
# 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.
"""Content words of a transcript (shared by the GPU capture and the scoring): character spans that hold page text,
with markup removed, so ocria's RCL / HTML / markdown and Gemini's markdown / HTML are cut the same way."""

import re

# HTML tags (a letter after "<", one line: a bare "<" is text, e.g. RCL's merge-left cell or "< 8.0 V");
# markdown link / image targets
TAG = re.compile(r"</?[A-Za-z][^<>\n]*>|\]\([^)\s]*\)|!\[")
# a word starts with a letter or digit (or a currency sign / opening bracket before one) and runs over letters, digits and
# in-word punctuation; markdown/RCL markup (#, *, |, !, `, _, quotes) is never part of a word
WORD = re.compile(r"[$€£¥₹(]?[^\W_][^\s<>|*`\"\t]*")
_NON_WORD = re.compile(r"[\W_]")
TRAIL = ".,;:)]}!?'’"


def norm(w: str) -> str:
    lowered = w.lower()
    return lowered if lowered.isalnum() else _NON_WORD.sub("", lowered)


def word_spans(text: str) -> list[tuple[int, int, str]]:
    masked = TAG.sub(lambda m: " " * len(m.group()), text)
    masked = masked.replace("&nbsp;", "      ").replace("&amp;", "&    ")
    out = []
    for m in WORD.finditer(masked):
        s, e = m.start(), m.end()
        while (
            e > s + 1
            and masked[e - 1] in TRAIL
            and not (masked[e - 1] == ")" and "(" in masked[s : e - 1])
        ):
            e -= 1
        w = text[s:e]
        if norm(w):
            out.append((s, e, w))
    return out