intelligence.zenith_tune.strategies.registry
Registry for tuning strategies.
StrategyRegistry Objects
class StrategyRegistry()
Registry for tuning strategy classes.
Example:
@StrategyRegistry.register("random") class RandomStrategy(TuningStrategy): ...
strategy = StrategyRegistry.get("random") strategy = StrategyRegistry.get("megatron-heuristic", n_gpus=8)
register
@staticmethod
def register(name: str)
Class decorator to register a strategy.
Arguments:
name- Unique name for the strategy.
Returns:
Decorator that registers the class and returns it unchanged.
get
@staticmethod
def get(name: str, **kwargs) -> TuningStrategy | None
Get a strategy instance by name.
String kwargs are coerced to the types declared in the strategy's
__init__ signature (int, float, bool). Keys not accepted by the
constructor are silently dropped.
Arguments:
name- Name of the strategy to retrieve.**kwargs- Additional keyword arguments passed to the strategy constructor.
Returns:
Strategy instance, or None if not found.
resolve
@staticmethod
def resolve(strategy: TuningStrategy | str, **kwargs) -> TuningStrategy
Resolve a strategy from an instance or name.
Arguments:
strategy- A TuningStrategy instance (returned as-is) or a string name (looked up in registry).**kwargs- Additional keyword arguments passed to the strategy constructor (only used when strategy is a string).
Returns:
Resolved strategy instance.
Raises:
ValueError- If the strategy name is not registered.TypeError- If strategy is not a TuningStrategy or str.
list
@staticmethod
def list() -> list[str]
List all registered strategy names.
Returns:
List of registered strategy names.