diff --git a/x2paddle/convert.py b/x2paddle/convert.py index ff03af888e78d4547e5ba68d44486de0758c7d67..7e2c2735815449c1bc03d4484eef754a1c62e835 100644 --- a/x2paddle/convert.py +++ b/x2paddle/convert.py @@ -129,9 +129,12 @@ def caffe2paddle(proto, weight, save_dir, caffe_proto): from x2paddle.op_mapper.caffe_op_mapper import CaffeOpMapper from x2paddle.optimizer.caffe_optimizer import CaffeOptimizer import google.protobuf as gpb - ver_str = gpb.__version__.replace('.', '') - ver_int = int(ver_str[0:2]) - assert ver_int >= 36, 'The version of protobuf must be larger than 3.6.0!' + ver_part = gpb.__version__.split('.') + version_satisfy = False + if (int(ver_part[0]) == 3 and int(ver_part[1]) >= 6) \ + or (int(ver_part[0]) > 3): + version_satisfy = True + assert version_satisfy, 'The version of protobuf must be larger than 3.6.0!' print("Now translating model from caffe to paddle.") model = CaffeDecoder(proto, weight, caffe_proto) mapper = CaffeOpMapper(model)