Add config type to frontend

Signed-off-by: Felipe Cardoso <felipe.cardoso@hotmail.it>
This commit is contained in:
2025-01-23 13:58:08 +01:00
parent dadbc837f0
commit 756bd999f7

View File

@@ -0,0 +1,105 @@
// src/types/config.ts
// First, let's define all the nested configuration types
interface EMAConfig {
use_ema?: boolean;
ema_decay?: number;
}
interface TrainConfig {
batch_size: number;
bypass_guidance_embedding?: boolean;
timestep_type?: string;
steps: number;
gradient_accumulation?: number;
train_unet?: boolean;
train_text_encoder?: boolean;
gradient_checkpointing?: boolean;
noise_scheduler?: string;
optimizer?: string;
lr?: number;
ema_config?: EMAConfig;
dtype?: string;
do_paramiter_swapping?: boolean;
paramiter_swapping_factor?: number;
skip_first_sample?: boolean;
disable_sampling?: boolean;
}
interface ModelConfig {
name_or_path: string;
is_flux?: boolean;
quantize?: boolean;
quantize_te?: boolean;
}
interface SampleConfig {
sampler: string;
sample_every: number;
width: number;
height: number;
prompts: string[];
neg: string;
seed: number;
walk_seed: boolean;
guidance_scale: number;
sample_steps: number;
}
interface SaveConfig {
dtype?: string;
save_every?: number;
max_step_saves_to_keep?: number;
save_format?: string;
}
interface DatasetConfig {
folder_path: string;
caption_ext?: string;
caption_dropout_rate?: number;
shuffle_tokens?: boolean;
resolution?: number[];
}
interface ProcessConfig {
type: string;
training_folder: string;
performance_log_every?: number;
device?: string;
trigger_word?: string;
save?: SaveConfig;
datasets: DatasetConfig[];
train: TrainConfig;
model: ModelConfig;
sample: SampleConfig;
}
interface MetaConfig {
name?: string;
version?: string;
}
// The main configuration interfaces
interface ConfigSection {
name: string;
process: ProcessConfig[];
}
interface Config {
job: string;
config: ConfigSection;
meta: MetaConfig;
}
export type {
Config,
ConfigSection,
ProcessConfig,
DatasetConfig,
SaveConfig,
TrainConfig,
ModelConfig,
SampleConfig,
EMAConfig,
MetaConfig
};