Skip to main content

gliner2-onnx

GLiNER2 ONNX runtime for Python. Runs GLiNER2 models without PyTorch.

This library is experimental. The API may change between versions.

Features

  • Zero-shot NER and text classification
  • Runs with ONNX Runtime (no PyTorch dependency)
  • FP32 and FP16 precision support
  • GPU acceleration via CUDA

All other GLiNER2 features such as JSON export are not supported.

Installation

pip install gliner2-onnx

NER

from gliner2_onnx import GLiNER2ONNXRuntime

runtime = GLiNER2ONNXRuntime.from_pretrained("lmo3/gliner2-large-v1-onnx")

entities = runtime.extract_entities(
    "John works at Google in Seattle",
    ["person", "organization", "location"]
)
# [
#   Entity(text='John', label='person', start=0, end=4, score=0.98),
#   Entity(text='Google', label='organization', start=14, end=20, score=0.97),
#   Entity(text='Seattle', label='location', start=24, end=31, score=0.96)
# ]

Classification

from gliner2_onnx import GLiNER2ONNXRuntime

runtime = GLiNER2ONNXRuntime.from_pretrained("lmo3/gliner2-large-v1-onnx")

# Single-label classification
result = runtime.classify(
    "Buy milk from the store",
    ["shopping", "work", "entertainment"]
)
# {'shopping': 0.95}

# Multi-label classification
result = runtime.classify(
    "Buy milk and finish the report",
    ["shopping", "work", "entertainment"],
    threshold=0.3,
    multi_label=True
)
# {'shopping': 0.85, 'work': 0.72}

CUDA

To use CUDA for GPU acceleration:

runtime = GLiNER2ONNXRuntime.from_pretrained(
    "lmo3/gliner2-large-v1-onnx",
    providers=["CUDAExecutionProvider", "CPUExecutionProvider"]
)

Precision

Both FP32 and FP16 models are supported. Only the requested precision is downloaded.

runtime = GLiNER2ONNXRuntime.from_pretrained(
    "lmo3/gliner2-large-v1-onnx",
    precision="fp16"
)

Models

Pre-exported ONNX models:

Model HuggingFace
gliner2-large-v1 lmo3/gliner2-large-v1-onnx
gliner2-multi-v1 lmo3/gliner2-multi-v1-onnx

Note: gliner2-base-v1 is not supported (uses a different architecture).

Exporting Models

To export your own models, clone the repository and use make:

git clone https://github.com/lmoe/gliner2-onnx
cd gliner2-onnx

# FP32 only
make onnx-export MODEL=fastino/gliner2-large-v1

# FP32 + FP16
make onnx-export MODEL=fastino/gliner2-large-v1 QUANTIZE=fp16

Output is saved to model_out/<model-name>/.

JavaScript/TypeScript

For Node.js, see @lmoe/gliner-onnx.js.

Credits

License

MIT

Metadata

Release files for gliner2-onnx 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gliner2-onnx 0.1.1
File Size Uploaded
gliner2_onnx-0.1.1.tar.gz 9.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gliner2-onnx 0.1.1
File Interpreter ABI Platform
gliner2_onnx-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 20.3 kB

Release files / gliner2_onnx-0.1.1.tar.gz

Download URL gliner2_onnx-0.1.1.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0858337a867e47753046c1041d9c5e2e24a67940a9f566c37f174f861648b63f
BLAKE2b-256 checksum
How to use checksums
938b594e61d423ec912bc620ca8bd76a6da55c7d3089a9e3c4ee45ea5207fcf4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 18, 2026.

Transparency log

Release files / gliner2_onnx-0.1.1-py3-none-any.whl

Download URL gliner2_onnx-0.1.1-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f1b8300a880a19c2fec6688b4af51491258f5deefaa84b5a0cebf7c9d5f3044
BLAKE2b-256 checksum
How to use checksums
9367ae24b96a31433154eef40d962b90dde1640263aec748ac3040baaf824cc0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page