| Class Name | Purpose | Notes |
|---|---|---|
RecipeArguments |
CLI interface for loading args into oneshot() |
Not related to Recipe hierarchy |
RecipeArgs |
Runtime dict with eval(...) support for dynamic config |
Holds configuration values (some as eval(...) strings) for runtime evaluation and substitution |
RecipeTuple |
Wrapper for (Recipe, stages, args) |
Still used in oneshot |
RecipeModifier |
Atomic action (e.g. GPTQModifier), subclass of RecipeBase |
Used everywhere in recipe related classes |
RecipeStage |
Group of modifiers, also RecipeBase |
Possibly flattenable |
Recipe |
Full config container (stages + metadata) | Central object |
RecipeBase |
Abstract base for shared logic | Makes design cleaner; lightweight |
RecipeMetaData |
Optional metadata object | Consider flattening into Recipe, unless more features are planned |
RecipeContainer |
Runtime container of recipes/tuples | Possibly replaceable with a list or dict; investigate internal logic |
Combining RecipeTuple, and RecipeStage, Modifier
from pydantic import BaseModel
class Recipe(BaseModel):
version: str
modifiers: OrderedDict[str, List[Dict[str, Any]]] # OrderedDict of modifiers with type, group, args
metadata: Dict[str, Any] # Previously RecipeMetaData, now a dict as part of Recipe
# --- Deserialization ---
@classmethod
def from_modifiers(cls, modifiers, modifier_group_name=None) -> Recipe
# Create a Recipe from one or more Modifier instances.
@classmethod
def create_instance(cls, path_or_modifiers, modifier_group_name=None) -> Recipe
# Create a Recipe from a file path, string, Modifier(s), or existing Recipe.
# --- Modifier Construction ---
def create_modifier(self) -> List[Any]
# Instantiate all modifiers defined in the recipe.
# --- Serialization ---
def dict(self) -> Dict
# Return a grouped dictionary representation of the recipe.
def yaml(self, file_path: Optional[str] = None) -> str
# Return a YAML string for this recipe, optionally saving to file.
def _get_yaml_dict(self) -> Dict[str, Any]
# Return a dict formatted for YAML serialization.
Recipe.simplify_recipe(...)
Recipe or str, not RecipeTuple.self.stages by target_stages.self.args with override_args.evaluate(...) with shift.RecipeContainer._prepare_tuples() to return Recipe objects
Recipe.create_instance(...).simplify_recipe(...) inline with target_stages, override_args, and shift.update_missing_metadata method to recipe class