Image Classification
timm
ONNX
Safetensors
ocr
script-identification
page-classification
document-ai
multi-label
glam
knowledge-distillation
hf_jobs
Run this model with HF Jobs
Run davanstrien/page-script-id 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 to fine-tune https://huggingface.co/davanstrien/page-script-id. 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/davanstrien/page-script-id 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.
Instructions to use davanstrien/page-script-id with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- timm
How to use davanstrien/page-script-id with timm:
import timm model = timm.create_model("hf-hub:davanstrien/page-script-id", pretrained=True) - Notebooks
- Google Colab
- Kaggle
Update repo links after rename to davanstrien/page-script-id
Browse files58 unmodified lines5960616263646526 unmodified lines929394959697989910023 unmodified lines12412512612712812913058 unmodified linesBuilt on **MobileNetV4-conv-small** (2.52M parameters, 10.1 MB as ONNX or `timm` weights), distilled from a 3-family teacher ensemble (`convnext_small`, `hgnetv2_b4`, `caformer_s36`) on [Hugging Face Jobs](https://huggingface.co/docs/hub/jobs). Takes a greyscale page squashed to `640 × 640` and runs in **33 ms** on 1 CPU thread, **11 ms** on 4 threads, or **1,773 pages/s** on an A10G (`bf16`, batch 64).- **Try it live:** [Page Script ID Demo Space](https://huggingface.co/spaces/davanstrien/page-script-id-demo) (runs on free CPU — upload images or PDFs, toggle crop padding, tune thresholds live)- **Higher-accuracy sibling:** [`davanstrien/page-script-id-v2-hgnet`](https://huggingface.co/davanstrien/page-script-id-v2-hgnet) (HGNetV2-B0, 3.99M parameters, 16 MB, 79 ms 1t / 36 ms 4t, 88.0% MDPBench photographed)> **Check the thresholds on your own pages.** The default cut-offs (`0.55` for a script, `0.7038` for `unknown`) were chosen on held-out web-PDF validation pages (95% coverage). On government documents this refuses ~8% and on photographed documents ~28%. Run on a few hundred of your own pages and tune `unknown_threshold` and `script_threshold` in `config.json` before bulk routing.26 unmodified linesfrom huggingface_hub import hf_hub_downloadfrom PIL import Imagemodel_id = "hf-hub:davanstrien/page-script-id-v2"model = timm.create_model(model_id, pretrained=True).eval()cfg = json.loads(Path(hf_hub_download("davanstrien/page-script-id-v2", "config.json")).read_text())["inference"]size = cfg["input_size"]mean = torch.tensor(model.pretrained_cfg["mean"]).view(3, 1, 1)std = torch.tensor(model.pretrained_cfg["std"]).view(3, 1, 1)23 unmodified linesAll test benchmarks are strictly held out from training (never trained on test documents, MDPBench, OmniDocBench, Sarvam Indic OCR Bench, or held-out unseen scripts Gurmukhi/Sinhala). Top-1 accuracy is unthresholded (before the `unknown` rule). "2 seeds" is the range over two distilled runs of this recipe (`s0` selected by `r2_val`; `s1` shown for spread).| Benchmark | Label | n | **This model** | 2 seeds | Sibling `v2-hgnet` ||---|---|---:|---:|---:|---:|| Web PDFs (`r2_test`), text layer | text layer | 2,056 | **94.0%** | 93.9–94.0% | 94.1% || Web PDFs (`r2_test`), doc label | doc language | 2,695 | **94.3%** | 93.5–94.3% | 94.4% |58 unmodified lines5960616263646526 unmodified lines929394959697989910023 unmodified lines12412512612712812913058 unmodified linesBuilt on **MobileNetV4-conv-small** (2.52M parameters, 10.1 MB as ONNX or `timm` weights), distilled from a 3-family teacher ensemble (`convnext_small`, `hgnetv2_b4`, `caformer_s36`) on [Hugging Face Jobs](https://huggingface.co/docs/hub/jobs). Takes a greyscale page squashed to `640 × 640` and runs in **33 ms** on 1 CPU thread, **11 ms** on 4 threads, or **1,773 pages/s** on an A10G (`bf16`, batch 64).- **Try it live:** [Page Script ID Demo Space](https://huggingface.co/spaces/davanstrien/page-script-id-demo) (runs on free CPU — upload images or PDFs, toggle crop padding, tune thresholds live)- **Higher-accuracy sibling:** [`davanstrien/page-script-id-hgnet`](https://huggingface.co/davanstrien/page-script-id-hgnet) (HGNetV2-B0, 3.99M parameters, 16 MB, 79 ms 1t / 36 ms 4t, 88.0% MDPBench photographed)> **Check the thresholds on your own pages.** The default cut-offs (`0.55` for a script, `0.7038` for `unknown`) were chosen on held-out web-PDF validation pages (95% coverage). On government documents this refuses ~8% and on photographed documents ~28%. Run on a few hundred of your own pages and tune `unknown_threshold` and `script_threshold` in `config.json` before bulk routing.26 unmodified linesfrom huggingface_hub import hf_hub_downloadfrom PIL import Imagemodel_id = "hf-hub:davanstrien/page-script-id"model = timm.create_model(model_id, pretrained=True).eval()cfg = json.loads(Path(hf_hub_download("davanstrien/page-script-id", "config.json")).read_text())["inference"]size = cfg["input_size"]mean = torch.tensor(model.pretrained_cfg["mean"]).view(3, 1, 1)std = torch.tensor(model.pretrained_cfg["std"]).view(3, 1, 1)23 unmodified linesAll test benchmarks are strictly held out from training (never trained on test documents, MDPBench, OmniDocBench, Sarvam Indic OCR Bench, or held-out unseen scripts Gurmukhi/Sinhala). Top-1 accuracy is unthresholded (before the `unknown` rule). "2 seeds" is the range over two distilled runs of this recipe (`s0` selected by `r2_val`; `s1` shown for spread).| Benchmark | Label | n | **This model** | 2 seeds | Sibling `page-script-id-hgnet` ||---|---|---:|---:|---:|---:|| Web PDFs (`r2_test`), text layer | text layer | 2,056 | **94.0%** | 93.9–94.0% | 94.1% || Web PDFs (`r2_test`), doc label | doc language | 2,695 | **94.3%** | 93.5–94.3% | 94.4% |
README.md+4-4