ONNX Model for NuNerZero This repository hosts the ONNX version of NuNerZero, a zero-shot named entity recognition (NER) model optimized for fast inference using ONNX Runtime. This conversion aims to provide efficient and production-ready performance while maintaining the original capabilities of the NuNerZero model.

This model is a part of Zink. Zink is a zero-shot anonymizer and currently uses onnx NuNERZero model for anonymization.

Repository Contents:

  1. model.onnx: The primary ONNX model file used for inference.
  2. gliner_config.json: Configuration settings for the model.
  3. added_tokens.json: Additional tokens required by the tokenizer.
  4. special_tokens_map.json: Mapping for special tokens.
  5. tokenizer.json and tokenizer_config.json: Tokenizer vocabulary and configuration files.
  6. spm.model: SentencePiece model file used by the tokenizer.

Requirements:

  1. Python 3.7 or higher
  2. GLiNER – the package that provides the interface to load and run the model. I created the onnx version on "gliner==0.2.3".

Usage Here’s a quick example on how to load and use the ONNX model with GLiNER:

from gliner import GLiNER
import time

# Load the ONNX model and tokenizer
model_name="deepanwa/NuNerZero_onnx"
model = GLiNER.from_pretrained(model_name,load_onnx_model=True, load_tokenizer=True)

text = "Dr. Michael, a cardiologist from Canada, was born on 07/04/1970. John Doe dialled his mother at 992-234-3456 and then went out for a walk."
labels = ("person", "profession", "location", "date", "phone number", "relationship", "medical condition", "age")

start = time.time()
result = model.predict_entities(text, labels)
end = time.time()

print("Predicted entities:", result)
print("Time taken:", end - start)

Important Notes Large Model Size: The model file is approximately 1.85 GB, so please ensure you have sufficient bandwidth and disk space when downloading.

Inference Efficiency: Leveraging the ONNX format can significantly accelerate inference compared to the original PyTorch implementation.

Citation: 10.57967/hf/4902

Contributing Contributions, suggestions, or bug reports are welcome. Please open an issue or submit a pull request if you have improvements.

Downloads last month
172
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for deepanwa/NuNerZero_onnx

Base model

numind/NuNER_Zero
Quantized
(2)
this model