google-ai-edge / ai-edge-torch

Supporting PyTorch models with the Google AI Edge TFLite runtime.
Apache License 2.0
282 stars 37 forks source link

Support torch QAT model export? #178

Closed WangFengtu1996 closed 2 days ago

WangFengtu1996 commented 2 weeks ago

Description of the Feature:

torch QAT supports three mode.

which mode is supprted by ai-edge-torch ? thkx

pkgoogle commented 2 weeks ago

Hi @WangFengtu1996, we are actively working on supporting more modes/recipes .. currently for PT Converter we support P2TE and original TFLite quantization: https://github.com/google-ai-edge/ai-edge-torch/blob/main/docs/pytorch_converter/README.md#quantization

For the generative API we support this: https://github.com/google-ai-edge/ai-edge-torch/tree/main/ai_edge_torch/generative/quantize

Does that answer your question?

WangFengtu1996 commented 2 weeks ago

@pkgoogle
I need some support about Quantization Aware Training, not Post Training Quantization. Because the accuracy is too low by using Post Training Quantization.

pkgoogle commented 2 weeks ago

I am unsure if that is fully supported... I have found some resources which I think you can combine w/ the original TFLite Quantization above:

https://www.tensorflow.org/model_optimization/guide/quantization/training

You may need to change some steps to adjust for this workflow (which didn't exist at the time of the above documentation writing). Like you may want to switch to keras3 with PyTorch backend in the above steps and then attempt to use original TFLite Quantization.

github-actions[bot] commented 1 week ago

Marking this issue as stale since it has been open for 7 days with no activity. This issue will be closed if no further activity occurs.

github-actions[bot] commented 2 days ago

This issue was closed because it has been inactive for 14 days. Please post a new issue if you need further assistance. Thanks!