1

我正在使用Hydra来配置我的 Python 应用程序。我真的很喜欢如何拥有默认配置并为某些配置属性创建“覆盖”。但是,我不知道如何从运行中删除属性(例如删除属性)。我看到通过终端可以做到这一点python run.py ~foo.bar,但我想知道如何用配置文件做同样的事情?

例如,在以下配置文件中,我将覆盖 max_epochs,但如何将属性 max_epochs 全部删除?

defaults:
  - override /trainer: minimal.yaml # choose trainer from 'configs/trainer/'

# all parameters below will be merged 
# with parameters from default configurations set above
# this allows you to overwrite only specified parameters
trainer:
  min_epochs: 1
  max_epochs: 100 
  check_val_every_n_epoch: 20 
  gpus: 1
4

1 回答 1

0

你不能从配置文件中做到这一点。我建议您以附加的方式构建您的配置。添加您需要的内容,而不是删除您不需要的内容。

于 2021-07-28T16:10:35.633 回答