luchangli03/onnxsim_large_model

maximum protobuf size of 2GB?

juntaosun opened this issue · 2 comments

python simplify_large_onnx.py -m my.onnx --save_extern_data 0 --skip 0

compress model success
simplify model success

`
uncompress model success
Traceback (most recent call last):
File "simplify_large_onnx.py", line 60, in
simplify_large_onnx(args)
File "simplify_large_onnx.py", line 40, in simplify_large_onnx
onnx.save(onnx_model, out_model_path, save_as_external_data=save_extern)

pytorch\lib\site-packages\onnx_init_.py", line 72, in _serialize
result = proto.SerializeToString()
ValueError: Message onnx.ModelProto exceeds maximum protobuf size of 2GB: 2275856217

`

保存失败,还是一样超过2GB报错。。汗~
如果--save_extern_data 将它打开,会生成两个文件

python simplify_large_onnx.py -m my.onnx --save_extern_data 0 --skip 0

compress model success simplify model success

` uncompress model success Traceback (most recent call last): File "simplify_large_onnx.py", line 60, in simplify_large_onnx(args) File "simplify_large_onnx.py", line 40, in simplify_large_onnx onnx.save(onnx_model, out_model_path, save_as_external_data=save_extern)

pytorch\lib\site-packages\onnx__init__.py", line 72, in _serialize result = proto.SerializeToString() ValueError: Message onnx.ModelProto exceeds maximum protobuf size of 2GB: 2275856217

`

保存失败,还是一样超过2GB报错。。汗~ 如果--save_extern_data 将它打开,会生成两个文件

看来你并不明白大于2GB的onnx本身就需要2个文件以单独存储权重才能支持!

虽然最新的ONNX看上去可以单个文件支持大于2GB存储,但是其他配套工具并没有支持这个特性。