Add multi build support#2480
Draft
xiaoyu-work wants to merge 2 commits into
Draft
Conversation
Introduce a top-level �uilds section on RunConfig that lets users declare multiple independent execution units (pipelines x devices x components) in one workflow config. * Add BuildConfigPartial / BuildConfig and a merge_build_default helper in olive/engine/config.py. _default lives inside �uilds as a sentinel key whose partial fields are merged into every sibling build with full-replace semantics (lists are not deep-merged). * Add �uilds: dict[str, BuildConfig] to RunConfig with an �xpand_build_defaults before-validator that pops _default and merges it into siblings, plus a �alidate_builds_references after-validator that checks pipeline/host/target/evaluator string refs resolve to known entries. * Schema-only change: the engine runner does not yet act on �uilds. Existing workflows without �uilds keep their current behavior. * Add 8 unit tests in test/workflows/test_run_config_builds.py covering the merge, override, full-replace, missing-field, invalid-ref, absent-builds and empty-default cases. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Execute the �uilds schema added in Phase 1.
* Add CompositeModelHandler.select_components(names) that returns the
unwrapped child handler when one name is given and a sliced
CompositeModelHandler otherwise. Unknown names raise a clear error.
* Add ModelConfig.select_components(names) so the runner can slice a
composite input config without materializing the full handler.
* Add a builds-aware execution branch in olive/workflows/run/run.py. When
�uilds is non-empty, the runner: validates components against the
composite input model, then loops over builds. For each build it builds a
per-build engine config (host/target/evaluator/search_strategy overrides
resolved against systems/evaluators), a per-build pipeline subset from
passes in the order declared by pipeline, the per-build accelerator
spec, and calls engine.run with build.output_dir. Returns
dict[build_name -> WorkflowOutput]. The no-builds path is unchanged and
still returns a single WorkflowOutput.
* Tests:
- 7 new composite handler / ModelConfig select_components cases in
test/model/test_composite_model.py.
- 7 new runner smoke tests in test/workflows/test_run_builds.py with
mocked Engine.run covering: no-builds backward compat, multi-build
dispatch, pipeline-subset ordering, per-build output_dir, host/target
override, non-composite + components error, unknown component error.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new, flexible "builds" workflow to the Olive engine, enabling multiple independent build pipelines within a single run configuration. It adds support for per-build defaults, validation, and selective execution on model components, primarily targeting composite models. The changes also include robust schema validation and improved modularity for configuring builds.
Key changes include:
Builds Workflow and Configuration:
Added a new
buildsfield toRunConfig, allowing users to define multiple named build pipelines, each with its own pipeline, component selection, and system/evaluator overrides. A special_defaultkey enables partial defaults to be merged into sibling builds. (olive/engine/config.py,olive/workflows/run/config.py,olive/workflows/run/run.py) [1] [2] [3]Introduced
BuildConfigPartialandBuildConfigschemas for partial and full build configurations, and amerge_build_defaultfunction for merging defaults into builds. (olive/engine/config.py)Validation and Reference Resolution:
RunConfigto ensure build defaults are correctly merged and that all build references (passes, systems, evaluators) resolve to known entries. (olive/workflows/run/config.py) [1] [2]Component Selection for Composite Models:
select_componentsmethods in bothModelConfigandCompositeModelHandlerto allow builds to operate on specific named components of a composite model, returning either a single component or a sub-composite as needed. (olive/model/config/model_config.py,olive/model/handler/composite.py) [1] [2]Workflow Execution Logic:
_run_buildsfunction whenbuildsare present, running each build as an independent workflow with its own engine, pipeline, and input model slice. Includes helper functions for validation, engine config construction, and reference resolution. (olive/workflows/run/run.py) [1] [2]These improvements make the Olive engine significantly more flexible and modular, supporting advanced workflows for multi-component and multi-pipeline builds