Downloads · 30 days
304
56% of all-time downloads
DanKau/gliner2.5-multi-v1-onnx
gliner2.5-multi-v1-onnx is a token classification model from DanKau. Use it when you need labels on individual words, such as names. It is set up for onnx. The card lists the license as apache-2.0.
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.
Downloads · 30 days
304
56% of all-time downloads
All-time downloads
547
Public
Repo size
1.1 GB
Likes
1
Public
Click a slice to open those files.
.onnx1.1 GB · 99%
From the Hugging Face model README
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.
| 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]).
The prompt is unchanged from GLiNER2:
( [P] entities ( [E] label … ) ) [SEP_TEXT] <lowercased text>
Run encoder.onnx over 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] bool |
query_states | [1, n_labels, 768] |
query_mask | [1, n_labels] bool |
| output | shape |
|---|---|
pair_logits | [1, n_labels, 192] |
candidate_indices | [1, n_labels, 192, 2] |
candidate_valid | [1, n_labels, 192] bool |
null_logits | [1, n_labels] |
A candidate is an entity when candidate_valid and sigmoid(pair_logit) >= threshold. Its
indices are word boundaries with an exclusive end: (1, 3) means words[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.
Two source-level obstacles are worked around at export time:
torch.sort(..., stable=True) lowers to aten::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) becomes EyeLike, for which ONNX Runtime has no boolean kernel;
an arange comparison 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.
Exported from fastino/gliner2.5-multi-v1 at revision aaecfe45db1d828c963717054ccb868e8ad1f1d5.
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.