question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running the One Shot Siamese Network produces ValueError: Trying to share variable image_path_1/fc_0/weights, but specified shape (46656, 128) and found shape (3136, 128)

See original GitHub issue

Describe the bug This is the error traceback log:

Traceback (most recent call last): File “/home/jai/anaconda3/bin/ludwig”, line 10, in <module> sys.exit(main()) File “/home/jai/anaconda3/lib/python3.6/site-packages/ludwig/cli.py”, line 108, in main CLI() File “/home/jai/anaconda3/lib/python3.6/site-packages/ludwig/cli.py”, line 64, in init getattr(self, args.command)() File “/home/jai/anaconda3/lib/python3.6/site-packages/ludwig/cli.py”, line 69, in experiment experiment.cli(sys.argv[2:]) File “/home/jai/anaconda3/lib/python3.6/site-packages/ludwig/experiment.py”, line 529, in cli experiment(**vars(args)) File “/home/jai/anaconda3/lib/python3.6/site-packages/ludwig/experiment.py”, line 219, in experiment **kwargs File “/home/jai/anaconda3/lib/python3.6/site-packages/ludwig/train.py”, line 336, in full_train debug=debug File “/home/jai/anaconda3/lib/python3.6/site-packages/ludwig/train.py”, line 483, in train debug=debug File “/home/jai/anaconda3/lib/python3.6/site-packages/ludwig/models/model.py”, line 113, in init **kwargs File “/home/jai/anaconda3/lib/python3.6/site-packages/ludwig/models/model.py”, line 163, in __build is_training=self.is_training File “/home/jai/anaconda3/lib/python3.6/site-packages/ludwig/models/inputs.py”, line 42, in build_inputs **kwargs) File “/home/jai/anaconda3/lib/python3.6/site-packages/ludwig/models/inputs.py”, line 69, in build_single_input **kwargs) File “/home/jai/anaconda3/lib/python3.6/site-packages/ludwig/features/image_feature.py”, line 378, in build_input is_training, File “/home/jai/anaconda3/lib/python3.6/site-packages/ludwig/models/modules/image_encoders.py”, line 89, in call is_training=is_training File “/home/jai/anaconda3/lib/python3.6/site-packages/ludwig/models/modules/fully_connected_modules.py”, line 136, in call ‘regularize’] else None File “/home/jai/anaconda3/lib/python3.6/site-packages/ludwig/models/modules/fully_connected_modules.py”, line 50, in fc_layer initializer=initializer File “/home/jai/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py”, line 1496, in get_variable aggregation=aggregation) File “/home/jai/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py”, line 1239, in get_variable aggregation=aggregation) File “/home/jai/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py”, line 562, in get_variable aggregation=aggregation) File “/home/jai/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py”, line 514, in _true_getter aggregation=aggregation) File “/home/jai/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py”, line 869, in _get_single_variable (name, shape, found_var.get_shape())) ValueError: Trying to share variable image_path_1/fc_0/weights, but specified shape (46656, 128) and found shape (3136, 128).

To Reproduce I tried to reproduce the example given in the documentation: https://uber.github.io/ludwig/examples/#one-shot-learning-with-siamese-networks

Used exactly the same model_definition.yaml and omniglot data. Ran the following command:

ludwig experiment \
--data_csv balinese_characters.csv \
  --model_definition_file model_definition.yaml

Environment

  • OS: Ubuntu
  • Version: 18.04
  • Python version: 3.6.6
  • Ludwig version: 0.16.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
w4nderlustcommented, Jan 22, 2020

No Sai, the error is due to sharing the parameters between the two branches of the siamese networks. He probably defined some fully connected weights in one branch and not in the other. Parameters of both the branches that are tied should be identical. @JaiKotia please share your model definition so that we can confirm but I’m pretty confident that’s the cause.

0reactions
JaiKotiacommented, Jan 24, 2020

@w4nderlust works fine now, thanks! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Running the One Shot Siamese Network produces ... - GitHub
ValueError : Trying to share variable image_path_1/fc_0/weights, but specified shape (46656, 128) and found shape (3136, 128). To Reproduce I ...
Read more >
ValueError when creating Siamese network using TensorFlow
A siamese network is a network consisting of two identical neural networks with tied weights (the weights of the two networks are the...
Read more >
Siamese Neural Networks for One-shot Image Recognition
Siamese Neural Networks for One-shot Image Recognition. Figure 2. Our general strategy. 1) Train a model to discriminate between a collection of ...
Read more >
Build a Deep Facial Recognition App // Part 4 - YouTube
In this series you'll learn how to build a deep facial recognition ... Combining models to Create a Siamese Neural Network Get the...
Read more >
Siamese Neural Networks: Explanation and Implementation in ...
The Colab Notebook created in the video: https://colab.research.google.com/drive/1smOkMgJIouKNBCZQUcmpTYrhpX2ciTHv?usp= sharing Timeline 0:00 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found