tensorflow / tensorflow/model-optimization

How to apply tfmot to a non tf.keras.Model type model..

Open
#968 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
Dominant language
Python
Stars
1.6k
Forks
349
Avg merge
3d 2h
Merged PRs (30d)
1

Description

Hi,
This is more of a question than a feature request which I don't know where else to post.
So I'm trying to perform quantization aware training to a model that's not of tf.keras.Model type but of a wrapper Model class with some forward(), loss(), and trainable_variables() functions and some layers of tf.keras.Layer() type. The backpropagation is done with tf.GraientTape and optimizer.apply_gradients() outside this Model class.
Is this possible to do? I was thinking perhaps with some lower-level functions I can find in this repo this is doable but can't say for sure and don't really know how much work it would be. Would be great if I can get some advice directly from the developers.
Thank you very much.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the TensorFlow Model Optimization Toolkit quantization-aware training APIs and their tf.keras.Model and tf.keras.Layer integration points. Compare those with the wrapper's forward(), loss(), trainable_variables(), GradientTape, and optimizer.apply_gradients() flow. Done would be a documented supported path or a clear statement that this model type is unsupported.

Written by the indexing model from the issue text.

Assessment

Tech stack
keras, python, tensorflow
Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.