ONNX version of GLiNER
fast entity extraction without transformers
2 min readupdated
The repository contains optimized ONNX models (including an INT8 variant) for the popular GLiNER system (General Language Intelligence Named Entity Recognition, a model for extracting entities of arbitrary types without training). It performs Named Entity Recognition (NER) across multiple languages, including support for CJK and Cyrillic scripts. The key feature of this version is running via ONNX Runtime without heavy dependencies on the transformers and tokenizers libraries, which speeds up inference and simplifies production integration. This is useful for developers deploying entity extraction into fast microservices.
Key features
- ONNX format: FP32 and quantized INT8 versions are available for fast execution on CPU and GPU.
- No transformers: Complete independence from the Hugging Face transformers ecosystem, utilizing a built-in tokenizer via SentencePiece and proto.
- Efficient pipeline: Includes ready-to-use scripts for tokenization, word splitting, inference, and greedy selection of non-overlapping spans.
- Multilingualism: Support for numerous languages, including correct processing of ideograms and various alphabets.
What you can do
- Backend integration: Integrate entity recognition (people, organizations, places) into a lightweight Python service based on onnxruntime-gpu.
- Custom NER: Extract any arbitrary entity types from text without prior fine-tuning of classifiers.
- Speed optimization: Run the model on a client or inside a container with minimal memory requirements thanks to INT8 quantization.
Example
Installing dependencies and running the example from the repository:
pip install onnxruntime sentencepiece numpy protobuf
python3 gliner_multi-v2.1/src/example.pyRead more
DetailsModel: gliner_multi-v2.1
Files: model.onnx (FP32), model_quantized.onnx (INT8)
Features: SentencePiece tokenization with normalizer_spec correction, handling spans up to 12 words wide.










Comments