Question - Defining a tuple as a parameter in a config file
See original GitHub issueHi!
I’m using Hydra with PyTorch Lightning to configure my model. One of the hyperparameters of my data module is a variable that corresponds to a tuple of 3 floats.
In the datamodule.yaml config file, I wrote:
_target_: src.datamodules.keri_datamodule.KeriDataModule
pix_dim: (0.5, 0.5, 0.781)
However, I get the following error:
ValueError: Error instantiating 'src.datamodules.keri_datamodule.KeriDataModule': could not convert string to float: '(0.5, 0.5, 0.781)'
What syntax should I use to explain to Hydra that it’s a tuple / sequence and not a string or a list to sweep through?
Thanks for your help 😃
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
How to Pass a Tuple as an Argument to a Function?
Tuples can be defined using any variable name and then assigning different values to the tuple inside the round brackets. The tuple is...
Read more >tuples as function arguments - python - Stack Overflow
When you call a function, you're not providing a tuple. You're providing arguments. A tuple can be an argument, but only one -...
Read more >How correctly pass to a command a tuple of parameters ...
Your problem is that you are passing the key values incorrectly. At first the option is trim= 0.5cm 0.5cm 0.5cm 0.5cm and not...
Read more >Using a tuple to Input the parameters of a function - Python
MY QUESTION: Why does a function not accept a tuple as an input for it's parameters? As I understand it, a tuple is...
Read more >Kinds of types - mypy 0.991 documentation
tuple [...] is valid as a base class in Python 3.6 and later, and always in stub files. In earlier Python versions you...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Currently tuples do not have full support (see https://github.com/omry/omegaconf/issues/392). Is it possible to use a list, i.e.
pix_dim: [0.5, 0.5, 0.781]
?Thank you @Jasha10 🙂 Really helpful examples!