-
Notifications
You must be signed in to change notification settings - Fork 326
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
Keras layer wrappers don't supported #6
Comments
Hi. Can you please include the snippet of code you're using to create the model? |
I m sorry, the problem is associated with TimeDistributed wrapper around DepthwiseConv2D in Tensorflow >= 1.13 (issue #29438), i.e. tensorflow >= 1.14 is required to run tensorflow-model-optimization. Code example: from tensorflow.keras import backend as K
from tensorflow_model_optimization.sparsity import keras as sparsity
import tensorflow as tf
K.set_image_data_format("channels_first")
print(K.image_data_format())
pruning_params = {
'pruning_schedule': sparsity.PolynomialDecay(initial_sparsity=0.50,
final_sparsity=0.90,
begin_step=2000,
end_step=4000,
frequency=100)
}
l = tf.keras.layers
model = tf.keras.Sequential([
l.TimeDistributed(sparsity.prune_low_magnitude(
l.DepthwiseConv2D(depth_multiplier=1,
kernel_size=(1, 4),
strides=(1, 1)), **pruning_params),
input_shape=(None, 1, 128, 8))
]) However, the TimeDistributed layer is not supported by model = tf.keras.Sequential([
sparsity.prune_low_magnitude(l.TimeDistributed(
l.DepthwiseConv2D(depth_multiplier=1,
kernel_size=(1, 4),
strides=(1, 1)),
input_shape=(None, 1, 128, 8)),**pruning_params)
])
|
same problem here with Timedistribute layer in model optimization. any progress? |
Similarly, I see this issue for the ClusterRegistry,
|
Hi @nutsiepully, can you update? |
It's intended behavior. The pruning wrapper currently doesn't check recursively for prunable layers. Since you have a work-around of adjusting the order of wrappers, will close this for now. Thanks! |
I am encountering this error in my machine learning model. Any idea?? ModuleNotFoundError Traceback (most recent call last) ModuleNotFoundError: No module named 'tensorflow.keras.wrappers' |
An current layer of Keras is not supported:
ValueError: Please initialize
Prune
with a supported layer. Layers should either be aPrunableLayer
instance, or should be supported by the PruneRegistry. You passed: <class 'tensorflow.python.keras.layers.wrappers.TimeDistributed'>The text was updated successfully, but these errors were encountered: