Mnn模型转换
Mnn代码里面可以将safetensor模型转换成mnn模型,命令如下: python3.13 llmexport.py --path model/gemma-3-4b-it --export mnn --dst_path model/gemma-3-4b-it-mnn --quant_bit 8 --mnnconvert MNNConvert
其中MNNConvert需要在Ubuntu下编译生成,所以该命令需要在Ubuntu下执行,当然在Windows上也是可以的,没有尝试过。
执行命令过程中,会发现需要安装许多python包,缺少哪个就安装哪个,python版本最好3.13,pip版本也是。
另外,pip安装可能太慢,使用镜像,如下:
pip3.13 install onnx -i https://pypi.tuna.tsinghua.edu.cn/simple/
常用国内镜像源(任选其一):
镜像源 地址
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
阿里云 https://mirrors.aliyun.com/pypi/simple/
豆瓣 https://pypi.douban.com/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/