Error during Caffe model conversion with Python3.8 (#6056)

* added one more possible reason for Caffe error during caffemodel parser in code + add error description to FAQ
Also added MxNet error to FAQ based on Kate Generalova wording

* review fixes

* wording polishing

* wording polishing

* review fixes

* review fixes

* Update docs/MO_DG/prepare_model/Model_Optimizer_FAQ.md

Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>

* Update docs/MO_DG/prepare_model/Model_Optimizer_FAQ.md

Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>

* Update docs/MO_DG/prepare_model/Model_Optimizer_FAQ.md

Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>

* Update docs/MO_DG/prepare_model/Model_Optimizer_FAQ.md

Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>

* review fixes

Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>
This commit is contained in:
Svetlana Dolinina 2021-06-08 16:09:04 +03:00 committed by GitHub
parent 9e34622ac1
commit de2a163363
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 2 deletions

View File

@ -627,4 +627,16 @@ It means that you trying to convert the topology which contains '_contrib_box_nm
});
</script>
\endhtmlonly
\endhtmlonly
#### 103. What does the message "ModelOptimizer is not able to parse *.caffemodel" mean? <a name="question-103"></a>
If a '*.caffemodel' file exists and it is correct, the error possibly occured due to the use of Python protobuf implementation. In some cases, it shows error message during model parsing, for example: "'utf-8' codec can't decode byte 0xe0 in position 4: invalid continuation byte in field: mo_caffe.SpatialTransformerParameter.transform_type". You can either use Python 3.6/3.7 or build 'cpp' implementation of protobuf yourself for your version of Python. For the complete instructions about building `protobuf` from sources, see the appropriate section in [Converting a Model to Intermediate Representation](Config_Model_Optimizer.md).
#### 104. What does the message "SyntaxError: 'yield' inside list comprehension" during MxNet\* model conversion mean? <a name="question-104"></a>
The issue "SyntaxError: 'yield' inside list comprehension" might occur during converting MXNet\* models (mobilefacedet-v1-mxnet, brain-tumor-segmentation-0001) on Windows* platform with Python* 3.8 environment. This issue is caused by API changes for `yield expression` in Python 3.8.
The following workarounds are suggested to resolve this issue:
1. Use Python 3.6/3.7 to convert MXNet\* models on Windows
2. Update MXNet: pip install mxnet=1.7.0.post2
Note that you might have conflicts between previously installed PyPI dependencies.

View File

@ -130,10 +130,16 @@ def load_caffe_proto_model(caffe_pb2, proto_path: str, model_path: [str, None] =
map = mmap.mmap(infile.fileno(), 0, access=mmap.ACCESS_READ)
model.MergeFromString(map)
except Exception as e:
third_point = ''
if api_implementation._implementation_type == 'python':
third_point = ' 3. Python protobuf implementation was used. Some models can\'t be converted ' + \
' in this configuration. Please, use Python version with existing cpp implementation of ' + \
'protobuf library or build it by yourself\n' + refer_to_faq_msg(103)
log.error('Exception message: {}\n\n'.format(e) +
' Possible reasons:\n' +
' 1. {} does not exist\n'.format(model_path) +
' 2. {} does not have a valid structure\n'.format(model_path), extra={'framework_error': True})
' 2. {} does not have a valid structure\n'.format(model_path) + third_point,
extra={'framework_error': True})
raise FrameworkError('Model Optimizer is not able to parse {}'.format(model_path)) from e
return proto, model