Closed jbmaxwell closed 4 years ago
Just as an update, I trained and converted the current huggingface distilBert model and have the same error.
Quick update. The above issue can be solved by modifying the mlmodel after conversion (see: https://github.com/huggingface/swift-coreml-transformers/issues/16#issuecomment-592153661). However, there seems to be a more general problem with MLM. Converting the standard Bert model completes successfully with opset v10, but DistilBert appears to require opset v11 (float input support for Equal
). Though it completes, the converted standard Bert model gives incorrect output in Xcode (when compared to PyTorch). DistilBert, converted with opset v11, fails during mlmodel conversion, due to an unsupported Range
operator.
If anybody has been able to get MLM working for Bert, or DistilBert, on iOS, I'd greatly appreciate any help. But since my progress seems totally blocked, I'll close this issue for now.
I get the following error when running prediction on pytorch-pretrained-BERT (MLM), converted from ONNX. Both ONNX and CoreML conversion complete without errors. The specific error when running in Xcode is:
When running from python, I don't get the "Cannot squeeze" message, but do get
Error computing NN outputs
.Trace (python):
Conversion script:
System: Train: Ubuntu 18.04 coremltools==3.3 onnx==1.6.0 onnx-coreml==1.2 python 3.7 (anaconda)
Test: macOS 10.15.3 coremltools==3.3 python 3.7 (anaconda)