Three more capabilities on distinct untested surfaces (167 tests pass, no new runtime primitive). A — Adapter plane (§9.19): one base + swappable LoRA/ControlNet adapters, selected per request (DiffusionParams.adapters); AdapterDenoiseLoop applies each active adapter's velocity delta. Per-request selection changes output, multi-LoRA composes, ControlNet conditions on a control image, mixed-adapter requests interleave without smearing, hot-swap changes generation, cache key partitions by adapter stack (the adapter_versions field, previously declared-only). ToyLoRA/ToyControlNet; models/adapters/. 6 tests. B — Non-linear workflows (§9.17): ParallelWorkflow (fan-out: one input → N models → merged) and BestOfNWorkflow (generate N → score with the served reward card → return best; inference-time scaling). The shapes a linear chain can't express. 4 tests. D — RL→distill flywheel (§9.18): run_flywheel RL-improves the base (NFT), then distills FROM the RL'd model (DMD2 teacher = RL'd policy) into a faster card, recording the base→rl→distilled provenance chain in RecipeSpec.parents. The distilled student is measurably closer to the RL'd teacher than the base; the distilled card serves few-step. training/flywheel.py. 4 tests. designv4 §9.17–§9.19 + layout/closing/counts (167 tests, 29 files).
27 lines
662 B
Python
27 lines
662 B
Python
"""Program plane — compose a card's loops into a task (design_v3 §13)."""
|
|
from __future__ import annotations
|
|
|
|
from .specs import (
|
|
ComponentNode,
|
|
Edge,
|
|
EdgeKind,
|
|
ModelLoopNode,
|
|
Program,
|
|
ProgramKind,
|
|
ProgramNode,
|
|
always,
|
|
when_opt,
|
|
when_task,
|
|
)
|
|
from .workflow import (
|
|
BestOfNWorkflow,
|
|
ParallelWorkflow,
|
|
Workflow,
|
|
WorkflowRegistry,
|
|
WorkflowStage,
|
|
)
|
|
|
|
__all__ = ["Program", "ProgramKind", "ProgramNode", "ComponentNode", "ModelLoopNode",
|
|
"Edge", "EdgeKind", "always", "when_task", "when_opt",
|
|
"Workflow", "WorkflowStage", "WorkflowRegistry", "ParallelWorkflow", "BestOfNWorkflow"]
|