fix: disable Start Training when eval_steps set without eval split
This commit is contained in:
parent
2a11e79b8b
commit
6eba6fff43
3 changed files with 21 additions and 11 deletions
|
|
@ -12,6 +12,7 @@ import {
|
|||
serializeConfigToYaml,
|
||||
useTrainingActions,
|
||||
useTrainingConfigStore,
|
||||
validateTrainingConfig,
|
||||
} from "@/features/training";
|
||||
import {
|
||||
Archive04Icon,
|
||||
|
|
@ -43,7 +44,8 @@ export function TrainingSection() {
|
|||
const { isStarting, startError, startTrainingRun } = useTrainingActions();
|
||||
const isIncompatible =
|
||||
!store.isVisionModel && store.isDatasetImage === true;
|
||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
const configValidation = validateTrainingConfig(store);
|
||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
const handleFileUpload = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const file = e.target.files?.[0];
|
||||
|
|
@ -150,7 +152,7 @@ export function TrainingSection() {
|
|||
data-tour="studio-start"
|
||||
className="w-full cursor-pointer bg-gradient-to-r from-emerald-500 to-teal-500 text-white hover:from-emerald-600 hover:to-teal-600"
|
||||
onClick={() => void startTrainingRun()}
|
||||
disabled={isStarting || isIncompatible}
|
||||
disabled={isStarting || isIncompatible || !configValidation.ok}
|
||||
>
|
||||
<HugeiconsIcon icon={Rocket01Icon} className="size-4" />
|
||||
{isStarting ? "Starting..." : "Start Training"}
|
||||
|
|
@ -163,6 +165,9 @@ export function TrainingSection() {
|
|||
Text model is not compatible with a multimodal dataset. Switch to a vision model or choose a text-only dataset.
|
||||
</p>
|
||||
)}
|
||||
{!configValidation.ok && configValidation.message && !isIncompatible && (
|
||||
<p className="text-xs text-red-500 leading-relaxed">{configValidation.message}</p>
|
||||
)}
|
||||
|
||||
{/* Upload / Save / Reset */}
|
||||
<p className="text-xs text-muted-foreground">Training Config</p>
|
||||
|
|
|
|||
|
|
@ -11,3 +11,4 @@ export { listLocalModels } from "./api/models-api";
|
|||
export type { LocalModelInfo } from "./api/models-api";
|
||||
export type { TrainingPhase } from "./types/runtime";
|
||||
export { parseYamlConfig, serializeConfigToYaml } from "./lib/yaml-config";
|
||||
export { validateTrainingConfig } from "./lib/validation";
|
||||
|
|
|
|||
|
|
@ -16,18 +16,22 @@ export function validateTrainingConfig(
|
|||
if (!config.dataset) {
|
||||
return { ok: false, message: "Select a Hugging Face dataset first." };
|
||||
}
|
||||
return { ok: true, message: null };
|
||||
}
|
||||
|
||||
if (config.datasetSource === "upload") {
|
||||
} else if (config.datasetSource === "upload") {
|
||||
if (!config.uploadedFile) {
|
||||
return { ok: false, message: "Select a local dataset first." };
|
||||
}
|
||||
return { ok: true, message: null };
|
||||
} else {
|
||||
return { ok: false, message: "Unsupported dataset source." };
|
||||
}
|
||||
|
||||
return {
|
||||
ok: false,
|
||||
message: "Unsupported dataset source.",
|
||||
};
|
||||
// Eval steps requires an eval split to be selected
|
||||
if (config.evalSteps > 0 && !config.datasetEvalSplit) {
|
||||
return {
|
||||
ok: false,
|
||||
message:
|
||||
"Eval Steps is set but no Eval Split is selected. Choose an Eval Split or set Eval Steps to 0.",
|
||||
};
|
||||
}
|
||||
|
||||
return { ok: true, message: null };
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue