Open peri044 opened 4 years ago
Hello @nutsiepully , can you please provide any suggestions on this issue ? The code in the gist is mnist QAT example in the docs. Thank you
@peri044 Can you please try with below changes
with tfmot.quantization.keras.quantize_scope():
model = tf.keras.models.load_model('saved_model')
@peri044 - The code is working for me. Can you please try using tf-nightly
and try the code again? Also, consider using @joyalbin's snippet as well, though for saved_model
, it should just work.
Closing this for now since I was able to run the code without any issues, and it's likely a versioning issue.
Please feel free to reopen otherwise.
Thanks @nutsiepully. I faced this issue with TF2.2 version but now it works with 2.3rc2 version of TF.
Thanks @nutsiepully. I faced this issue with TF2.2 version but now it works with 2.3rc2 version of TF.
Are you sure? env: TF2.3rc2, it doesn't works .
@Wangyf46 Yeah. It works for me on 2.3.0-rc2
Is there any workaround for tf 2.2 for this? I am using conda to install tensorflow and currently only version 2.2 is available for linux.
This issue is happening for me on tf 2.4.1:
`with tfmot.quantization.keras.quantize_scope(): model = tf.keras.models.load_model('saved_model')
KeyError Traceback (most recent call last)
Thanks @thecosta. We are investigating this.
I have the same issue on TF 2.3.2. I got the error: KeyError: '__inference_expanded_conv_depthwise_layer_call_fn_31750316'
Get same issue on TF 2.2.0, 2.7.0.
@Janus-Shiau @nutsiepully I've got the same issue on TF 2.7.0. but the solution proposed by @joyalbin works for me just fine.
See two lines below.
with tfmot.quantization.keras.quantize_scope():
model = tf.keras.models.load_model('saved_model')
Describe the bug Unable to load the saved model after applying quantization aware training.
System information
TensorFlow version (installed from source or binary): 2.2 TensorFlow Model Optimization version (installed from source or binary): 0.3.0
Code to reproduce the issue Please find the gist of the code here https://gist.github.com/peri044/00a477b73d01bd08ef3410c15679a91c#file-sample-py-L47
Error occurs at
tf.keras.models.load_model()
function. If I replace this withtf.saved_model.load()
, I see the same error too. Any suggestions are appreciated. Thank you !! Error :