Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tfjs-converter types_pb2.DataType has no attribute DT_FLOAT #2076

Closed
kemio opened this issue Sep 20, 2019 · 3 comments
Closed

tfjs-converter types_pb2.DataType has no attribute DT_FLOAT #2076

kemio opened this issue Sep 20, 2019 · 3 comments
Assignees
Labels
duplicate This issue or pull request already exists

Comments

@kemio
Copy link

kemio commented Sep 20, 2019

TensorFlow.js version

tensorflowjs_coverter 1.2.9 at Colab with Python3

Describe the problem or feature request

Get the following error:

Traceback (most recent call last):
  File "/usr/local/bin/tensorflowjs_converter", line 6, in <module>
    from tensorflowjs.converters.converter import pip_main
  File "/usr/local/lib/python3.6/dist-packages/tensorflowjs/__init__.py", line 21, in <module>
    from tensorflowjs import converters
  File "/usr/local/lib/python3.6/dist-packages/tensorflowjs/converters/__init__.py", line 24, in <module>
    from tensorflowjs.converters.tf_saved_model_conversion_v2 import convert_tf_saved_model
  File "/usr/local/lib/python3.6/dist-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py", line 41, in <module>
    from tensorflowjs.converters import fuse_prelu
  File "/usr/local/lib/python3.6/dist-packages/tensorflowjs/converters/fuse_prelu.py", line 200, in <module>
    register_prelu_op()
  File "/usr/local/lib/python3.6/dist-packages/tensorflowjs/converters/fuse_prelu.py", line 42, in register_prelu_op
    value.list.type.extend([types_pb2.DataType.DT_FLOAT])
AttributeError: 'EnumTypeWrapper' object has no attribute 'DT_FLOAT'

Code to reproduce the bug / link to feature request

!sudo pip3 install tensorflowjs
Then:
!sudo tensorflowjs_converter
or
!sudo tensorflowjs_converter --input_format=tfjs_layers_model --output_format=keras /content/mydrive/MeLi/as.m5/model.json as.m5.h5

@gitathrun
Copy link

Same problem here, after I install tensorflowjs, this problem happens when I import the library

import tensorflowjs

errors:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-5-ff9028db9621> in <module>()
----> 1 import tensorflowjs

4 frames
/usr/local/lib/python3.6/dist-packages/tensorflowjs/__init__.py in <module>()
     19 
     20 # pylint: disable=unused-imports
---> 21 from tensorflowjs import converters
     22 from tensorflowjs import quantization
     23 from tensorflowjs import version

/usr/local/lib/python3.6/dist-packages/tensorflowjs/converters/__init__.py in <module>()
     22 from tensorflowjs.converters.keras_tfjs_loader import deserialize_keras_model
     23 from tensorflowjs.converters.keras_tfjs_loader import load_keras_model
---> 24 from tensorflowjs.converters.tf_saved_model_conversion_v2 import convert_tf_saved_model

/usr/local/lib/python3.6/dist-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py in <module>()
     39 from tensorflowjs.converters import common
     40 from tensorflowjs.converters import fold_batch_norms
---> 41 from tensorflowjs.converters import fuse_prelu
     42 
     43 # enable eager execution for v2 APIs

/usr/local/lib/python3.6/dist-packages/tensorflowjs/converters/fuse_prelu.py in <module>()
    198     prelu_fn(tf.constant(1.0), tf.constant(1.0))
    199 
--> 200 register_prelu_op()

/usr/local/lib/python3.6/dist-packages/tensorflowjs/converters/fuse_prelu.py in register_prelu_op()
     40 
     41   value = attr_value_pb2.AttrValue()
---> 42   value.list.type.extend([types_pb2.DataType.DT_FLOAT])
     43   attr = op_def_pb2.OpDef.AttrDef()
     44   attr.name = 'T'

AttributeError: 'EnumTypeWrapper' object has no attribute 'DT_FLOAT'

So, what is the problem here, is protobuf got any major upgrade?

@rthadur rthadur self-assigned this Sep 23, 2019
@rthadur rthadur added the duplicate This issue or pull request already exists label Sep 23, 2019
@rthadur
Copy link
Contributor

rthadur commented Sep 23, 2019

This was fixed already and will see the changes in next release , please refer to similar issue here. Thank you

@rthadur rthadur closed this as completed Sep 23, 2019
@rajumgokak
Copy link

!sudo pip3 install tensorflowjs

Then:

!sudo tensorflowjs_converter

just replace model.h5 with your trained weight
!tensorflowjs_converter --input_format=keras '/content/drive/MyDrive/model.h5' "/content/drive/MyDrive/json"

you are good to go your file will me converted !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants