model-optimization icon indicating copy to clipboard operation
model-optimization copied to clipboard

TypeError: tf__call() got an unexpected keyword argument 'y'

Open qiyangzhang0329 opened this issue 5 years ago • 2 comments

Describe the bug When I use the API "tfmot.quantization.keras.quantize_model", there is a bug.I guess that some layers in mobilenetV3 do not support quantization operations, such as the lamba layer. I wonder if you have encountered it?

System information

I am using TensorFlow 2.5 with Python 3.6 I have pip-installed TF2.4 within an anaconda environment.

Code to reproduce the issue import tensorflow as tf assert float(tf.version[:3]) >= 2.3 config = tf.compat.v1.ConfigProto() config.gpu_options.allow_growth = True session = tf.compat.v1.InteractiveSession(config=config) import tensorflow.keras as keras import pathlib import numpy as np import tensorflow_model_optimization as tfmot from tensorflow.keras.preprocessing.image import ImageDataGenerator

origin_model = tf.keras.applications.MobileNetV3Small( input_shape=(224, 224, 3), alpha=1.0, include_top=True, weights='imagenet', input_tensor=None, pooling=None, classes=1000, classifier_activation='softmax' ) quant_aware_model = tfmot.quantization.keras.quantize_model(origin_model) quant_aware_model.compile(optimizer=tf.keras.optimizers.RMSprop(lr=0.00001), # 0.045, momentum=0.9, decay=0.98), loss='sparse_categorical_crossentropy', metrics=['accuracy'])

Screenshots image

thanks in advance.

qiyangzhang0329 avatar Jun 06 '21 01:06 qiyangzhang0329

I have the same problem, however there is already an open issue here: https://github.com/tensorflow/model-optimization/issues/546

Arturjssln avatar Jun 07 '21 16:06 Arturjssln

Let discuss in https://github.com/tensorflow/tensorflow/issues/50079

rino20 avatar Jun 11 '21 05:06 rino20