From 1e3aa4ff92e95820771c617de07cd3b077bea2a4 Mon Sep 17 00:00:00 2001
From: Lee Jackson <130007945+Imagineer99@users.noreply.github.com>
Date: Sun, 15 Mar 2026 21:33:51 +0000
Subject: [PATCH] studio: add max steps and epochs toggle switch (#4296)
* feat: add Epochs toggle for Max Steps
* refactor: dedupe max-steps/epochs toggle logic and fix input bug
* fix(studio): max-steps input validation and prevSaveSteps seed in epochs mode
---------
Co-authored-by: Roland Tannous <115670425+rolandtannous@users.noreply.github.com>
---
.../components/steps/hyperparameters-step.tsx | 188 +++++++++---------
.../studio/sections/params-section.tsx | 185 ++++++++++-------
.../hooks/use-max-steps-epochs-toggle.ts | 113 +++++++++++
.../frontend/src/features/training/index.ts | 1 +
4 files changed, 322 insertions(+), 165 deletions(-)
create mode 100644 studio/frontend/src/features/training/hooks/use-max-steps-epochs-toggle.ts
diff --git a/studio/frontend/src/features/onboarding/components/steps/hyperparameters-step.tsx b/studio/frontend/src/features/onboarding/components/steps/hyperparameters-step.tsx
index 5117debcce..0a04a1e71f 100644
--- a/studio/frontend/src/features/onboarding/components/steps/hyperparameters-step.tsx
+++ b/studio/frontend/src/features/onboarding/components/steps/hyperparameters-step.tsx
@@ -23,7 +23,7 @@ import {
TooltipTrigger,
} from "@/components/ui/tooltip";
import { CONTEXT_LENGTHS } from "@/config/training";
-import { useTrainingConfigStore } from "@/features/training";
+import { useMaxStepsEpochsToggle, useTrainingConfigStore } from "@/features/training";
import { InformationCircleIcon } from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
import { useShallow } from "zustand/react/shallow";
@@ -35,6 +35,8 @@ export function HyperparametersStep() {
setMaxSteps,
epochs,
setEpochs,
+ saveSteps,
+ setSaveSteps,
contextLength,
setContextLength,
learningRate,
@@ -52,6 +54,8 @@ export function HyperparametersStep() {
setMaxSteps: s.setMaxSteps,
epochs: s.epochs,
setEpochs: s.setEpochs,
+ saveSteps: s.saveSteps,
+ setSaveSteps: s.setSaveSteps,
contextLength: s.contextLength,
setContextLength: s.setContextLength,
learningRate: s.learningRate,
@@ -67,6 +71,15 @@ export function HyperparametersStep() {
const showLoraParams =
trainingMethod === "lora" || trainingMethod === "qlora";
+ const { useEpochs, toggleUseEpochs } = useMaxStepsEpochsToggle({
+ maxSteps,
+ epochs,
+ saveSteps,
+ setMaxSteps,
+ setEpochs,
+ setSaveSteps,
+ });
+
const maxStepsSliderMax = Math.max(500, maxSteps, 30);
const epochsSliderMax = Math.max(10, epochs, 1);
@@ -75,52 +88,84 @@ export function HyperparametersStep() {