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
Question about exporting an integer-only MobileBERT to TF-Lite format. #325
Comments
That's interesting, can you update to the latest tf-nightly and try again? We're counting on the new quantizer. thanks |
Hi @renjie-liu,
BTW, does it mean "counting on the new quantizer" to use tensorflow 2.x converter? Regards, |
Can you help take a look? Thanks |
I think the real issue is the model trained in 1.x world but the quantization needs 2.x. (it's easier for us to do internally) @saberkun we probably need to migrate mobilebert to 2.x asap. wdyt? |
I think we already removed all tf.contrib usage. The code could probably run with TF1 compatible mode with tf.comat.v1.disable_v2_behavior. https://www.tensorflow.org/api_docs/python/tf/compat/v1/disable_v2_behavior @nadongguri Would you try tf 2.x and adding tf.comat.v1.disable_v2_behavior() in main()? |
Hi @saberkun,
Do I remove code that uses the contrib package? (contrib_layers and quantize method only) Also, you provide saved model files for float and quantized type so I tested quantized saved model file with toco in tf 1.15 but I got an error message during conversion.
Regards, |
I modified the run_squad.py script to remove the contrib module in order to export a quantized tflite model file in tf 2.4.0-dev20200712 version.
|
Can someone please clarify :
Are both the above steps required to get the quantized int8 savedmodel or just the step 2 with pre-trained model will give the quantized int8 model? |
Hi all, |
I think this (88.54) matches the expectation. |
Thanks, I'll close this issue. |
Hi, @nadongguri , I'm having the exact issue you had as the following:
What did you do exactly on modifying run_squad.py? thanks. |
Hi, I'm trying to export a mobilebert model to tflite format.
Environment
Docker (tensorflow/tensorflow:1.15.0-gpu-py3) image
V100 16GB
As guided in README.md., I followed "Run Quantization-aware-training with Squad" then "Export an integer-only MobileBERT to TF-Lite format." However, I got an error while converting to quantized tflite model.
I used pre-trained weights (uncased_L-24_H-128_B-512_A-4_F-4_OPT) that mentioned in README.md.
Is it required to distillation process before quantization-aware-training?
Regards,
Dongjin.
The text was updated successfully, but these errors were encountered: