apolinario commited on
Commit
3156be4
·
1 Parent(s): 3a08199
ui/src/app/jobs/new/jobConfig.ts CHANGED
@@ -1,8 +1,7 @@
1
- import { JobConfig, DatasetConfig } from '@/types';
2
 
3
  export const defaultDatasetConfig: DatasetConfig = {
4
  folder_path: '/path/to/images/folder',
5
- control_path: null,
6
  mask_path: null,
7
  mask_min_value: 0.1,
8
  default_caption: '',
@@ -20,13 +19,22 @@ export const defaultDatasetConfig: DatasetConfig = {
20
  flip_y: false,
21
  };
22
 
 
 
 
 
 
 
 
 
 
23
  export const defaultJobConfig: JobConfig = {
24
  job: 'extension',
25
  config: {
26
  name: 'my_first_lora_v1',
27
  process: [
28
  {
29
- type: 'ui_trainer',
30
  training_folder: 'output',
31
  sqlite_db_path: './aitk_db.db',
32
  device: 'cuda',
@@ -53,53 +61,55 @@ export const defaultJobConfig: JobConfig = {
53
  },
54
  datasets: [defaultDatasetConfig],
55
  train: {
56
- batch_size: 4,
57
  bypass_guidance_embedding: true,
58
- steps: 1200,
59
  gradient_accumulation: 1,
60
  train_unet: true,
61
  train_text_encoder: false,
62
  gradient_checkpointing: true,
63
  noise_scheduler: 'flowmatch',
64
  optimizer: 'adamw8bit',
65
- timestep_type: 'weighted',
66
  content_or_style: 'balanced',
67
  optimizer_params: {
68
  weight_decay: 1e-4,
69
  },
70
  unload_text_encoder: false,
71
  cache_text_embeddings: false,
72
- lr: 0.0003,
73
  ema_config: {
74
  use_ema: false,
75
  ema_decay: 0.99,
76
  },
77
- skip_first_sample: true,
78
- disable_sampling: true,
 
79
  dtype: 'bf16',
80
  diff_output_preservation: false,
81
  diff_output_preservation_multiplier: 1.0,
82
  diff_output_preservation_class: 'person',
83
  switch_boundary_every: 1,
 
84
  },
85
  model: {
86
- name_or_path: 'Qwen/Qwen-Image',
87
  quantize: true,
88
  qtype: 'qfloat8',
89
  quantize_te: true,
90
  qtype_te: 'qfloat8',
91
- arch: 'qwen_image',
92
  low_vram: false,
93
  model_kwargs: {},
94
  },
95
  sample: {
96
  sampler: 'flowmatch',
97
- sample_every: 1500,
98
  width: 1024,
99
  height: 1024,
100
  samples: [
101
  {
102
- prompt: 'woman with red hair, playing chess at the park, bomb going off in the background'
103
  },
104
  {
105
  prompt: 'a woman holding a coffee cup, in a beanie, sitting at a cafe',
@@ -107,6 +117,30 @@ export const defaultJobConfig: JobConfig = {
107
  {
108
  prompt: 'a horse is a DJ at a night club, fish eye lens, smoke machine, lazer lights, holding a martini',
109
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  ],
111
  neg: '',
112
  seed: 42,
@@ -142,5 +176,16 @@ export const migrateJobConfig = (jobConfig: JobConfig): JobConfig => {
142
  jobConfig.config.process[0].sample.samples = newSamples;
143
  delete jobConfig.config.process[0].sample.prompts;
144
  }
 
 
 
 
 
 
 
 
 
 
 
145
  return jobConfig;
146
  };
 
1
+ import { JobConfig, DatasetConfig, SliderConfig } from '@/types';
2
 
3
  export const defaultDatasetConfig: DatasetConfig = {
4
  folder_path: '/path/to/images/folder',
 
5
  mask_path: null,
6
  mask_min_value: 0.1,
7
  default_caption: '',
 
19
  flip_y: false,
20
  };
21
 
22
+ export const defaultSliderConfig: SliderConfig = {
23
+ guidance_strength: 3.0,
24
+ anchor_strength: 1.0,
25
+ positive_prompt: 'person who is happy',
26
+ negative_prompt: 'person who is sad',
27
+ target_class: 'person',
28
+ anchor_class: '',
29
+ };
30
+
31
  export const defaultJobConfig: JobConfig = {
32
  job: 'extension',
33
  config: {
34
  name: 'my_first_lora_v1',
35
  process: [
36
  {
37
+ type: 'diffusion_trainer',
38
  training_folder: 'output',
39
  sqlite_db_path: './aitk_db.db',
40
  device: 'cuda',
 
61
  },
62
  datasets: [defaultDatasetConfig],
63
  train: {
64
+ batch_size: 1,
65
  bypass_guidance_embedding: true,
66
+ steps: 3000,
67
  gradient_accumulation: 1,
68
  train_unet: true,
69
  train_text_encoder: false,
70
  gradient_checkpointing: true,
71
  noise_scheduler: 'flowmatch',
72
  optimizer: 'adamw8bit',
73
+ timestep_type: 'sigmoid',
74
  content_or_style: 'balanced',
75
  optimizer_params: {
76
  weight_decay: 1e-4,
77
  },
78
  unload_text_encoder: false,
79
  cache_text_embeddings: false,
80
+ lr: 0.0001,
81
  ema_config: {
82
  use_ema: false,
83
  ema_decay: 0.99,
84
  },
85
+ skip_first_sample: false,
86
+ force_first_sample: false,
87
+ disable_sampling: false,
88
  dtype: 'bf16',
89
  diff_output_preservation: false,
90
  diff_output_preservation_multiplier: 1.0,
91
  diff_output_preservation_class: 'person',
92
  switch_boundary_every: 1,
93
+ loss_type: 'mse',
94
  },
95
  model: {
96
+ name_or_path: 'ostris/Flex.1-alpha',
97
  quantize: true,
98
  qtype: 'qfloat8',
99
  quantize_te: true,
100
  qtype_te: 'qfloat8',
101
+ arch: 'flex1',
102
  low_vram: false,
103
  model_kwargs: {},
104
  },
105
  sample: {
106
  sampler: 'flowmatch',
107
+ sample_every: 250,
108
  width: 1024,
109
  height: 1024,
110
  samples: [
111
  {
112
+ prompt: 'woman with red hair, playing chess at the park, bomb going off in the background',
113
  },
114
  {
115
  prompt: 'a woman holding a coffee cup, in a beanie, sitting at a cafe',
 
117
  {
118
  prompt: 'a horse is a DJ at a night club, fish eye lens, smoke machine, lazer lights, holding a martini',
119
  },
120
+ {
121
+ prompt:
122
+ 'a man showing off his cool new t shirt at the beach, a shark is jumping out of the water in the background',
123
+ },
124
+ {
125
+ prompt: 'a bear building a log cabin in the snow covered mountains',
126
+ },
127
+ {
128
+ prompt: 'woman playing the guitar, on stage, singing a song, laser lights, punk rocker',
129
+ },
130
+ {
131
+ prompt: 'hipster man with a beard, building a chair, in a wood shop',
132
+ },
133
+ {
134
+ prompt:
135
+ 'photo of a man, white background, medium shot, modeling clothing, studio lighting, white backdrop',
136
+ },
137
+ {
138
+ prompt: "a man holding a sign that says, 'this is a sign'",
139
+ },
140
+ {
141
+ prompt:
142
+ 'a bulldog, in a post apocalyptic world, with a shotgun, in a leather jacket, in a desert, with a motorcycle',
143
+ },
144
  ],
145
  neg: '',
146
  seed: 42,
 
176
  jobConfig.config.process[0].sample.samples = newSamples;
177
  delete jobConfig.config.process[0].sample.prompts;
178
  }
179
+
180
+ // upgrade job from ui_trainer to diffusion_trainer
181
+ if (jobConfig?.config?.process && jobConfig.config.process[0]?.type === 'ui_trainer') {
182
+ jobConfig.config.process[0].type = 'diffusion_trainer';
183
+ }
184
+
185
+ if ('auto_memory' in jobConfig.config.process[0].model) {
186
+ jobConfig.config.process[0].model.layer_offloading = (jobConfig.config.process[0].model.auto_memory ||
187
+ false) as boolean;
188
+ delete jobConfig.config.process[0].model.auto_memory;
189
+ }
190
  return jobConfig;
191
  };
ui/src/app/jobs/new/options.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { GroupedSelectOption, SelectOption } from '@/types';
 
2
 
3
  type Control = 'depth' | 'line' | 'pose' | 'inpaint';
4
 
@@ -8,6 +9,7 @@ type DisableableSections =
8
  | 'network.conv'
9
  | 'trigger_word'
10
  | 'train.diff_output_preservation'
 
11
  | 'train.unload_text_encoder'
12
  | 'slider';
13
 
@@ -19,7 +21,10 @@ type AdditionalSections =
19
  | 'sample.multi_ctrl_imgs'
20
  | 'datasets.num_frames'
21
  | 'model.multistage'
22
- | 'model.low_vram';
 
 
 
23
  type ModelGroup = 'image' | 'instruction' | 'video';
24
 
25
  export interface ModelArch {
@@ -221,7 +226,7 @@ export const modelArchs: ModelArch[] = [
221
  'config.process[0].train.noise_scheduler': ['flowmatch', 'flowmatch'],
222
  'config.process[0].sample.num_frames': [41, 1],
223
  'config.process[0].sample.fps': [16, 1],
224
- 'config.process[0].model.low_vram': [false, false],
225
  'config.process[0].train.timestep_type': ['linear', 'sigmoid'],
226
  'config.process[0].model.model_kwargs': [
227
  {
@@ -232,7 +237,7 @@ export const modelArchs: ModelArch[] = [
232
  ],
233
  },
234
  disableSections: ['network.conv'],
235
- additionalSections: ['datasets.num_frames', 'model.low_vram', 'model.multistage'],
236
  accuracyRecoveryAdapters: {
237
  // '3 bit with ARA': 'uint3|ostris/accuracy_recovery_adapters/wan22_14b_t2i_torchao_uint3.safetensors',
238
  '4 bit with ARA': 'uint4|ostris/accuracy_recovery_adapters/wan22_14b_t2i_torchao_uint4.safetensors',
@@ -252,7 +257,7 @@ export const modelArchs: ModelArch[] = [
252
  'config.process[0].train.noise_scheduler': ['flowmatch', 'flowmatch'],
253
  'config.process[0].sample.num_frames': [41, 1],
254
  'config.process[0].sample.fps': [16, 1],
255
- 'config.process[0].model.low_vram': [false, false],
256
  'config.process[0].train.timestep_type': ['linear', 'sigmoid'],
257
  'config.process[0].model.model_kwargs': [
258
  {
@@ -263,7 +268,13 @@ export const modelArchs: ModelArch[] = [
263
  ],
264
  },
265
  disableSections: ['network.conv'],
266
- additionalSections: ['sample.ctrl_img', 'datasets.num_frames', 'model.low_vram', 'model.multistage'],
 
 
 
 
 
 
267
  accuracyRecoveryAdapters: {
268
  '4 bit with ARA': 'uint4|ostris/accuracy_recovery_adapters/wan22_14b_i2v_torchao_uint4.safetensors',
269
  },
@@ -278,7 +289,7 @@ export const modelArchs: ModelArch[] = [
278
  'config.process[0].model.name_or_path': ['Wan-AI/Wan2.2-TI2V-5B-Diffusers', defaultNameOrPath],
279
  'config.process[0].model.quantize': [true, false],
280
  'config.process[0].model.quantize_te': [true, false],
281
- 'config.process[0].model.low_vram': [false, false],
282
  'config.process[0].sample.sampler': ['flowmatch', 'flowmatch'],
283
  'config.process[0].train.noise_scheduler': ['flowmatch', 'flowmatch'],
284
  'config.process[0].sample.num_frames': [121, 1],
@@ -313,7 +324,7 @@ export const modelArchs: ModelArch[] = [
313
  'config.process[0].model.name_or_path': ['Qwen/Qwen-Image', defaultNameOrPath],
314
  'config.process[0].model.quantize': [true, false],
315
  'config.process[0].model.quantize_te': [true, false],
316
- 'config.process[0].model.low_vram': [false, false],
317
  'config.process[0].sample.sampler': ['flowmatch', 'flowmatch'],
318
  'config.process[0].train.noise_scheduler': ['flowmatch', 'flowmatch'],
319
  'config.process[0].train.timestep_type': ['weighted', 'sigmoid'],
@@ -322,7 +333,7 @@ export const modelArchs: ModelArch[] = [
322
  'config.process[0].train.lr': [0.0003, 0.0001],
323
  },
324
  disableSections: ['network.conv'],
325
- additionalSections: ['model.low_vram'],
326
  accuracyRecoveryAdapters: {
327
  '3 bit with ARA': 'uint3|ostris/accuracy_recovery_adapters/qwen_image_torchao_uint3.safetensors',
328
  },
@@ -336,7 +347,7 @@ export const modelArchs: ModelArch[] = [
336
  'config.process[0].model.name_or_path': ['Qwen/Qwen-Image-Edit', defaultNameOrPath],
337
  'config.process[0].model.quantize': [true, false],
338
  'config.process[0].model.quantize_te': [true, false],
339
- 'config.process[0].model.low_vram': [false, false],
340
  'config.process[0].sample.sampler': ['flowmatch', 'flowmatch'],
341
  'config.process[0].train.noise_scheduler': ['flowmatch', 'flowmatch'],
342
  'config.process[0].train.timestep_type': ['weighted', 'sigmoid'],
@@ -345,7 +356,7 @@ export const modelArchs: ModelArch[] = [
345
  'config.process[0].train.lr': [0.0003, 0.0001],
346
  },
347
  disableSections: ['network.conv'],
348
- additionalSections: ['datasets.control_path', 'sample.ctrl_img', 'model.low_vram'],
349
  accuracyRecoveryAdapters: {
350
  '3 bit with ARA': 'uint3|ostris/accuracy_recovery_adapters/qwen_image_edit_torchao_uint3.safetensors',
351
  },
@@ -359,7 +370,7 @@ export const modelArchs: ModelArch[] = [
359
  'config.process[0].model.name_or_path': ['Qwen/Qwen-Image-Edit-2509', defaultNameOrPath],
360
  'config.process[0].model.quantize': [true, false],
361
  'config.process[0].model.quantize_te': [true, false],
362
- 'config.process[0].model.low_vram': [false, false],
363
  'config.process[0].train.unload_text_encoder': [false, false],
364
  'config.process[0].sample.sampler': ['flowmatch', 'flowmatch'],
365
  'config.process[0].train.noise_scheduler': ['flowmatch', 'flowmatch'],
@@ -367,9 +378,21 @@ export const modelArchs: ModelArch[] = [
367
  'config.process[0].model.qtype': ['qfloat8', 'qfloat8'],
368
  'config.process[0].train.batch_size': [4, 1],
369
  'config.process[0].train.lr': [0.0003, 0.0001],
 
 
 
 
 
 
370
  },
371
  disableSections: ['network.conv', 'train.unload_text_encoder'],
372
- additionalSections: ['datasets.control_path', 'sample.ctrl_img', 'model.low_vram'],
 
 
 
 
 
 
373
  accuracyRecoveryAdapters: {
374
  '3 bit with ARA': 'uint3|ostris/accuracy_recovery_adapters/qwen_image_edit_2509_torchao_uint3.safetensors',
375
  },
@@ -460,6 +483,84 @@ export const modelArchs: ModelArch[] = [
460
  disableSections: ['network.conv'],
461
  additionalSections: ['datasets.control_path', 'sample.ctrl_img'],
462
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
463
  ].sort((a, b) => {
464
  // Sort by label, case-insensitive
465
  return a.label.localeCompare(b.label, undefined, { sensitivity: 'base' });
@@ -481,7 +582,6 @@ export const groupedModelOptions: GroupedSelectOption[] = modelArchs.reduce((acc
481
  export const quantizationOptions: SelectOption[] = [
482
  { value: '', label: '- NONE -' },
483
  { value: 'qfloat8', label: 'float8 (default)' },
484
- { value: 'uint8', label: '8 bit' },
485
  { value: 'uint7', label: '7 bit' },
486
  { value: 'uint6', label: '6 bit' },
487
  { value: 'uint5', label: '5 bit' },
@@ -491,3 +591,33 @@ export const quantizationOptions: SelectOption[] = [
491
  ];
492
 
493
  export const defaultQtype = 'qfloat8';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { GroupedSelectOption, SelectOption, JobConfig } from '@/types';
2
+ import { defaultSliderConfig } from './jobConfig';
3
 
4
  type Control = 'depth' | 'line' | 'pose' | 'inpaint';
5
 
 
9
  | 'network.conv'
10
  | 'trigger_word'
11
  | 'train.diff_output_preservation'
12
+ | 'train.blank_prompt_preservation'
13
  | 'train.unload_text_encoder'
14
  | 'slider';
15
 
 
21
  | 'sample.multi_ctrl_imgs'
22
  | 'datasets.num_frames'
23
  | 'model.multistage'
24
+ | 'model.layer_offloading'
25
+ | 'model.low_vram'
26
+ | 'model.qie.match_target_res'
27
+ | 'model.assistant_lora_path';
28
  type ModelGroup = 'image' | 'instruction' | 'video';
29
 
30
  export interface ModelArch {
 
226
  'config.process[0].train.noise_scheduler': ['flowmatch', 'flowmatch'],
227
  'config.process[0].sample.num_frames': [41, 1],
228
  'config.process[0].sample.fps': [16, 1],
229
+ 'config.process[0].model.low_vram': [true, false],
230
  'config.process[0].train.timestep_type': ['linear', 'sigmoid'],
231
  'config.process[0].model.model_kwargs': [
232
  {
 
237
  ],
238
  },
239
  disableSections: ['network.conv'],
240
+ additionalSections: ['datasets.num_frames', 'model.low_vram', 'model.multistage', 'model.layer_offloading'],
241
  accuracyRecoveryAdapters: {
242
  // '3 bit with ARA': 'uint3|ostris/accuracy_recovery_adapters/wan22_14b_t2i_torchao_uint3.safetensors',
243
  '4 bit with ARA': 'uint4|ostris/accuracy_recovery_adapters/wan22_14b_t2i_torchao_uint4.safetensors',
 
257
  'config.process[0].train.noise_scheduler': ['flowmatch', 'flowmatch'],
258
  'config.process[0].sample.num_frames': [41, 1],
259
  'config.process[0].sample.fps': [16, 1],
260
+ 'config.process[0].model.low_vram': [true, false],
261
  'config.process[0].train.timestep_type': ['linear', 'sigmoid'],
262
  'config.process[0].model.model_kwargs': [
263
  {
 
268
  ],
269
  },
270
  disableSections: ['network.conv'],
271
+ additionalSections: [
272
+ 'sample.ctrl_img',
273
+ 'datasets.num_frames',
274
+ 'model.low_vram',
275
+ 'model.multistage',
276
+ 'model.layer_offloading',
277
+ ],
278
  accuracyRecoveryAdapters: {
279
  '4 bit with ARA': 'uint4|ostris/accuracy_recovery_adapters/wan22_14b_i2v_torchao_uint4.safetensors',
280
  },
 
289
  'config.process[0].model.name_or_path': ['Wan-AI/Wan2.2-TI2V-5B-Diffusers', defaultNameOrPath],
290
  'config.process[0].model.quantize': [true, false],
291
  'config.process[0].model.quantize_te': [true, false],
292
+ 'config.process[0].model.low_vram': [true, false],
293
  'config.process[0].sample.sampler': ['flowmatch', 'flowmatch'],
294
  'config.process[0].train.noise_scheduler': ['flowmatch', 'flowmatch'],
295
  'config.process[0].sample.num_frames': [121, 1],
 
324
  'config.process[0].model.name_or_path': ['Qwen/Qwen-Image', defaultNameOrPath],
325
  'config.process[0].model.quantize': [true, false],
326
  'config.process[0].model.quantize_te': [true, false],
327
+ 'config.process[0].model.low_vram': [true, false],
328
  'config.process[0].sample.sampler': ['flowmatch', 'flowmatch'],
329
  'config.process[0].train.noise_scheduler': ['flowmatch', 'flowmatch'],
330
  'config.process[0].train.timestep_type': ['weighted', 'sigmoid'],
 
333
  'config.process[0].train.lr': [0.0003, 0.0001],
334
  },
335
  disableSections: ['network.conv'],
336
+ additionalSections: ['model.low_vram', 'model.layer_offloading'],
337
  accuracyRecoveryAdapters: {
338
  '3 bit with ARA': 'uint3|ostris/accuracy_recovery_adapters/qwen_image_torchao_uint3.safetensors',
339
  },
 
347
  'config.process[0].model.name_or_path': ['Qwen/Qwen-Image-Edit', defaultNameOrPath],
348
  'config.process[0].model.quantize': [true, false],
349
  'config.process[0].model.quantize_te': [true, false],
350
+ 'config.process[0].model.low_vram': [true, false],
351
  'config.process[0].sample.sampler': ['flowmatch', 'flowmatch'],
352
  'config.process[0].train.noise_scheduler': ['flowmatch', 'flowmatch'],
353
  'config.process[0].train.timestep_type': ['weighted', 'sigmoid'],
 
356
  'config.process[0].train.lr': [0.0003, 0.0001],
357
  },
358
  disableSections: ['network.conv'],
359
+ additionalSections: ['datasets.control_path', 'sample.ctrl_img', 'model.low_vram', 'model.layer_offloading'],
360
  accuracyRecoveryAdapters: {
361
  '3 bit with ARA': 'uint3|ostris/accuracy_recovery_adapters/qwen_image_edit_torchao_uint3.safetensors',
362
  },
 
370
  'config.process[0].model.name_or_path': ['Qwen/Qwen-Image-Edit-2509', defaultNameOrPath],
371
  'config.process[0].model.quantize': [true, false],
372
  'config.process[0].model.quantize_te': [true, false],
373
+ 'config.process[0].model.low_vram': [true, false],
374
  'config.process[0].train.unload_text_encoder': [false, false],
375
  'config.process[0].sample.sampler': ['flowmatch', 'flowmatch'],
376
  'config.process[0].train.noise_scheduler': ['flowmatch', 'flowmatch'],
 
378
  'config.process[0].model.qtype': ['qfloat8', 'qfloat8'],
379
  'config.process[0].train.batch_size': [4, 1],
380
  'config.process[0].train.lr': [0.0003, 0.0001],
381
+ 'config.process[0].model.model_kwargs': [
382
+ {
383
+ match_target_res: false,
384
+ },
385
+ {},
386
+ ],
387
  },
388
  disableSections: ['network.conv', 'train.unload_text_encoder'],
389
+ additionalSections: [
390
+ 'datasets.multi_control_paths',
391
+ 'sample.multi_ctrl_imgs',
392
+ 'model.low_vram',
393
+ 'model.layer_offloading',
394
+ 'model.qie.match_target_res',
395
+ ],
396
  accuracyRecoveryAdapters: {
397
  '3 bit with ARA': 'uint3|ostris/accuracy_recovery_adapters/qwen_image_edit_2509_torchao_uint3.safetensors',
398
  },
 
483
  disableSections: ['network.conv'],
484
  additionalSections: ['datasets.control_path', 'sample.ctrl_img'],
485
  },
486
+ {
487
+ name: 'flux2',
488
+ label: 'FLUX.2',
489
+ group: 'image',
490
+ defaults: {
491
+ // default updates when [selected, unselected] in the UI
492
+ 'config.process[0].model.name_or_path': ['black-forest-labs/FLUX.2-dev', defaultNameOrPath],
493
+ 'config.process[0].model.quantize': [true, false],
494
+ 'config.process[0].model.quantize_te': [true, false],
495
+ 'config.process[0].model.low_vram': [true, false],
496
+ 'config.process[0].train.unload_text_encoder': [false, false],
497
+ 'config.process[0].sample.sampler': ['flowmatch', 'flowmatch'],
498
+ 'config.process[0].train.noise_scheduler': ['flowmatch', 'flowmatch'],
499
+ 'config.process[0].train.timestep_type': ['weighted', 'sigmoid'],
500
+ 'config.process[0].model.qtype': ['qfloat8', 'qfloat8'],
501
+ 'config.process[0].model.model_kwargs': [
502
+ {
503
+ match_target_res: false,
504
+ },
505
+ {},
506
+ ],
507
+ },
508
+ disableSections: ['network.conv'],
509
+ additionalSections: [
510
+ 'datasets.multi_control_paths',
511
+ 'sample.multi_ctrl_imgs',
512
+ 'model.low_vram',
513
+ 'model.layer_offloading',
514
+ 'model.qie.match_target_res',
515
+ ],
516
+ },
517
+ {
518
+ name: 'zimage:turbo',
519
+ label: 'Z-Image Turbo (w/ Training Adapter)',
520
+ group: 'image',
521
+ defaults: {
522
+ // default updates when [selected, unselected] in the UI
523
+ 'config.process[0].model.name_or_path': ['Tongyi-MAI/Z-Image-Turbo', defaultNameOrPath],
524
+ 'config.process[0].model.quantize': [true, false],
525
+ 'config.process[0].model.quantize_te': [true, false],
526
+ 'config.process[0].model.low_vram': [true, false],
527
+ 'config.process[0].train.unload_text_encoder': [false, false],
528
+ 'config.process[0].sample.sampler': ['flowmatch', 'flowmatch'],
529
+ 'config.process[0].train.noise_scheduler': ['flowmatch', 'flowmatch'],
530
+ 'config.process[0].train.timestep_type': ['weighted', 'sigmoid'],
531
+ 'config.process[0].model.qtype': ['qfloat8', 'qfloat8'],
532
+ 'config.process[0].model.assistant_lora_path': [
533
+ 'ostris/zimage_turbo_training_adapter/zimage_turbo_training_adapter_v2.safetensors',
534
+ undefined,
535
+ ],
536
+ 'config.process[0].sample.guidance_scale': [1, 4],
537
+ 'config.process[0].sample.sample_steps': [8, 25],
538
+ },
539
+ disableSections: ['network.conv'],
540
+ additionalSections: ['model.low_vram', 'model.layer_offloading', 'model.assistant_lora_path'],
541
+ },
542
+ {
543
+ name: 'zimage:deturbo',
544
+ label: 'Z-Image De-Turbo (De-Distilled)',
545
+ group: 'image',
546
+ defaults: {
547
+ // default updates when [selected, unselected] in the UI
548
+ 'config.process[0].model.name_or_path': ['ostris/Z-Image-De-Turbo', defaultNameOrPath],
549
+ 'config.process[0].model.extras_name_or_path': ['Tongyi-MAI/Z-Image-Turbo', undefined],
550
+ 'config.process[0].model.quantize': [true, false],
551
+ 'config.process[0].model.quantize_te': [true, false],
552
+ 'config.process[0].model.low_vram': [true, false],
553
+ 'config.process[0].train.unload_text_encoder': [false, false],
554
+ 'config.process[0].sample.sampler': ['flowmatch', 'flowmatch'],
555
+ 'config.process[0].train.noise_scheduler': ['flowmatch', 'flowmatch'],
556
+ 'config.process[0].train.timestep_type': ['weighted', 'sigmoid'],
557
+ 'config.process[0].model.qtype': ['qfloat8', 'qfloat8'],
558
+ 'config.process[0].sample.guidance_scale': [3, 4],
559
+ 'config.process[0].sample.sample_steps': [25, 25],
560
+ },
561
+ disableSections: ['network.conv'],
562
+ additionalSections: ['model.low_vram', 'model.layer_offloading'],
563
+ },
564
  ].sort((a, b) => {
565
  // Sort by label, case-insensitive
566
  return a.label.localeCompare(b.label, undefined, { sensitivity: 'base' });
 
582
  export const quantizationOptions: SelectOption[] = [
583
  { value: '', label: '- NONE -' },
584
  { value: 'qfloat8', label: 'float8 (default)' },
 
585
  { value: 'uint7', label: '7 bit' },
586
  { value: 'uint6', label: '6 bit' },
587
  { value: 'uint5', label: '5 bit' },
 
591
  ];
592
 
593
  export const defaultQtype = 'qfloat8';
594
+
595
+ interface JobTypeOption extends SelectOption {
596
+ disableSections?: DisableableSections[];
597
+ processSections?: string[];
598
+ onActivate?: (config: JobConfig) => JobConfig;
599
+ onDeactivate?: (config: JobConfig) => JobConfig;
600
+ }
601
+
602
+ export const jobTypeOptions: JobTypeOption[] = [
603
+ {
604
+ value: 'diffusion_trainer',
605
+ label: 'LoRA Trainer',
606
+ disableSections: ['slider'],
607
+ },
608
+ {
609
+ value: 'concept_slider',
610
+ label: 'Concept Slider',
611
+ disableSections: ['trigger_word', 'train.diff_output_preservation'],
612
+ onActivate: (config: JobConfig) => {
613
+ // add default slider config
614
+ config.config.process[0].slider = { ...defaultSliderConfig };
615
+ return config;
616
+ },
617
+ onDeactivate: (config: JobConfig) => {
618
+ // remove slider config
619
+ delete config.config.process[0].slider;
620
+ return config;
621
+ },
622
+ },
623
+ ];
ui/src/types.ts CHANGED
@@ -39,6 +39,16 @@ export interface GpuInfo {
39
  fan: GpuFan;
40
  }
41
 
 
 
 
 
 
 
 
 
 
 
42
  export interface GPUApiResponse {
43
  hasNvidiaSmi: boolean;
44
  gpus: GpuInfo[];
@@ -83,12 +93,15 @@ export interface DatasetConfig {
83
  cache_latents_to_disk?: boolean;
84
  resolution: number[];
85
  controls: string[];
86
- control_path: string | null;
87
  num_frames: number;
88
  shrink_video_to_frames: boolean;
89
  do_i2v: boolean;
90
  flip_x: boolean;
91
  flip_y: boolean;
 
 
 
92
  }
93
 
94
  export interface EMAConfig {
@@ -117,11 +130,17 @@ export interface TrainConfig {
117
  weight_decay: number;
118
  };
119
  skip_first_sample: boolean;
 
120
  disable_sampling: boolean;
121
  diff_output_preservation: boolean;
122
  diff_output_preservation_multiplier: number;
123
  diff_output_preservation_class: string;
 
 
124
  switch_boundary_every: number;
 
 
 
125
  }
126
 
127
  export interface QuantizeKwargsConfig {
@@ -130,6 +149,7 @@ export interface QuantizeKwargsConfig {
130
 
131
  export interface ModelConfig {
132
  name_or_path: string;
 
133
  quantize: boolean;
134
  quantize_te: boolean;
135
  qtype: string;
@@ -138,11 +158,15 @@ export interface ModelConfig {
138
  arch: string;
139
  low_vram: boolean;
140
  model_kwargs: { [key: string]: any };
 
 
 
 
141
  }
142
 
143
  export interface SampleItem {
144
  prompt: string;
145
- width?: number
146
  height?: number;
147
  neg?: string;
148
  seed?: number;
@@ -152,6 +176,10 @@ export interface SampleItem {
152
  num_frames?: number;
153
  ctrl_img?: string | null;
154
  ctrl_idx?: number;
 
 
 
 
155
  }
156
 
157
  export interface SampleConfig {
@@ -170,14 +198,24 @@ export interface SampleConfig {
170
  fps: number;
171
  }
172
 
 
 
 
 
 
 
 
 
 
173
  export interface ProcessConfig {
174
- type: 'ui_trainer';
175
  sqlite_db_path?: string;
176
  training_folder: string;
177
  performance_log_every: number;
178
  trigger_word: string | null;
179
  device: string;
180
  network?: NetworkConfig;
 
181
  save: SaveConfig;
182
  datasets: DatasetConfig[];
183
  train: TrainConfig;
@@ -210,7 +248,7 @@ export interface JobConfig {
210
  }
211
 
212
  export interface ConfigDoc {
213
- title: string;
214
  description: React.ReactNode;
215
  }
216
 
@@ -256,3 +294,5 @@ export interface JobUpsertPayload {
256
  info?: string;
257
  speed_string?: string;
258
  }
 
 
 
39
  fan: GpuFan;
40
  }
41
 
42
+ export interface CpuInfo {
43
+ name: string;
44
+ cores: number;
45
+ temperature: number;
46
+ totalMemory: number;
47
+ freeMemory: number;
48
+ availableMemory: number;
49
+ currentLoad: number;
50
+ }
51
+
52
  export interface GPUApiResponse {
53
  hasNvidiaSmi: boolean;
54
  gpus: GpuInfo[];
 
93
  cache_latents_to_disk?: boolean;
94
  resolution: number[];
95
  controls: string[];
96
+ control_path?: string | null;
97
  num_frames: number;
98
  shrink_video_to_frames: boolean;
99
  do_i2v: boolean;
100
  flip_x: boolean;
101
  flip_y: boolean;
102
+ control_path_1?: string | null;
103
+ control_path_2?: string | null;
104
+ control_path_3?: string | null;
105
  }
106
 
107
  export interface EMAConfig {
 
130
  weight_decay: number;
131
  };
132
  skip_first_sample: boolean;
133
+ force_first_sample: boolean;
134
  disable_sampling: boolean;
135
  diff_output_preservation: boolean;
136
  diff_output_preservation_multiplier: number;
137
  diff_output_preservation_class: string;
138
+ blank_prompt_preservation?: boolean;
139
+ blank_prompt_preservation_multiplier?: number;
140
  switch_boundary_every: number;
141
+ loss_type: 'mse' | 'mae' | 'wavelet' | 'stepped';
142
+ do_differential_guidance?: boolean;
143
+ differential_guidance_scale?: number;
144
  }
145
 
146
  export interface QuantizeKwargsConfig {
 
149
 
150
  export interface ModelConfig {
151
  name_or_path: string;
152
+ extras_name_or_path?: string;
153
  quantize: boolean;
154
  quantize_te: boolean;
155
  qtype: string;
 
158
  arch: string;
159
  low_vram: boolean;
160
  model_kwargs: { [key: string]: any };
161
+ layer_offloading?: boolean;
162
+ layer_offloading_transformer_percent?: number;
163
+ layer_offloading_text_encoder_percent?: number;
164
+ assistant_lora_path?: string;
165
  }
166
 
167
  export interface SampleItem {
168
  prompt: string;
169
+ width?: number;
170
  height?: number;
171
  neg?: string;
172
  seed?: number;
 
176
  num_frames?: number;
177
  ctrl_img?: string | null;
178
  ctrl_idx?: number;
179
+ network_multiplier?: number;
180
+ ctrl_img_1?: string | null;
181
+ ctrl_img_2?: string | null;
182
+ ctrl_img_3?: string | null;
183
  }
184
 
185
  export interface SampleConfig {
 
198
  fps: number;
199
  }
200
 
201
+ export interface SliderConfig {
202
+ guidance_strength?: number;
203
+ anchor_strength?: number;
204
+ positive_prompt?: string;
205
+ negative_prompt?: string;
206
+ target_class?: string;
207
+ anchor_class?: string | null;
208
+ }
209
+
210
  export interface ProcessConfig {
211
+ type: string;
212
  sqlite_db_path?: string;
213
  training_folder: string;
214
  performance_log_every: number;
215
  trigger_word: string | null;
216
  device: string;
217
  network?: NetworkConfig;
218
+ slider?: SliderConfig;
219
  save: SaveConfig;
220
  datasets: DatasetConfig[];
221
  train: TrainConfig;
 
248
  }
249
 
250
  export interface ConfigDoc {
251
+ title: string | React.ReactNode;
252
  description: React.ReactNode;
253
  }
254
 
 
294
  info?: string;
295
  speed_string?: string;
296
  }
297
+
298
+ export type JobStatus = 'queued' | 'running' | 'stopping' | 'stopped' | 'completed' | 'error';