tensorflow / tensorflow/model-optimization

Issue with loading quantization aware trained model

Open
#426 13 comments 1 reaction 1 assignee View on GitHub

@nutsiepully is already working on this.

Since Jun 12, 2020.

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

Description

Describe the bug
Unable to load the saved model after applying quantization aware training.

System information

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

Code to reproduce the issue
Please find the gist of the code here https://gist.github.com/peri044/00a477b73d01bd08ef3410c15679a91c#file-sample-py-L47

Error occurs at tf.keras.models.load_model() function. If I replace this with tf.saved_model.load(), I see the same error too. Any suggestions are appreciated. Thank you !!
Error :

model = tf_load.load_internal(path, loader_cls=KerasObjectLoader)
File "/home/dperi/Downloads/py3/lib/python3.6/site-packages/tensorflow/python/saved_model/load.py", line 604, in load_internal
export_dir)
File "/home/dperi/Downloads/py3/lib/python3.6/site-packages/tensorflow/python/saved_model/load.py", line 134, in _load_all
self._load_nodes()
File "/home/dperi/Downloads/py3/lib/python3.6/site-packages/tensorflow/python/saved_model/load.py", line 264, in _load_nodes
node, setter = self._recreate(proto, node_id)
packages/tensorflow/python/saved_model/load.py", line 398, in _recreate_function
proto, self._concrete_functions), setattr
File "/home/dperi/Downloads/py3/lib/python3.6/site-packages/tensorflow/python/saved_model/function_deserialization.py", line 265, in recreate_function
concrete_function_objects.append(concrete_functions[concrete_function_name])
KeyError: '__inference_conv2d_layer_call_and_return_conditional_losses_5068'

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.