pj-ocr-jaxjs-medium / README.md
hf-dev-01's picture
Promote the all-JAXJS medium release
9c59d5c verified
|
Raw
History Blame Contribute Delete
4.89 kB
---
license: other
pipeline_tag: image-to-text
tags:
- document-ai
- ocr
- mineru
- jax-js
- webgpu
- safetensors
---
# PJ OCR JAXJS Medium Model Set
Browser-ready JAXJS artifacts for the `medium` PJ OCR document parsing pipeline. The model set preserves MinerU-compatible document structure and is intended to run locally in the browser through jax-js and WebGPU.
This repository packages converted artifacts only. Each model's `contract.json` records the upstream Hugging Face repository, pinned source revision, source file checksums, conversion contract, and upstream license provenance.
## Included Models
| Pipeline role | Artifact | Weight dtype | Weight bytes |
| --- | --- | --- | ---: |
| Layout detection | `pp-doclayout-v3-fp16-jaxjs` | FP16 | 65,459,939 |
| Layout verification/rollback | `pp-doclayout-v3-jaxjs` | FP32 | 130,847,572 |
| Layout rollback | `pp-doclayout-l-fp16-jaxjs` | FP16 | 64,568,988 |
| Formula recognition | `pp-formulanet-plus-s-fp16-jaxjs` | FP16 | 128,454,765 |
| Table classification | `mineru-table-classifier-jaxjs` | FP32 | 6,753,977 |
| Table recognition | `slanet-plus-table-jaxjs` | Mixed | 6,593,062 |
| Wired table recovery | `mineru-unet-structure-table-fp16-jaxjs` | FP16 storage | 4,168,278 |
| OCR detection | `ppocr-v6-medium-det-jaxjs` | FP32 | 61,974,931 |
| OCR recognition | `ppocr-v6-medium-rec-streaming-jaxjs` | FP32 shards | 76,508,326 |
The selection is defined by [`model-sets/medium.json`](model-sets/medium.json). Canonical `medium` uses FP16 PP-DocLayoutV3, streaming PP-OCRv6 recognition, and the all-JAXJS MinerU table trio. The non-default [`model-sets/medium-v3-candidate.json`](model-sets/medium-v3-candidate.json) preserves FP32 PP-DocLayoutV3 for release verification and explicit rollback.
## Repository Layout
```text
model-sets/
medium.json
models-jaxjs/
manifest.json
pp-doclayout-v3-fp16-jaxjs/
pp-doclayout-v3-jaxjs/
mineru-table-classifier-jaxjs/
slanet-plus-table-jaxjs/
mineru-unet-structure-table-fp16-jaxjs/
ppocr-v6-medium-rec-streaming-jaxjs/
pp-doclayout-l-fp16-jaxjs/
pp-formulanet-plus-s-fp16-jaxjs/
ppocr-v6-medium-det-jaxjs/
ppocr-v6-medium-rec-jaxjs/
SHA256SUMS
```
Every artifact directory includes:
- `contract.json`: loader and provenance contract, including the expected Safetensors checksum.
- `metadata.json`: converted Paddle graph plan and preprocessing/postprocessing metadata.
- `weights.safetensors`: active weights selected by the contract.
- `sidecars/`: inference configuration and dictionaries required by the model-specific loader.
- `constants/`: non-weight tensor shards when required. PP-DocLayout-L includes one boolean constant shard.
## Browser Loading
Preserve the repository paths when resolving files. A browser loader can use a pinned Hub commit as its artifact base URL:
```ts
const repo = "hf-dev-01/pj-ocr-jaxjs-medium";
const revision = "PINNED_COMMIT_SHA";
const artifactBase = `https://huggingface.co/${repo}/resolve/${revision}/`;
async function fetchArtifact(path: string): Promise<ArrayBuffer> {
const response = await fetch(new URL(path, artifactBase));
if (!response.ok) {
throw new Error(`Artifact fetch failed (${response.status}): ${path}`);
}
return response.arrayBuffer();
}
const manifest = await fetchArtifact("models-jaxjs/manifest.json");
```
Use a commit SHA rather than `main` in production so contracts, metadata, sidecars, and weights remain an atomic set. Cache immutable commit-pinned URLs in Cache Storage, OPFS, or another durable browser store.
## Integrity
`SHA256SUMS` covers every packaged file other than itself. The weight checksum in each `contract.json` is also validated by the PJ OCR JAXJS artifact workflow.
## License and Provenance
The classifier and wired-table U-Net artifacts derive from AGPL-3.0 MinerU/PDF-Extract-Kit sources. SLANet-plus and the streaming PP-OCRv6 recognizer derive from Apache-2.0 sources, as do the packaged layout, formula, and OCR-detection artifacts. Each `contract.json` records its exact upstream repository, revision, and license. The repository includes both [`LICENSE`](LICENSE) and the applicable upstream notices under [`LICENSES/`](LICENSES/).
## PP-DocLayoutV3
`pp-doclayout-v3-fp16-jaxjs` is the canonical browser layout artifact. `pp-doclayout-v3-jaxjs` remains available for release verification and explicit rollback. See [the V3 artifact report](docs/pp-doclayout-v3.md).
## JAXJS Table Stack
`medium` selects `mineru-table-classifier-jaxjs`, `slanet-plus-table-jaxjs`, and `mineru-unet-structure-table-fp16-jaxjs`. The composed lane checksum-verifies their release descriptor, the streaming OCR descriptor, and the published V3 descriptor before writing the repository checksum inventory. The layout, streaming OCR, and table descriptors all pin immutable artifact revision `3ebf4493fe544793ad72ece74cf4777b281460d6`.