ashleve / lightning-hydra-template

PyTorch Lightning + Hydra. A very user-friendly template for ML experimentation. ⚑πŸ”₯⚑

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hydra ListConfig objects are not dynamically interploated.

RafayAK opened this issue Β· comments

Hi, there is a small bug/oversight when using Hydra's dynamically interploated configurations. This issue is particularly in regards to the tags list in the experiment.yaml, for example.

tags:
  - "mnist"
  - "simple_dense_net"
  - ${task_name}  # should be dynamically interpolated
  - batch_size_${data.batch_size} # should also be dynamically interpolated

seed: 12345

trainer:
  min_epochs: 10
  max_epochs: 10
  gradient_clip_val: 0.5

...
...

logger:
  wandb:
    tags: ${tags}
    group: "mnist"
  aim:
    experiment: "mnist"

The tags list gets correctly resolved when Wandb configs are resolved but the tags them selves are not dynamically resolved when the config tree is printed:

CONFIG
β”œβ”€β”€ data
β”‚   └── _target_: src.data.mnist_datamodule.MNISTDataModule 
|           ....                                                                                                                                       
β”‚                                                                                                                                                                                                  
β”œβ”€β”€ model
β”‚   └── _target_: src.models.mnist_module.MNISTLitModule                                                                                                                                           
β”‚       ...                                                                                                                                                                                                                                                                                                                                                  
β”‚                                                                                                                                                                                                  
β”œβ”€β”€ callbacks
β”‚   └── ...                                                                                                                        
β”‚                                                                                                                                                                                                  
β”œβ”€β”€ logger
β”‚   └── wandb:                                                                                                                                                                                     
β”‚         tags:                                                                                                                                                                                    
β”‚         - mnist                                                                                                                                                                                  
β”‚         - simple_dense_net                                                                                                                                                                       
β”‚         - train   # RESOLVED                                                                                                                                                                               
β”‚         - batch_size_64     # RESOLVED                                                                                                                                                                    
β”‚         group: mnist                                                                                                                                                                             
β”‚       aim:                                                                                                                                                                                       
β”‚         experiment: mnist                                                                                                                                                                        
β”‚                                                                                                                                                                                                  
...
...                                                                                                                                                 
β”œβ”€β”€ task_name
β”‚   └── train                                                                                                                                                                                      
β”œβ”€β”€ tags
β”‚   └── ['mnist', 'simple_dense_net', '${task_name}', 'batch_size_${data.batch_size}']   # UNRESOLVED

@ashleve I've added a small PR against this issue, you may review and merge at your discretion.

Thanks a lot for this Project πŸ₯‚