File size: 545 Bytes
a0b2bc1
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
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)