I am using a custom aggregator, and its constructor has arguments other than “params”, “num_losses”, and “weights”. I want to set the values of these arguments in the hydra configuration, but it does not accept any arguments other than the standard three.
How can I set the values of arbitrary arguments by the hydra configuration?
### config.yaml
defaults:
- loss : custom-aggregator
### loss/custom-aggregator.yaml
_target_ : custom_aggregtor.CustomAggregator
hoge : 10 #<- this setting raises error
### custom_aggregator.py
class CustomAggregator(Aggregator):
def __init__(self, params, num_losses, weights=None, hoge=1):
super().__init__(params, num_losses, weights)
self.hoge = hoge
def forward(self, losses: Dict[str, torch.Tensor], step: int) -> torch.Tensor:
loss = ...
return loss