tensorflow / tensorflow/model-optimization
AttributeError: 'NoOpActivation' object has no attribute '__name__'
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.6k
- Forks
- 349
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 1
Description
Traceback (most recent call last):
File "train_mobilenetv2_quantization.py", line 368, in
base_model = quantize_model(base_model)
File "/home/huangfei/anaconda3/envs/ImageSearch2/lib/python3.6/site-packages/tensorflow_model_optimization/python/core/quantization/keras/quantize.py", line 138, in quantize_model
return quantize_apply(annotated_model)
File "/home/huangfei/anaconda3/envs/ImageSearch2/lib/python3.6/site-packages/tensorflow_model_optimization/python/core/quantization/keras/quantize.py", line 410, in quantize_apply
unwrapped_model, layer_quantize_map)
File "/home/huangfei/anaconda3/envs/ImageSearch2/lib/python3.6/site-packages/tensorflow_model_optimization/python/core/quantization/keras/default_8bit/default_8bit_quantize_layout_transform.py", line 73, in apply
set(layer_quantize_map.keys()), layer_quantize_map).transform()
File "/home/huangfei/anaconda3/envs/ImageSearch2/lib/python3.6/site-packages/tensorflow_model_optimization/python/core/quantization/keras/graph_transformations/model_transformer.py", line 529, in transform
copy.deepcopy(match_layer_node))
File "/home/huangfei/anaconda3/envs/ImageSearch2/lib/python3.6/site-packages/tensorflow_model_optimization/python/core/quantization/keras/default_8bit/default_8bit_transforms.py", line 250, in replacement
return self._replace(relu_layer_node, bn_layer_node, conv_layer_node)
File "/home/huangfei/anaconda3/envs/ImageSearch2/lib/python3.6/site-packages/tensorflow_model_optimization/python/core/quantization/keras/default_8bit/default_8bit_transforms.py", line 239, in _replace
keras.activations.serialize(quantize_aware_activation.NoOpActivation())
File "/home/huangfei/anaconda3/envs/ImageSearch2/lib/python3.6/site-packages/tensorflow/python/keras/activations.py", line 287, in serialize
if activation.name in _TF_ACTIVATIONS_V2:
AttributeError: 'NoOpActivation' object has no attribute 'name'
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the _replace method in tensorflow_model_optimization/python/core/quantization/keras/default_8bit/default_8bit_transforms.py and follow the call to keras.activations.serialize shown in the traceback. Reproduce the MobileNetV2 quantization failure, then verify that quantization no longer raises the NoOpActivation name AttributeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- keras, python, tensorflow
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100