nicolasembleton's picture
docs: attrs.onnx sizes, 512-word crop, WebGPU length cliff
13c5cdc verified
|
Raw
History Blame Contribute Delete
2.99 kB
metadata
library_name: onnx
license: apache-2.0
pipeline_tag: token-classification
base_model: fastino/gliner2.5-multi-v1
tags:
  - onnx
  - gliner2
  - gliner2.5
  - boundary
  - webgpu
  - token-classification
  - text-classification
  - relation-extraction

gliner2.5-multi-v1-onnx

ONNX export of fastino/gliner2.5-multi-v1 (GLiNER 2.5 BoundaryExtractor) for onnxruntime-web / WebGPU. Revision 5 graphs plus attrs.onnx (score_explicit_spans).

One encoder pass. JointIE beam, classification implies/excludes, record assignment, and long-document chunking stay in JavaScript.

Host: Pastel-Org/gliner2.5-onnx-webgpu (live: gliner25-onnx-webgpu.pages.dev).

Files

File Role Size
onnx/model.onnx Encoder + entity pair path + classifier + text_states + candidate_states 1121.5 MB
onnx/heads.onnx SparseRelationScorer only (no encoder) 23.7 MB
onnx/records.onnx RecordHead assignment (inst/field/cand projections + null column) 1.19 MB
onnx/attrs.onnx score_explicit_spans (dynamo; pad 512/8/16) 7.38 MB

attrs.onnx

Dynamo export of head.score_explicit_spans. Traced at 512 words, 8 attribute queries, 16 spans. The JS host crops a 512-word window around the mention; that pad is not a document-length cap. ORT vs torch RMSE ~1e-6 (small) / ~2e-6 (base, multi). Overlay lookup is the fallback if this graph fails to load.

Decode notes (JS host, not this graph)

Attribute labels are packed with entity labels in one [E] block (sorted). Single-label attributes use softmax. ONNX pair_valid is all-true; the host drops start >= end slots before overlap.

Python max_len is 4096 words: classify_text / extract is one forward pass over the whole document. That is what Fastino means by long-context classification on CUDA/CPU.

This WebGPU export is not that:

Call Words in one GPU run Measured here (M2 Max, onnxruntime-web)
classify_text / extract the whole string (cap 4096) small finished 4096 words. base and multi died between 3500 and 3600 (createCommandEncoder / std::bad_alloc).
classify_text_long / extract_entities_long 384, overlap 64 4096-word docs: 13 windows. base 2.75 s, multi 4.3 s. Merge is max-confidence (classify) or span overlap (NER).

A 4096-word classify_text_long never builds a 4096-word attention matrix. Use the *_long APIs for contracts on base/multi in the browser.

Still not in ONNX

Full Kleene classification AST is not ported; README implies / excludes is a JS beam. Latent / anchorless records are not exported.

Credits