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

TypeError: add_weight() got multiple values for argument 'name' #13540

Closed
wanitchayap opened this issue Nov 11, 2019 · 4 comments
Closed

TypeError: add_weight() got multiple values for argument 'name' #13540

wanitchayap opened this issue Nov 11, 2019 · 4 comments
Labels
type:support User is asking for help / asking an implementation question. Stackoverflow would be better suited.

Comments

@wanitchayap
Copy link

Hi I have this error and I am not sure why:

2019-11-10 19:28:49.105252: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-11-10 19:28:49.510154: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2400225000 Hz
2019-11-10 19:28:49.514852: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x5eed2e0 executing computations on platform Host. Devices:
2019-11-10 19:28:49.514902: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): Host, Default Version
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/wanitchaya/deepcut/deepcut/train.py", line 188, in train_model
    model = get_convo_nn2()
  File "/home/wanitchaya/deepcut/deepcut/model.py", line 57, in get_convo_nn2
    out = crf(x)
  File "/home/wanitchaya/.local/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 75, in symbolic_fn_wrapper
    return func(*args, **kwargs)
  File "/home/wanitchaya/.local/lib/python3.5/site-packages/keras/engine/base_layer.py", line 463, in __call__
    self.build(unpack_singleton(input_shapes))
  File "/home/wanitchaya/deepcut/deepcut/layers.py", line 182, in build
    constraint=self.kernel_constraint)
TypeError: add_weight() got multiple values for argument 'name'

System information

  • OS: Scientific Linux 7.2
  • TensorFlow backend (yes / no): Not sure
  • TensorFlow version: 2.0
  • Keras version: 2.3.1
  • Python version: 3.5.2

To reproduce this behavior
You can clone my github repo and go to the deepcut/deepcut directory. Then you can run this in python interpreter:

>>> import train
>>> train.train_model("cleaned_data", "../weight/model_crf_weight.h5")

Thank you so much for your help!

@sdeepak09
Copy link

I am also getting the same error. Please help us in this.

Thank you

@sdeepak09
Copy link

image

@sdeepak09
Copy link

Please go to https://github.com/wanitchayap/deepcut/blob/master/deepcut/layers.py and find the above snippet. In add_weight() function name the first arguments as 'shape' like:

self.kernel = self.add_weight(shape=(self.input_dim, self.units),
name='kernel',
initializer=self.kernel_initializer,
regularizer=self.kernel_regularizer,
constraint=self.kernel_constraint)

Do this in all your add_weight functions. Most likely you will get rid of this error. This has worked for me.

Thank you,
Deepak Singh

@Yasaman-Alavi
Copy link

I was getting the same error but your solution helped me to solve it :) tnx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:support User is asking for help / asking an implementation question. Stackoverflow would be better suited.
Projects
None yet
Development

No branches or pull requests

5 participants