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

Cannot use Quantize layer and use abstract class and methods

Open dhruven-god opened this issue 1 year ago • 1 comments

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')
image

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 avatar Feb 26 '24 15:02 dhruven-god

@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.

tucan9389 avatar Apr 01 '24 00:04 tucan9389