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

HYDRA Arithmetic operations within configs #70

Closed
vriez opened this issue Apr 13, 2021 · 1 comment
Closed

HYDRA Arithmetic operations within configs #70

vriez opened this issue Apr 13, 2021 · 1 comment

Comments

@vriez
Copy link

vriez commented Apr 13, 2021

Consider the configuration files:

# dataset.yaml
# @package _group_
  class_name: dataloaders.datasets.COCODataset
  data_dir: ${storage.data_dir}/Docs
  class_labels: [1, 2]
  num_classes: 2

and

# model.yaml
# @package _group_

  module:
    class_name: segmentation.maskrcnn.models.DateOutliner

  top:
    class_name: torchvision.models.detection.mask_rcnn.MaskRCNNPredictor
    params:
      num_classes: ${dataset.num_classes}

Is there a way to add perform arithmetic operations with a paramete. So as to obtain config.model.top.num_classes as 3 (2+1)?

I have tried many variations, but I have not managed to get it to work:

Below are examples that won't work:

  top:
    class_name: torchvision.models.detection.mask_rcnn.MaskRCNNPredictor
    params:
      num_classes: ${dataset.num_classes + 1} 
  top:
    class_name: torchvision.models.detection.mask_rcnn.MaskRCNNPredictor
    params:
      num_classes: ${dataset.num_classes++} 
@omry
Copy link
Contributor

omry commented Apr 13, 2021

This is not currently supported. There is a feature request in OmegaConf for it.

@omry omry closed this as completed Apr 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants