bert-italian-ner-onnx-quantized-avx512 / bert_din_quant_test.py
z-uo's picture
Upload 2 files
a0b2bc1 verified
raw
history blame
545 Bytes
import time
from transformers import AutoTokenizer, pipeline
from optimum.onnxruntime import ORTModelForTokenClassification
tokenizer = AutoTokenizer.from_pretrained("./bert-italian-ner-onnx-quantized-avx512")
model = ORTModelForTokenClassification.from_pretrained("./bert-italian-ner-onnx-quantized-avx512")
nerpipeline = pipeline('ner', model=model, tokenizer=tokenizer)
text = "La sede storica della Olivetti è ad Ivrea"
start_time = time.time()
output = nerpipeline(text)
print(f"--- {time.time() - start_time} seconds ---")
print(output)