Built out the ui trainer plugin with db comminication

This commit is contained in:
Jaret Burkett
2025-02-21 05:53:35 -07:00
parent f778d979b5
commit adcf884c0f
13 changed files with 245 additions and 22 deletions

View File

@@ -19,8 +19,9 @@ export const defaultJobConfig: JobConfig = {
name: 'my_first_flex_lora_v1',
process: [
{
type: 'sd_trainer',
type: 'ui_trainer',
training_folder: 'output',
sqlite_db_path: './aitk_db.db',
device: 'cuda:0',
network: {
type: 'lora',

View File

@@ -51,10 +51,29 @@ export const NumberInput = (props: NumberInputProps) => {
type="number"
value={value}
onChange={(e) => {
let value = Number(e.target.value);
if (isNaN(value)) value = 0;
// Use parseFloat instead of Number to properly handle decimal values
const rawValue = e.target.value;
// Special handling for empty or partial inputs
if (rawValue === '' || rawValue === '-' || rawValue === '.') {
// For empty or partial inputs (like just a minus sign or decimal point),
// we need to maintain the raw input in the input field
// but pass a valid number to onChange
onChange(0);
return;
}
let value = parseFloat(rawValue);
// Handle NaN cases
if (isNaN(value)) {
value = 0;
}
// Apply min/max constraints only for valid numbers
if (min !== undefined && value < min) value = min;
if (max !== undefined && value > max) value = max;
onChange(value);
}}
className={inputClasses}
@@ -62,6 +81,8 @@ export const NumberInput = (props: NumberInputProps) => {
required={required}
min={min}
max={max}
// Allow decimal points
step="any"
/>
</div>
);

View File

@@ -121,7 +121,8 @@ export interface SampleConfig {
}
export interface ProcessConfig {
type: 'sd_trainer';
type: 'ui_trainer';
sqlite_db_path?: string;
training_folder: string;
device: string;
network?: NetworkConfig;