Skip to content

API Reference

Breaking Changes in v0.2

Recent upgrade to version >= v0.2.0 may cause some breaking changes. Make some documented instructions may be outdated. You can install a specific version by pip install fusion-bench==0.1.6 or checkout to a specific version by git checkout v0.1.6. If you encounter any issues, please feel free to raise an issue. We are working on the documentation and will update it as soon as possible.

Use version >=0.2.0 is recommended.

Here we provides an overview of the API reference for FusionBench.

Entry Points

main(cfg)

Main entry point for the FusionBench command-line interface.

This function serves as the primary entry point for the fusion_bench CLI command. It is decorated with Hydra's main decorator to handle configuration management, command-line argument parsing, and configuration file loading.

The function performs the following operations: 1. Resolves any interpolations in the configuration using OmegaConf 2. Instantiates the appropriate program class based on the configuration 3. Executes the program's run method to perform the fusion task

Parameters:

  • cfg (DictConfig) –

    The Hydra configuration object containing all settings for the fusion task. This includes method configuration, model pool configuration, task pool configuration, and other runtime parameters. The configuration is automatically loaded by Hydra from the specified config files and command-line overrides.

Returns:

  • None ( None ) –

    This function doesn't return a value but executes the fusion program which may save results, log outputs, or perform other side effects as configured.

Example

This function is typically called automatically when running:

fusion_bench method=... modelpool=... taskpool=...

The Hydra decorator handles parsing these command-line arguments and loading the corresponding configuration files to populate the cfg parameter.

Source code in fusion_bench/scripts/cli.py
@hydra.main(
    config_path=_get_default_config_path(),
    config_name="fabric_model_fusion",
    version_base=None,
)
def main(cfg: DictConfig) -> None:
    """
    Main entry point for the FusionBench command-line interface.

    This function serves as the primary entry point for the `fusion_bench` CLI command.
    It is decorated with Hydra's main decorator to handle configuration management,
    command-line argument parsing, and configuration file loading.

    The function performs the following operations:
    1. Resolves any interpolations in the configuration using OmegaConf
    2. Instantiates the appropriate program class based on the configuration
    3. Executes the program's run method to perform the fusion task

    Args:
        cfg (DictConfig): The Hydra configuration object containing all settings
            for the fusion task. This includes method configuration, model pool
            configuration, task pool configuration, and other runtime parameters.
            The configuration is automatically loaded by Hydra from the specified
            config files and command-line overrides.

    Returns:
        None: This function doesn't return a value but executes the fusion
            program which may save results, log outputs, or perform other
            side effects as configured.

    Example:
        This function is typically called automatically when running:
        ```bash
        fusion_bench method=... modelpool=... taskpool=...
        ```

        The Hydra decorator handles parsing these command-line arguments and
        loading the corresponding configuration files to populate the cfg parameter.
    """
    OmegaConf.resolve(cfg)
    program: BaseHydraProgram = instantiate(cfg)
    program.run()

Class Definitions

Base class for all FusionBench components.

Modules