tensorflow / tensorflow/model-optimization

Issue loading model with Conv2DTranspose

Open
#751 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug
When loading a saved model (.h5 format and SaveModel format) with a Conv2DTranspose layer, there is an error.

System information

TensorFlow version (installed from source or binary): 2.4.2

TensorFlow Model Optimization version (installed from source or binary): 0.6

Python version: 3.7

Describe the expected behavior
The model should be loading

Describe the current behavior
The model does not load. Error message with .h5 model:

ValueError: Unknown object: Default8BitConvTransposeQuantizeConfig

Error Message using SaveModel format:

KeyError: '__inference_semseg/upsample_4/conv2dtranspose_layer_call_fn_123124420'

I am loading the model such as:

with tfmot.quantization.keras.quantize_scope():
    model = tf.keras.models.load_model(args.model_path, compile=False)

Additional Information*
I am not completely confident if Conv2DTranspose is fully supported officially. I could not find a clear docu about supported layers. If it is not, then it might make sense to inform the user about it during training.

semseg_model_fails_to_load.zip

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

Reproduce the failure using the attached semseg_model_fails_to_load.zip and the reported TensorFlow 2.4.2 and TensorFlow Model Optimization 0.6 setup. Start with tfmot.quantization.keras.quantize_scope() and tf.keras.models.load_model() for both H5 and SavedModel formats. Done means Conv2DTranspose models load successfully, or unsupported-layer behavior is clearly reported during training or loading.

Written by the indexing model from the issue text.

Assessment

Tech stack
keras, python, tensorflow
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.