Views
No views yet
model_int8.onnx — INT8 quantized ONNX model (~28 MB)vocab.txt — WordPiece vocabulary1import onnxruntime as ort
2import numpy as np
3
4session = ort.InferenceSession("model_int8.onnx")
5inputs = {
6 "input_ids": np.array([[...]], dtype=np.int64),
7 "attention_mask": np.array([[...]], dtype=np.int64),
8 "token_type_ids": np.array([[...]], dtype=np.int64),
9}
10last_hidden_state = session.run(None, inputs)[0] # (batch, seq_len, 768)
11cls_embedding = last_hidden_state[:, 0, :] # (batch, 768)