Hydra: [Bug]

Created on 11 Apr 2020  路  3Comments  路  Source: facebookresearch/hydra

馃悰 Bug

Instantiate object with optional arguments modified the original config.

To reproduce

my_function:
  class: main.dummy
  params:
    first: 1
    second: 10
----
def dummy(first, second):
  return first + second

 a = hydra.utils.instantiate(cfg.my_function)
 b = hydra.utils.instantiate(cfg.my_function, second=20)
 c = hydra.utils.instantiate(cfg.my_function)

Print a,b,c yields 11,21,21

Expected Behavior

print a, b, c will yield 11, 21, 11

Additional context

I'm not sure if this behavior is desired or not but it's definitely not expected from the docs nor intuitive.

bug

All 3 comments

Hi, can you test on master?

Thanks, that fixes it. I should definitely check master branch more often before open a PR :)).

Thanks for reporting though, I am not sure I have a unit test that validates the original config is unmodified. will take a look later.

Was this page helpful?
0 / 5 - 0 ratings