huggingface / exporters

Export Hugging Face models to Core ML and TensorFlow Lite
Apache License 2.0
622 stars 46 forks source link

Unable to convert mobileBERT model #80

Open VarshithaCVasireddy opened 4 months ago

VarshithaCVasireddy commented 4 months ago
  1. Firstly I tried converting my fine-tuned MobileBERT model, but was got the below error

**Validating Core ML model...

The code used python -m exporters.coreml --model="./Trained Models/Mobile-BERT/fine_tuned_mobileBERT" --feature="text-classification" output_model.mlpackage

  1. When trying to convert the Google's mobileBERT got the below error

** Validating Core ML model... -[✓] Core ML model output names match reference model ({'last_hidden_state', 'pooler_output'})

ValueError: Output values do not match between reference model and Core ML exported model: Got max absolute difference of: nan**

Code as below python -m exporters.coreml --model=google/mobilebert-uncased exported/

  1. When used quantize to float32, that worked well

Below is the code

python -m exporters.coreml --model="./Trained Models/Mobile-BERT/fine_tuned_mobileBERT" --feature="text-classification" --quantize float32 output_model_quantized.mlpackage

Can you please help me on how to solve this problem.