Custom_Layer Quantization with custom training (QAT)
@Xhark ya está trabajando en esto.
Desde el 15/8/2023.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Describe the bug
Unable to quantize the custom layer to Int8 even after quantization.
System information
TensorFlow version (installed from source or binary): 2.15.0-dev20230814
TensorFlow Model Optimization version (installed from source or binary): 0.7.5
Python version: 3.10.12
Describe the expected behavior
Train a model which contains custom layer and export a quantise only the layer to int8 version for later to implement on an FPGA
accelerator.
Describe the current behavior
The custom layer which is supposed to be quantized always exports the un-quantized weights. If I change the tf.lite.OpsSet.TFLITE_BUILTINS to tf.lite.OpsSet.TFLITE_BUILTINS_INT8, the layer is getting quantized but the accuracy of the model is dropping from 99% to 9%. But I followed the QAT guid from as mentioned in the official website and the link to the colab notebook is provided below along with the custom layer code.
Code to reproduce the issue
Code
Additional context
I have used quantize_config while applying the quantization and passed the necessary elements through the scope. I have used tf.lite.OpsSet.SELECT_TF_OPS to enable tf.Extract_images through quantization.
Adder_Layer.txt
- Lenguaje dominante
- Python
- Estrellas
- 1.6k
- Forks
- 349
- Merge medio
- 3 d 2 h
- PR fusionados (30 d)
- 1
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de tensorflow/model-optimization
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
tensorflow/model-optimization#1301 · 1 comentario ·
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
tensorflow/model-optimization#1272 ·
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 50/100
tensorflow/model-optimization#1270 · 2 comentarios ·
-
build from source fails on macos Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 48/100
tensorflow/model-optimization#1241 ·
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
tensorflow/model-optimization#1182 · 1 comentario ·
Todos los issues de tensorflow/model-optimization
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
stephrobert/dsoxlab#238 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
sublimehq/package_control#1780 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
nwg-piotr/nwg-displays#145 ·