bash
## 安装依赖
python -m venv convert_to_onnx
source convert_to_onnx/bin/activate
pip install optimum-onnx
## 配置网络环境
echo $http_proxy
export http_proxy=127.0.0.1:7897
export https_proxy=127.0.0.1:7897
## 下载模型
mkdir convert_model
cd convert_model
sudo apt-get install git-lfs
git lfs install
git clone https://huggingface.co/Qwen/Qwen1.5-0.5B
## 转换成onnx格式,这个格式只是适合onnx runtime运行的,没有为相应后端做算子拆分和融合
optimum-cli export onnx --model /home/dean/convert_model/Qwen1.5-0.5B --task text-generation Qwen/Qwen1.5-0.5B/