Team Ai
Modelpublic

Hosstia/bert-tiny-chinese-onnx

sourceHugging Faceapache-2.0updated 3mo agoView on Hugging Face
0likes15downloads
Model Card

bert-tiny-chinese-onnx

Model [ckiplab/bert-tiny-chinese](https://huggingface.co/ckiplab/bert-tiny-chinese), converted to ONNX format for use with ONNX Runtime.

Original model

ParameterValue
ArchitectureBERT (BertForMaskedLM)
Number of layers4
Hidden size312
Attention heads12
Intermediate size1248
Vocabulary size21128
Max sequence length512
Activation functionGELU
LanguageTraditional Chinese (zh)

For details: ckiplab/ckip-transformers

ONNX format

Export was performed using torch.onnx.export with dynamic axes for batch and sequence length.

Files:

  • —model.onnx – full model (encoder + pooler)
  • —config.json – model configuration

Usage

python
import onnxruntime as ort
import numpy as np

session = ort.InferenceSession("model.onnx")
inputs = {
    "input_ids": np.array([[101,  ... , 102]], dtype=np.int64),
    "attention_mask": np.array([[1, ..., 1]], dtype=np.int64),
    "token_type_ids": np.array([[0, ..., 0]], dtype=np.int64),
}
outputs = session.run(None, inputs)

License

The original model is distributed under GPL-3.0. This ONNX export is provided under Apache License 2.0.