hydra-zen is a Python library that simplifies the creation of reproducible, composable, and scalable configurations for machine learning and scientific workflows using Hydra. It provides a more Pythonic API to define Hydra configurations, enabling type-checking, autocompletion, and easier integration with existing Python code. The current version is 0.16.0, with releases occurring periodically, often driven by new features or compatibility updates.
pip install hydra-zenVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to define a configuration for a Python function using `builds` and then instantiate that configuration directly using `instantiate`. It shows how to set default parameters and how to override them programmatically, illustrating `hydra-zen`'s ability to create and manage `_target_` configurations.
Review any custom `_target_wrapper_` implementations or complex partial instantiation patterns. Test your application carefully after upgrading.
If upgrading from <0.13.0, thoroughly test applications using advanced type-checking or validation. Consider explicitly disabling Pydantic integration if it causes unexpected issues, or adapt your code to leverage the new Pydantic-based validation.
Familiarize yourself with the official `hydra-core` documentation, especially the concepts of instantiation and composition, in conjunction with `hydra-zen`'s streamlined API.
Use `@zen` for your main application entry point (typically `main.py`) that expects Hydra CLI arguments. Use `instantiate()` when you need to programmatically create an object from a config within your code without invoking the full Hydra application context.
Run `pip install hydra-zen` to install the library.
Ensure all parameters for the target function have defaults in the `builds` call or in the function signature. If running via Hydra CLI, provide missing parameters: `python your_app.py path.to.param=value`.
Use `instantiate(ConfigObject)` to create an instance of the target object. Configuration objects are not directly callable.
Add the necessary import statement at the top of your script, e.g., `from hydra_zen import builds, zen, instantiate`.