3. t2t_vit inference
前言
对vit 进行fp16推理
参考链接:
https://github.com/open-mmlab/mmpretrain/tree/master/configs/t2t_vit
run code :
https://mmclassification.readthedocs.io/en/latest/getting_started.html#inference-and-test-a-dataset
https://mmclassification.readthedocs.io/en/latest/tools/pytorch2onnx.html?highlight=onnx
run code and convert onnx
# run acc
python3 tools/test.py configs/t2t_vit/t2t-vit-t-14_8xb64_in1k.py ./t2t-vit-t-14_8xb64_in1k_20211220-f7378dd5.pth --metrics accuracy --out result.pkl 2>&1 | tee test_run.log# convert onnx , bs=1
pip install onnx onnxsim
python3 tools/deployment/pytorch2onnx.py \configs/t2t_vit/t2t-vit-t-14_8xb64_in1k.py \--checkpoint ./t2t-vit-t-14_8xb64_in1k_20211220-f7378dd5.pth \--output-file ./t2t-vit-t-14.onnx 2>&1 | tee test_onnx.log# simplify
onnxsim t2t-vit-t-14.onnx t2t-vit-t-14-