GLiNER2.5 multi-v1 (ONNX)
ONNX export of fastino/gliner2.5-multi-v1 β the boundary
architecture (BoundaryExtractor), which predicts where entities start and end instead of scoring
a fixed-width span grid.
Exported for SecuPi's unstructured AI service (SPAI), which runs it through ONNX Runtime from Java. Published so that service can fetch it without a PyTorch dependency; anyone else is welcome to use it under the same licence as the base model.
Files
| file | what it is |
|---|---|
onnx/encoder.onnx |
mDeBERTa-v3-base encoder over the schema prompt + text |
onnx/boundary.onnx |
the whole boundary head: boundary encoder, query head, candidate pool and pair scorer |
onnx/classifier.onnx |
classification head, Linear(768β1536) β ReLU β Linear(1536β1) |
gliner2_config.json, config.json |
special-token ids and ONNX file map |
tokenizer.json, tokenizer_config.json |
tokenizer |
There is no span_rep.onnx or count_embed.onnx: the boundary architecture has no span grid and
no count embedding. classifier.onnx keeps the same contract as the GLiNER2 exports
(hidden_state [n,768] -> logit [n,1]).
How to run it
The prompt is unchanged from GLiNER2:
( [P] entities ( [E] label β¦ ) ) [SEP_TEXT] <lowercased text>
Run
encoder.onnxover that.query_states= hidden states at the[E]positions β[1, n_labels, 768].token_states= hidden state at the first sub-token of each word β[1, n_words, 768](token_pooling: "first"β the head sees words, not sub-tokens).Run
onnx/boundary.onnx:input shape token_states[1, n_words, 768]text_mask[1, n_words]boolquery_states[1, n_labels, 768]query_mask[1, n_labels]booloutput shape pair_logits[1, n_labels, 192]candidate_indices[1, n_labels, 192, 2]candidate_valid[1, n_labels, 192]boolnull_logits[1, n_labels]A candidate is an entity when
candidate_validandsigmoid(pair_logit) >= threshold. Its indices are word boundaries with an exclusive end:(1, 3)meanswords[1:3].The pool intentionally contains overlapping spans of the same label. Keep the highest-scoring and drop anything overlapping it, per label, to match the reference implementation.
A runnable version of the above, which diffs its output against native PyTorch, ships with the
export tooling as verify_gliner25_export.py.
Export notes
Two source-level obstacles are worked around at export time:
torch.sort(..., stable=True)lowers toaten::sort's out-variant, which has no ONNX symbolic. Stability is preserved rather than dropped where it is load-bearing β the candidate dedup sorts integer keys because they contain duplicates β by folding the position into the key.torch.eye(n, dtype=torch.bool)becomesEyeLike, for which ONNX Runtime has no boolean kernel; anarangecomparison produces the same mask.
Verified against native PyTorch: identical sets of valid candidates (0 missing, 0 extra) with max score difference 2.1e-05, across word counts from 9 to 63 and 2 to 6 labels; and identical end-to-end entity output on the tooling's sample documents.
Provenance
Exported from fastino/gliner2.5-multi-v1 at revision aaecfe45db1d828c963717054ccb868e8ad1f1d5.
Licence
Apache 2.0, inherited from the base model. This repository redistributes the same weights in a different serialisation; all credit for the model belongs to Fastino.
- Downloads last month
- -
Model tree for DanKau/g2.5-multi-v1-onnx
Base model
fastino/gliner2.5-multi-v1