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.
1from gliner import GLiNER
2import time
3
4# Load the ONNX model and tokenizer
5model_name="deepanwa/NuNerZero_onnx"
6model = GLiNER.from_pretrained(model_name,load_onnx_model=True, load_tokenizer=True)
7
8text = "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."
9labels = ("person", "profession", "location", "date", "phone number", "relationship", "medical condition", "age")
10
11start = time.time()
12result = model.predict_entities(text, labels)
13end = time.time()
14
15print("Predicted entities:", result)
16print("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.
Contributing
Contributions, suggestions, or bug reports are welcome. Please open an issue or submit a pull request if you have improvements.