-
Notifications
You must be signed in to change notification settings - Fork 327
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
Did not support <class 'tensorflow.python.keras.layers.normalization_v2.BatchNormalization'>
?
#165
Comments
Addressing this in PR. Are you using TF 2.X? The library has not been fully tested with TF 2.X yet. See this issue to follow. |
Added support in this commit. Note that it hasn't been release yet in the pip package and you will currently need to build the package from source until the next release (0.2.0). |
@alanchiao thanks, I'll try it. |
@alanchiao Hi, after I build the package from source latest, it raises another error: |
Hi Shiwei, you'll need to share the model building code or a minimal reproducible example for me to figure out the issue. See New Issue > Bug for the kind of information that is needed. There may be a compatibility issue with 2.X. That is something I'm actively working on and if you share a minimal reproducible example, I may be able to ensure that it works for your case. If you are using custom Keras layer, you should look at these docs: https://www.tensorflow.org/model_optimization/guide/pruning/train_sparse_models#prune_a_custom_layer |
Let me know if it ends up being a custom Keras layer issue. In that case, we may able to improve the error message to make easier for users like yourself in the future. |
@Xhark : FYI Jaehong on potential 2.X compatibility issue we should try to resolve. |
Hi, @alanchiao , here is my code:
and when I run this, raise error:
My tensorflow version: 2.0.0 |
If you use keras layers version of multiply, sigmoid, expand_dims (reshape), then it'll works.
I'm not so sure this model also works well with your saved model. |
@alanchiao it works and load my saved model successfully too. But the result of this model have a little bit difference compare with original model. Anyway, thanks for your help again. |
@alanchiao I have optimize model for 5 epochs, and the params I used is this:
After I finish this, the pruning model saved and convert it to .pb file to test inference time, but the time cost is as same as the non-pruning original model, so, what's happend in prunning func? Thanks~ |
The latency should be equivalent, as described here https://www.tensorflow.org/model_optimization/guide/pruning#overview. If you follow #173, you can see when framework support will be released, resulting in latency improvements. |
I follow the guide here and want to prune mine own model, and raise error like this:
ValueError: Please initialize
Prunewith a supported layer. Layers should either be a
PrunableLayerinstance, or should be supported by the PruneRegistry. You passed: <class 'tensorflow.python.keras.layers.normalization_v2.BatchNormalization'>
The text was updated successfully, but these errors were encountered: