Skip to main content

rlx_flow/
recipe.rs

1// RLX — versatile ML compiler + runtime.
2// Copyright (C) 2026 Eugene Hauptmann, Nataliya Kosmyna.
3
4//! Composable model recipes — arch presets that remain patchable.
5
6use crate::flow::ModelFlow;
7
8/// Assemble a [`ModelFlow`] from config — use for arch-specific presets (LLaMA, Qwen, FLUX, …).
9///
10/// Recipes return an unbuilt flow so callers can still `.raw_stage()`, `.custom()`, or
11/// `.patch()` before `build()`.
12pub trait ModelRecipe {
13    fn name(&self) -> &str;
14    fn assemble(&self) -> ModelFlow;
15}
16
17impl<F> ModelRecipe for F
18where
19    F: Fn() -> ModelFlow,
20{
21    fn name(&self) -> &str {
22        "closure_recipe"
23    }
24
25    fn assemble(&self) -> ModelFlow {
26        self()
27    }
28}