model-optimization
model-optimization copied to clipboard
Cannot use Quantize layer and use abstract class and methods
I am trying to Quantize the whole model but whenever, I try to load the model using quantized scope it gives me error like this
import sys, os
import numpy as np
import tensorflow as tf
from tensorflow.keras.models import load_model
import tensorflow_model_optimization as tfmot
from tensorflow.keras.utils import CustomObjectScope
customObjects = {'DefaultQuantizeConfig': tfmot.quantization.keras.QuantizeConfig}
with tfmot.quantization.keras.quantize_scope(customObjects):
loaded_model = load_model('UpdtQuant.h5')
Also, when I try to define scope it gives me unknown value error: Quantize layer is not defined
Can someone help me with this issue?
@dhruven-god
Thanks for reporting.
Could you provide fully reproducible script? (colab is recommended or complete python script with tf, tfmot version specification is also fine)
If you can share your UpdtQuant.h5 model (or another model that can reproduce this error), it would be helpful.