Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to convert mobileBERT model #80

Open
VarshithaCVasireddy opened this issue Jul 2, 2024 · 0 comments
Open

Unable to convert mobileBERT model #80

VarshithaCVasireddy opened this issue Jul 2, 2024 · 0 comments

Comments

@VarshithaCVasireddy
Copy link

VarshithaCVasireddy commented Jul 2, 2024

  1. Firstly I tried converting my fine-tuned MobileBERT model, but was got the below error

Validating Core ML model...
- Core ML model is classifier, validating output
-[x] predicted class 'LABEL_0' doesn't match 'LABEL_3'
ValueError: Predicted class doesn't match between reference model and Core ML exported model: Got LABEL_3 (reference) and LABEL_0 (Core ML)

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'})
- Validating Core ML model output "last_hidden_state":
-[✓] (1, 128, 512) matches (1, 128, 512)
-[x] values not close enough (atol: 0.0001)

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant