Comments (7)
Hi. Can you please include the snippet of code you're using to create the model?
Thanks
from model-optimization.
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 sparsity.prune_low_magnitude()
when the model is changed as shown below:
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)
])
ValueError: Please initialize `Prune` with a supported layer. Layers should either be a `PrunableLayer` instance, or should be supported by the PruneRegistry. You passed: <class 'tensorflow.python.keras.layers.wrappers.TimeDistributed'>
from model-optimization.
same problem here with Timedistribute layer in model optimization. any progress?
from model-optimization.
Similarly, I see this issue for the ClusterRegistry,
"ValueError: Please initialize `Cluster` with a supported layer. Layers should either be a `ClusterableLayer` instance, or should be supported by the ClusteringRegistry. You passed: <class 'tensorflow.python.keras.engine.sequential.Sequential'>
from model-optimization.
Hi @nutsiepully, can you update?
from model-optimization.
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!
from model-optimization.
I am encountering this error in my machine learning model. Any idea??
ModuleNotFoundError Traceback (most recent call last)
Cell In[1], line 49
47 from keras.callbacks import EarlyStopping
48 import random
---> 49 from tensorflow.keras.wrappers.scikit_learn import KerasRegressor
56 #from tensorflow.keras.wrappers.scikit_learn import KerasRegressor
57 from sklearn.ensemble import RandomForestRegressor, GradientBoostingRegressor
ModuleNotFoundError: No module named 'tensorflow.keras.wrappers'
from model-optimization.
Related Issues (20)
- batch norm layer quantization error HOT 2
- 16x8 Quantization fails for RNN model - Max and min for dynamic tensors should be recorded during calibration HOT 4
- float16 quantization runs out of memory for LSTM model HOT 3
- float16 quantization runs out of memory for LSTM model HOT 1
- Add a default PruningPolicy that filters out any layers not supported by the API HOT 1
- Add batch norm to default_n_bit_quantize_registry and default_8_bit_quantize_registry HOT 2
- Quant aware training in tensorflow model optimization HOT 4
- [COLAB] No module named 'tensorflow_model_optimization' HOT 1
- Module Import Error HOT 2
- A error about quantization aware training HOT 2
- MobileNetV3 QAT TFLite Conversion Issue HOT 4
- Error in MovingAverageQuantizer with per_axis=True due to missing parameters in _add_range_weights
- strange behavior when quantizing a model. HOT 2
- Support for Recurrent layers for Quantization Aware Training. HOT 1
- Can't use TFMOT version 0.8.0 due to missing dependency HOT 1
- Any plans to support keras3? HOT 3
- Cannot use Quantize layer and use abstract class and methods HOT 1
- Custom layer with Concat afterwards causes an error during QAT modeling HOT 3
- Failed quantization of dilated convolution layers: tensorflow or tensorflow-model-optimization bug?
- Per-tensor QAT model Conv2d+BN+relu folding issue
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from model-optimization.