Skip to content

[Feature] Enable loading Callbacks from hydra configs#245

Open
Xmaster6y wants to merge 2 commits intofacebookresearch:mainfrom
Xmaster6y:hydra-callbacks
Open

[Feature] Enable loading Callbacks from hydra configs#245
Xmaster6y wants to merge 2 commits intofacebookresearch:mainfrom
Xmaster6y:hydra-callbacks

Conversation

@Xmaster6y
Copy link
Contributor

What does this PR do?

This is a decomposition of #220, which focuses on loading from hydra configs.

Usage:

defaults:
  ...
  - callback@callbacks.c1: my_callback
  - _self_

Copilot AI review requested due to automatic review settings December 17, 2025 11:08
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 17, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds infrastructure for loading callback configurations from Hydra config files, establishing a pattern similar to the existing algorithm and model configuration loading mechanisms.

  • Introduces CallbackConfig base class for defining callback configurations with YAML loading support
  • Adds load_callbacks_from_hydra function to instantiate callbacks from Hydra DictConfig
  • Integrates callback loading into the experiment initialization workflow with proper merging of hydra-loaded and programmatically-provided callbacks

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
benchmarl/callbacks/common.py Defines the CallbackConfig base class with methods for YAML loading and callback instantiation
benchmarl/callbacks/init.py Initializes the callbacks module with exports and an empty callback_config_registry
benchmarl/hydra_config.py Adds load_callbacks_from_hydra function and integrates callback loading into load_experiment_from_hydra
benchmarl/init.py Registers callback schemas with Hydra's ConfigStore for config validation
test/test_callbacks.py Adds tests for callback loading from Hydra configs, including edge cases for no callbacks and disabled callbacks

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants