keras-team / keras

Deep Learning for humans
http://keras.io/
Apache License 2.0
61.92k stars 19.45k forks source link

Is QAT supported in Keras 3.0 for TFLite Quantisation? #18930

Closed tarushbansal closed 8 months ago

tarushbansal commented 10 months ago

I couldn't find any mention of Quantisation Aware Training in the Keras 3 API documentation. Is it possible to convert the current Keras 3.0 models into quantisation-aware models with quantisation nodes added for TFLite conversion after training? If not, are there any plans to include this support in the future?

SuryanarayanaY commented 10 months ago

Hi @tarushbansal ,

Have you seen this mobilevit tutorial that converts keras3 model into TFlite ? Is it what you are looking for ?

github-actions[bot] commented 10 months ago

This issue is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you.

tarushbansal commented 9 months ago

Hi @SuryanarayanaY, The mobilevit tutorial focuses on post-training quantisation instead. I am looking for a way to train the model in a quantisation aware setting just like previously supported by the TF Optimisation toolkit as in this example here.

SuryanarayanaY commented 8 months ago

Hi @tarushbansal ,

I am looking for a way to train the model in a quantisation aware setting just like previously supported by the TF Optimisation toolkit as in this example here.

The tutorial not working with Keras3. It seems Keras3 not yet supporting this feature. Escalating to Dev team for confirmation.

fchollet commented 8 months ago

This is not yet supported. However, Keras 3 will be adding its own QAT API in the near future.

google-ml-butler[bot] commented 8 months ago

Are you satisfied with the resolution of your issue? Yes No

matpalm commented 1 month ago

is QAT still on the roadmap @fchollet ?

have been porting code to keras3 ( as a way to move more to Jax ) & have options for post training quantisation but expect a non trivial benefit from QAT in a number of projects.

can see a path forward by partially porting pieces of https://www.tensorflow.org/model_optimization/api_docs/python/tfmot and/or https://github.com/google/aqt but will hold back if a QAT api is imminent ? ( additionally; might have some bandwidth to help if there are community contrib options? )