--- language: - ne - hi - en license: other license_name: ampixa-non-commercial-research license_link: LICENSE pipeline_tag: image-to-text base_model: microsoft/trocr-small-handwritten tags: - ocr - handwriting-recognition - devanagari - nepali - hindi - pytorch - paddleocr - research --- # Ampixa Deva OCR 75M — research checkpoint A **74,842,752-parameter** recognizer for cropped Nepali/Hindi words or lines and English handwriting. This release includes source Safetensors weights and a native Paddle/PaddleX export of the same checkpoint. Each format contains one shared encoder; the two formats are alternatives, not models to load together. This is the established character-decoder checkpoint after an 8,000-update continuation (16,000 cumulative updates), rather than the newer experimental BPE model. It is a research release, not a claim of state-of-the-art OCR or achievement of 4% Nepali handwriting CER. ## Measured results | Fixed evaluation set | Crops | CER | |---|---:|---:| | Nepali handwriting words | 300 | 12.9921% | | Hindi handwriting words | 2,000 | 8.0803% | | English handwriting lines, original English branch | 976 | 2.3150% | | English handwriting lines, character branch | 976 | 6.0940% | | Real print crops | 2,000 | 11.1904% | | Synthetic print crops | 800 | 2.6169% | | English print crops, character branch | 1,744 | 13.9357% | CER is micro-averaged NFC Unicode codepoint edit distance. Every evaluated crop is retained, including errors, empty outputs and generation caps. See `metrics.json` for exact totals and generation settings. All 8,796 native outputs from the two explicit branches matched source tokens, text, caps and errors on these fixed populations. Native evaluation performed zero Torch tensor operations. These are existing development populations, not a blind benchmark. Nepali is word-level; it does not establish performance on unseen writers, full handwritten notes or pages. An earlier checkpoint of this architecture reached 12.53% Nepali word CER; it is not the checkpoint in this release. On a separate 336-paragraph English comparison, the retained English recognizer achieved 8.16% CER versus 3.01% for Qwen3-VL-4B. This release does not beat that stronger paragraph reference. ## Download and source inference ```bash hf download ampixa/deva-ocr-75m-research --local-dir deva-ocr-75m cd deva-ocr-75m pip install -r requirements-source.txt python predict.py /path/to/cropped-line.png --language ne python predict.py /path/to/english-line.png --language en --text-style handwriting python predict.py /path/to/printed-english.png --language en --text-style print ``` The included CLI uses serial CPU inference and does not download another model. Choose `ne`, `hi` or `en` explicitly. Set `--text-style print` for printed English; the default text style is `handwriting`. Nepali, Hindi and printed English use the character decoder with the adapted encoder. English handwriting uses the unchanged original English model. Text style is selected by the caller; the CLI does not detect it automatically. All branches resize each crop to 384×384 RGB. Character decoding uses 10 beams and up to 257 new tokens; English uses 10 beams and up to 256. JSON output includes text, raw token IDs and whether generation reached its cap. This is a custom architecture. Use the included loader/CLI; `AutoModel.from_pretrained` and the generic Transformers OCR pipeline are not configured for this repository. ## Native Paddle Install the native dependencies in a separate environment: ```bash pip install -r requirements-paddle.txt python predict.py /path/to/cropped-line.png --language ne --backend paddle python predict.py /path/to/printed-english.png --language en --text-style print --backend paddle ``` The prebuilt operator library was validated on Linux x86_64 with FMA, PaddlePaddle 3.3.1 and PaddleX 3.7.1, using two CPU threads. Native GPU execution and other platforms are unvalidated. Use the source backend on platforms incompatible with the prebuilt library. The custom operator source and its third-party notices are under `paddle/code/`. For the actual PaddleX factory: ```python from pathlib import Path import sys from paddlex.inference.models import create_predictor root = Path("deva-ocr-75m").resolve() sys.path.insert(0, str(root / "paddle/code")) from paddlex_shared_character import register, MODEL_NAME register() predictor = create_predictor( MODEL_NAME, model_dir=str(root / "paddle"), device="cpu", engine="flexible", research_only_allow_unqualified=True, ) for result in predictor.predict("cropped-line.png", branch="character"): print(result["rec_text"]) ``` Use `branch="english"` for English handwriting and `branch="character"` for printed English, Nepali and Hindi. The research opt-in remains intentional: fixed-crop numerical parity does not establish full product acceptance. Scores are uncalibrated beam scores. Detection, reading order, word boxes, full-page segmentation and automatic language routing are not included. ## Architecture and provenance The original Microsoft TrOCR-small English model supplies the shared DeiT encoder and English decoder. The character branch applies stored rank-71 encoder corrections and a separate literal-Unicode character decoder without storing a second encoder. Source weights use Safetensors, with checksummed configuration and tokenizer assets. `source-model/` holds source weights and their original manifest. `code/` contains the source loader and codec. `paddle/` contains the native encoder, two decoder graphs, runtime and operator library. `release-manifest.json` binds this release to its checkpoint and prior native package; `checksums.sha256` inventories published files. Packaging excludes training images and conversion-control prediction packets. Existing graph parameter files and runtime source bytes are retained. ## Use and data terms Use is restricted to non-commercial research and education. Training includes research-restricted IAM and IIIT handwriting sources, CC0 Nepali word crops, CC BY material, synthetic renders and internally used newspaper-derived crops. This repository does not grant rights to the underlying datasets or permission for commercial deployment. See `LICENSE`, `TRAINING_DATA.md` and `THIRD_PARTY_NOTICES.md`. No Indra or Qwen weights are included; those systems were comparators, not teachers for this checkpoint. ## Release packaging checks The download-layout CLI was checked on fixed Nepali, Hindi and English inputs in both backends (six exact reference matches). The actual PaddleX factory was rerun on 24 path inputs and 24 BGR inputs, with 24 JSON results checked and zero Torch tensor operations. These are packaging controls; the larger fixed-corpus accuracy results are reported above. The explicit text-style CLI update was checked on one fixed English handwriting input and one fixed printed-English input in both Torch and Paddle. All four token/text/cap outputs matched their existing source references. See `text-style-validation.json`. This update retains all neural weights, native graphs, original benchmark records and default handwriting behavior.