Custom_Layer Quantization with custom training (QAT)
@Xhark 已经在做这个了。
开始于 2023年8月15日。
评估
这个 Issue 还没有评估数据。
描述
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
- 主要语言
- Python
- 星标
- 1.6k
- 派生
- 349
- 平均合并
- 3 天 2 小时
- 30 天内合并 PR
- 1
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
tensorflow/model-optimization 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
tensorflow/model-optimization#1301 · 1 条评论 ·
-
bug
难度 4/5 3-5 天 新手友好度 48/100
tensorflow/model-optimization#1272 ·
-
bug
难度 3/5 1-2 天 新手友好度 50/100
tensorflow/model-optimization#1270 · 2 条评论 ·
-
bug
难度 2/5 1-3 小时 新手友好度 48/100
tensorflow/model-optimization#1241 ·
-
bug
难度 4/5 3-5 天 新手友好度 35/100
tensorflow/model-optimization#1182 · 1 条评论 ·
查看 tensorflow/model-optimization 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
stephrobert/dsoxlab#238 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100
sublimehq/package_control#1780 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 70/100
nwg-piotr/nwg-displays#145 ·