You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Followup on #388 the parent fields seem to be getting lost again. If I have a field that is an interpolation of a field higher up in the hierarchy, I can print out the value fine but I can't use it within instiantiate.
Checklist
I checked on the latest version of Hydra
I created a minimal repro
To reproduce
** Minimal Code/Config snippet to reproduce **
Minimal code snippet which should print three times the same integer value.
The first print is the parent field
The second print accesses the child field, which is an interpolation of the parent field
The third print uses instantiate to create an object which takes the child field as a parameter and prints from that object
Before the third print happens the exception is thrown
import time
import hydra
import submitit
class GetsTheInteger:
def __init__(self, same_integer):
self.intval = intval
@hydra.main(config_name="test2.yaml")
def main(cfg) -> None:
print(cfg.data.integer)
print(cfg.data.test.same_integer)
g = hydra.utils.instantiate(cfg.data.test)
print(g.intval)
if __name__ == "__main__":
main()
** Stack trace/error message **
Traceback (most recent call last):
File "/private/home/mehrlich/.conda/envs/qgac/lib/python3.7/site-packages/hydra/_internal/utils.py", line 203, in run_and_report
return func()
File "/private/home/mehrlich/.conda/envs/qgac/lib/python3.7/site-packages/hydra/_internal/utils.py", line 355, in <lambda>
overrides=args.overrides,
File "/private/home/mehrlich/.conda/envs/qgac/lib/python3.7/site-packages/hydra/_internal/hydra.py", line 110, in run
job_subdir_key=None,
File "/private/home/mehrlich/.conda/envs/qgac/lib/python3.7/site-packages/hydra/core/utils.py", line 123, in run_job
ret.return_value = task_function(task_cfg)
File "test2.py", line 15, in main
g = hydra.utils.instantiate(cfg.data.test)
File "/private/home/mehrlich/.conda/envs/qgac/lib/python3.7/site-packages/hydra/utils.py", line 68, in call
raise HydraException(f"Error calling '{cls}' : {e}") from e
hydra.errors.HydraException: Error calling 'test2.GetsTheInteger' : str interpolation key 'data.integer' not found
full_key: same_integer
reference_type=Any
object_type=dict
Expected Behavior
No crash, can instantiate objects whose parameters depend on interpolations of parent fields
System information
Hydra Version : git master
Python version : 3.7
Virtual environment type and version : Conda
Operating system : Ubuntu 18.04 (fair cluster)
The text was updated successfully, but these errors were encountered:
🐛 Bug
Description
Followup on #388 the parent fields seem to be getting lost again. If I have a field that is an interpolation of a field higher up in the hierarchy, I can print out the value fine but I can't use it within instiantiate.
Checklist
To reproduce
** Minimal Code/Config snippet to reproduce **
Minimal code snippet which should print three times the same integer value.
The first print is the parent field
The second print accesses the child field, which is an interpolation of the parent field
The third print uses instantiate to create an object which takes the child field as a parameter and prints from that object
Before the third print happens the exception is thrown
** Stack trace/error message **
Expected Behavior
No crash, can instantiate objects whose parameters depend on interpolations of parent fields
System information
The text was updated successfully, but these errors were encountered: