HyperPyYAML is a Python library that extends the YAML syntax for enhanced interaction with Python objects and better hyperparameter definition. It is actively maintained, with a recent version 1.2.3, and typically releases updates as needed for bug fixes and new features.
pip install hyperpyyamlVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to load a YAML string containing HyperPyYAML extensions. It shows the use of `!ref` for referencing other parameters and `!new` for instantiating Python objects (like PyTorch modules) directly from the YAML.
Only load YAML files from trusted sources. Review any YAML configuration before using it with HyperPyYAML, especially files from external or untrusted origins.
Upgrade HyperPyYAML to version 1.2.3 or newer, which explicitly pins `ruamel.yaml<0.19.0` in its dependencies to ensure compatibility. If manually managing dependencies, ensure `ruamel.yaml` is below `0.19.0`.
Upgrade to HyperPyYAML 1.2.3 or higher, where this issue has been resolved.
Always use `!copy` when you need an independent instance of an object or value, ensuring that modifications to one do not unexpectedly alter others.
Upgrade to HyperPyYAML 1.2.3 or higher for full Python 3.8+ compatibility.
Install the library and its dependencies using pip: `pip install hyperpyyaml` or if specifically `ruamel.yaml` is missing or outdated, `pip install ruamel.yaml`.
Ensure that the YAML structure at the point of inclusion (where `!include` is used) matches the expected type for updates (usually a mapping/dictionary) and that any `overrides` provided are compatible with the structure of the included YAML. If the included file is a list, avoid applying dictionary-like overrides directly to it.
Review the YAML file for duplicate anchor definitions (`&anchor_name`) and ensure each anchor used for objects or applied functions has a unique name.
Pin the version of `ruamel.yaml` to a compatible one, as suggested in related issues. For example, `pip install 'ruamel.yaml<0.19.0'` or `pip install hyperpyyaml==1.2.3 ruamel.yaml<0.19.0`.