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 issueDescribe 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:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
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.
@w4nderlust works fine now, thanks! 😃