diff --git a/hyperpyyaml/core.py b/hyperpyyaml/core.py index 6900792..42fea40 100644 --- a/hyperpyyaml/core.py +++ b/hyperpyyaml/core.py @@ -186,6 +186,10 @@ def load_hyperpyyaml( ruamel.yaml.constructor.BaseConstructor.construct_object.__defaults__ = ( True, ) # deep=True + # ruamel.yaml >= 0.19 added max_depth checking in the composer, + # but the legacy Loader class does not define this attribute. + if not hasattr(loader, 'max_depth'): + loader.max_depth = 0 hparams = yaml.load(yaml_stream, Loader=loader) # Change back to normal default: yaml.constructor.BaseConstructor.construct_object.__defaults__ = ( diff --git a/setup.py b/setup.py index 034aa53..c16d7c1 100644 --- a/setup.py +++ b/setup.py @@ -18,5 +18,5 @@ "License :: OSI Approved :: Apache Software License", ], packages=["hyperpyyaml"], - install_requires=["pyyaml>=5.1", "ruamel.yaml>=0.17.28,<0.19.0"], + install_requires=["pyyaml>=5.1", "ruamel.yaml>=0.17.28"], )