Skip to main content

train_router

Function train_router 

Source
pub async fn train_router(
    rows: Vec<DracoRowJs>,
    prices: HashMap<String, f64>,
    options: TrainRouterOptions,
) -> Result<TrainRouterResult>
Expand description

Train a FastGRNN router from a DRACO dataset and write it to a .safetensors file consumable by new Router({ modelPath }).

const res = await trainRouter(rows, { haiku: 1, opus: 15 }, {
  outputPath: './router.safetensors', inputDim: 8, epochs: 40,
});
const router = new Router({ modelPath: res.modelPath });