BERT-base Chinese (ONNX INT8)

INT8 quantized ONNX export of google-bert/bert-base-chinese for feature extraction (embedding extraction).

Files

  • model_int8.onnx โ€” INT8 quantized ONNX model (~28 MB)
  • vocab.txt โ€” WordPiece vocabulary

Usage

The [CLS] token hidden state (position 0) is used as a 768-dim embedding vector.

import onnxruntime as ort
import numpy as np

session = ort.InferenceSession("model_int8.onnx")
inputs = {
    "input_ids": np.array([[...]], dtype=np.int64),
    "attention_mask": np.array([[...]], dtype=np.int64),
    "token_type_ids": np.array([[...]], dtype=np.int64),
}
last_hidden_state = session.run(None, inputs)[0]  # (batch, seq_len, 768)
cls_embedding = last_hidden_state[:, 0, :]         # (batch, 768)
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support