Notice: The name of INPUT in models can be viewed by model viewers, such as Netron.
-
Download BERT-model from BERT. BERT-tiny is downloaded as example.
-
Utilize the script export_bert.py to export
frozen_bert.pb
. -
Build Forward libraries refer to CMake-Build.
-DENABLE_TENSORFLOW=ON
,-DBUILD_PYTHON_LIB=ON
and-DPYTHON_EXECUTABLE=$(which python3)
should be specified. -
Copy Forward-Python library to this directory.
-
Run the python script
test_tf_bert.py
-
Install
transformers
andtorch
. -
Build Forward libraries refer to CMake-Build.
-DENABLE_TORCH=ON
,-DBUILD_PYTHON_LIB=ON
and-DPYTHON_EXECUTABLE=$(which python3)
should be specified. -
Copy Forward-Python library to this directory.
-
Run the python script
test_torch_bert.py
-
Install
transformers
and convert an ONNX model using thetransformers.onnx
package. The checkpointbert-base-uncased
is exported aspython -m transformers.onnx --model=bert-base-uncased bert.onnx
. -
Build Forward libraries refer to CMake-Build.
-DENABLE_ONNX=ON
,-DBUILD_PYTHON_LIB=ON
and-DPYTHON_EXECUTABLE=$(which python3)
should be specified. -
Copy Forward-Python library to this directory.
-
Run the python script
test_onnx_bert.py