Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
1d46f17
Update shared.ts
hdfhssg Jun 12, 2025
ddf1495
Update flux-lora.ts
hdfhssg Jun 12, 2025
1d31067
Update dreambooth.ts
hdfhssg Jun 12, 2025
b77ccfb
Update lora-master.ts
hdfhssg Jun 12, 2025
6ea70dc
Update sd3-lora.ts
hdfhssg Jun 12, 2025
5daa822
Update shared.ts
hdfhssg Jun 12, 2025
b3ec592
Update shared.ts
hdfhssg Jun 12, 2025
b12489c
Create contrastive.py
hdfhssg Jun 12, 2025
1277313
Update train_network.py
hdfhssg Jun 12, 2025
9b8b2f6
Create contrastive.py
hdfhssg Jun 12, 2025
48a4525
Update train_network.py
hdfhssg Jun 12, 2025
e2a5f92
Update flux_train.py
hdfhssg Jun 12, 2025
dad2a56
Update shared.ts
hdfhssg Jun 12, 2025
8ec3c6e
Update shared.ts
hdfhssg Jun 12, 2025
11419e4
Update shared.ts
hdfhssg Jun 12, 2025
dfd5b69
Update .gitmodules
hdfhssg Jun 13, 2025
5d08607
Update shared.ts
hdfhssg Jun 13, 2025
5d5390c
Update dreambooth.ts
hdfhssg Jun 13, 2025
c92478e
Update flux-lora.ts
hdfhssg Jun 13, 2025
9d1a2c0
Update lora-master.ts
hdfhssg Jun 13, 2025
56c1ee6
Update sd3-lora.ts
hdfhssg Jun 13, 2025
626933e
Update shared.ts
hdfhssg Jun 13, 2025
617d896
Update default.toml
hdfhssg Jun 13, 2025
0ed282a
Update lora.toml
hdfhssg Jun 13, 2025
020c343
Merge pull request #1 from hdfhssg/dev
hdfhssg Jun 13, 2025
3d53910
Update dreambooth.ts
hdfhssg Jun 13, 2025
c9d2d80
Update flux-lora.ts
hdfhssg Jun 13, 2025
fcfd359
Update lora-basic.ts
hdfhssg Jun 13, 2025
80f673d
Update lora-master.ts
hdfhssg Jun 13, 2025
82fe2c4
Update lumina2-lora.ts
hdfhssg Jun 13, 2025
9784fce
Update sd3-lora.ts
hdfhssg Jun 13, 2025
10f2360
Update sd3-lora.ts
hdfhssg Jun 13, 2025
63dafa1
Update lumina2-lora.ts
hdfhssg Jun 13, 2025
7bf0d04
Update lora-master.ts
hdfhssg Jun 13, 2025
41cd3a3
Update lora-basic.ts
hdfhssg Jun 13, 2025
2cb9f87
Update flux-lora.ts
hdfhssg Jun 13, 2025
0329fc0
Update dreambooth.ts
hdfhssg Jun 13, 2025
7deedcd
Update train_network.py
hdfhssg Jun 13, 2025
8eac233
Update train_network.py
hdfhssg Jun 13, 2025
ea79236
Update flux_train.py
hdfhssg Jun 13, 2025
51d927d
Update train_network.py
hdfhssg Jun 13, 2025
d618925
Update train_network.py
hdfhssg Jun 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "frontend"]
path = frontend
url = https://github.com/hanamizuki-ai/lora-gui-dist
url = https://github.com/hdfhssg/lora-gui-dist
[submodule "mikazuki/dataset-tag-editor"]
path = mikazuki/dataset-tag-editor
url = https://github.com/Akegarasu/dataset-tag-editor
5 changes: 5 additions & 0 deletions config/default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ lowram = false
clip_skip = 2
mixed_precision = "fp16"
save_precision = "fp16"
enable_contrastive = false
negative_sampling_method = "Random-Noise"
noise_strength = 1.0
contrastive_weight = 0.05
contrastive_warmup_steps = 100

[sample_prompt]
sample_sampler = "euler_a"
Expand Down
7 changes: 6 additions & 1 deletion config/lora.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ max_train_epochs = 10
resolution = "512,512"
clip_skip = 2
mixed_precision = "fp16"
enable_contrastive = false
negative_sampling_method = "Random-Noise"
noise_strength = 1.0
contrastive_weight = 0.05
contrastive_warmup_steps = 100

[sample_prompt_arguments]
sample_sampler = "euler_a"
Expand All @@ -59,4 +64,4 @@ save_precision = "fp16"
[others]
cache_latents = true
shuffle_caption = true
enable_bucket = true
enable_bucket = true
42 changes: 41 additions & 1 deletion mikazuki/schema/dreambooth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,47 @@ Schema.intersect([
optimizer_args_custom: Schema.array(String).role("table").description("自定义 optimizer_args,一行一个"),
})
]),

Schema.intersect([
// 对比学习主开关
Schema.object({
enable_contrastive: Schema.boolean()
.default(false)
.description('启用对比学习模块'),
}).description('对比学习配置'),

// 当 enable_contrastive = true 时,才展示下面这些配置;否则只用空对象
Schema.union([
Schema.object({
enable_contrastive: Schema.const(true).required(),

negative_sampling_method: Schema.union([
'Random-Noise', 'Permutation', 'Random-index', 'Circular', 'Hard-Negative',
])
.default('Random-Noise')
.description('选择负样本生成策略'),

noise_strength: Schema.number()
.step(0.5)
.min(0)
.max(10)
.default(1.0)
.description('噪音强度参数'),

contrastive_weight: Schema.number()
.step(0.05)
.min(0)
.max(1)
.default(0.05)
.description('对比损失权重'),

contrastive_warmup_steps: Schema.number()
.step(10)
.default(100)
.description('使用随机负样本的步数'),
}),
Schema.object({}),
]),
]),
Schema.intersect([
Schema.object({
enable_preview: Schema.boolean().default(false).description("启用训练预览图"),
Expand Down
43 changes: 42 additions & 1 deletion mikazuki/schema/flux-lora.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Schema.intersect([
scale_weight_norms: Schema.number().step(0.01).min(0).description("最大范数正则化。如果使用,推荐为 1"),
network_args_custom: Schema.array(String).role('table').description('自定义 network_args,一行一个'),
enable_base_weight: Schema.boolean().default(false).description('启用基础权重(差异炼丹)'),
network_scale: Schema.number().step(0.05).default(1.0).description('网络缩放系数,应该小于等于1.0'),
}).description("网络设置"),

// lycoris 参数
Expand All @@ -62,7 +63,47 @@ Schema.intersect([

SHARED_SCHEMAS.NETWORK_OPTION_BASEWEIGHT,
]),

Schema.intersect([
// 对比学习主开关
Schema.object({
enable_contrastive: Schema.boolean()
.default(false)
.description('启用对比学习模块'),
}).description('对比学习配置'),

// 当 enable_contrastive = true 时,才展示下面这些配置;否则只用空对象
Schema.union([
Schema.object({
enable_contrastive: Schema.const(true).required(),

negative_sampling_method: Schema.union([
'Random-Noise', 'Permutation', 'Random-index', 'Circular', 'Hard-Negative',
])
.default('Random-Noise')
.description('选择负样本生成策略'),

noise_strength: Schema.number()
.step(0.5)
.min(0)
.max(10)
.default(1.0)
.description('噪音强度参数'),

contrastive_weight: Schema.number()
.step(0.05)
.min(0)
.max(1)
.default(0.05)
.description('对比损失权重'),

contrastive_warmup_steps: Schema.number()
.step(10)
.default(100)
.description('使用随机负样本的步数'),
}),
Schema.object({}),
]),
]),
// 预览图设置
SHARED_SCHEMAS.PREVIEW_IMAGE,

Expand Down
42 changes: 41 additions & 1 deletion mikazuki/schema/lora-basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,47 @@ Schema.intersect([
]).default("AdamW8bit").description("优化器设置"),
})
]),

Schema.intersect([
// 对比学习主开关
Schema.object({
enable_contrastive: Schema.boolean()
.default(false)
.description('启用对比学习模块'),
}).description('对比学习配置'),

// 当 enable_contrastive = true 时,才展示下面这些配置;否则只用空对象
Schema.union([
Schema.object({
enable_contrastive: Schema.const(true).required(),

negative_sampling_method: Schema.union([
'Random-Noise', 'Permutation', 'Random-index', 'Circular', 'Hard-Negative',
])
.default('Random-Noise')
.description('选择负样本生成策略'),

noise_strength: Schema.number()
.step(0.5)
.min(0)
.max(10)
.default(1.0)
.description('噪音强度参数'),

contrastive_weight: Schema.number()
.step(0.05)
.min(0)
.max(1)
.default(0.05)
.description('对比损失权重'),

contrastive_warmup_steps: Schema.number()
.step(10)
.default(100)
.description('使用随机负样本的步数'),
}),
Schema.object({}),
]),
]),
Schema.intersect([
Schema.object({
enable_preview: Schema.boolean().default(false).description('启用训练预览图'),
Expand Down
43 changes: 42 additions & 1 deletion mikazuki/schema/lora-master.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Schema.intersect([
network_args_custom: Schema.array(String).role('table').description('自定义 network_args,一行一个'),
enable_block_weights: Schema.boolean().default(false).description('启用分层学习率训练(只支持网络模块 networks.lora)'),
enable_base_weight: Schema.boolean().default(false).description('启用基础权重(差异炼丹)'),
network_scale: Schema.number().step(0.05).default(1.0).description('网络缩放系数,应该小于等于1.0'),
}).description("网络设置"),

// lycoris 参数
Expand All @@ -69,7 +70,47 @@ Schema.intersect([

SHARED_SCHEMAS.NETWORK_OPTION_BASEWEIGHT,
]),

Schema.intersect([
// 对比学习主开关
Schema.object({
enable_contrastive: Schema.boolean()
.default(false)
.description('启用对比学习模块'),
}).description('对比学习配置'),

// 当 enable_contrastive = true 时,才展示下面这些配置;否则只用空对象
Schema.union([
Schema.object({
enable_contrastive: Schema.const(true).required(),

negative_sampling_method: Schema.union([
'Random-Noise', 'Permutation', 'Random-index', 'Circular', 'Hard-Negative',
])
.default('Random-Noise')
.description('选择负样本生成策略'),

noise_strength: Schema.number()
.step(0.5)
.min(0)
.max(10)
.default(1.0)
.description('噪音强度参数'),

contrastive_weight: Schema.number()
.step(0.05)
.min(0)
.max(1)
.default(0.05)
.description('对比损失权重'),

contrastive_warmup_steps: Schema.number()
.step(10)
.default(100)
.description('使用随机负样本的步数'),
}),
Schema.object({}),
]),
]),
// 预览图设置
SHARED_SCHEMAS.PREVIEW_IMAGE,

Expand Down
45 changes: 43 additions & 2 deletions mikazuki/schema/lumina2-lora.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Schema.intersect([
scale_weight_norms: Schema.number().step(0.01).min(0).default(1.0).description("最大范数正则化。如果使用,推荐为 1"),
network_args_custom: Schema.array(String).role('table').description('自定义 network_args,一行一个'),
enable_base_weight: Schema.boolean().default(false).description('启用基础权重(差异炼丹)'),
network_scale: Schema.number().step(0.05).default(1.0).description('网络缩放系数,应该小于等于1.0'),
}).description("网络设置"),

// lycoris 参数
Expand All @@ -64,7 +65,47 @@ Schema.intersect([

SHARED_SCHEMAS.NETWORK_OPTION_BASEWEIGHT,
]),

Schema.intersect([
// 对比学习主开关
Schema.object({
enable_contrastive: Schema.boolean()
.default(false)
.description('启用对比学习模块'),
}).description('对比学习配置'),

// 当 enable_contrastive = true 时,才展示下面这些配置;否则只用空对象
Schema.union([
Schema.object({
enable_contrastive: Schema.const(true).required(),

negative_sampling_method: Schema.union([
'Random-Noise', 'Permutation', 'Random-index', 'Circular', 'Hard-Negative',
])
.default('Random-Noise')
.description('选择负样本生成策略'),

noise_strength: Schema.number()
.step(0.5)
.min(0)
.max(10)
.default(1.0)
.description('噪音强度参数'),

contrastive_weight: Schema.number()
.step(0.05)
.min(0)
.max(1)
.default(0.05)
.description('对比损失权重'),

contrastive_warmup_steps: Schema.number()
.step(10)
.default(100)
.description('使用随机负样本的步数'),
}),
Schema.object({}),
]),
]),
// 预览图设置
SHARED_SCHEMAS.PREVIEW_IMAGE,

Expand Down Expand Up @@ -96,4 +137,4 @@ Schema.intersect([

// 分布式训练
SHARED_SCHEMAS.DISTRIBUTED_TRAINING
]);
]);
45 changes: 43 additions & 2 deletions mikazuki/schema/sd3-lora.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Schema.intersect([

// 保存设置
SHARED_SCHEMAS.SAVE_SETTINGS,

Schema.object({
max_train_epochs: Schema.number().min(1).default(20).description("最大训练 epoch(轮数)"),
train_batch_size: Schema.number().min(1).default(1).description("批量大小, 越高显存占用越高"),
Expand All @@ -46,6 +46,7 @@ Schema.intersect([
network_alpha: Schema.number().min(1).default(1).description("常用值:等于 network_dim 或 network_dim*1/2 或 1。使用较小的 alpha 需要提升学习率"),
network_args_custom: Schema.array(String).role('table').description('自定义 network_args,一行一个'),
enable_base_weight: Schema.boolean().default(false).description('启用基础权重(差异炼丹)'),
network_scale: Schema.number().step(0.05).default(1.0).description('网络缩放系数,应该小于等于1.0'),
}).description("网络设置"),

// lycoris 参数
Expand All @@ -54,7 +55,47 @@ Schema.intersect([

SHARED_SCHEMAS.NETWORK_OPTION_BASEWEIGHT,
]),

Schema.intersect([
// 对比学习主开关
Schema.object({
enable_contrastive: Schema.boolean()
.default(false)
.description('启用对比学习模块'),
}).description('对比学习配置'),

// 当 enable_contrastive = true 时,才展示下面这些配置;否则只用空对象
Schema.union([
Schema.object({
enable_contrastive: Schema.const(true).required(),

negative_sampling_method: Schema.union([
'Random-Noise', 'Permutation', 'Random-index', 'Circular', 'Hard-Negative',
])
.default('Random-Noise')
.description('选择负样本生成策略'),

noise_strength: Schema.number()
.step(0.5)
.min(0)
.max(10)
.default(1.0)
.description('噪音强度参数'),

contrastive_weight: Schema.number()
.step(0.05)
.min(0)
.max(1)
.default(0.05)
.description('对比损失权重'),

contrastive_warmup_steps: Schema.number()
.step(10)
.default(100)
.description('使用随机负样本的步数'),
}),
Schema.object({}),
]),
]),
// 预览图设置
SHARED_SCHEMAS.PREVIEW_IMAGE,

Expand Down
3 changes: 2 additions & 1 deletion mikazuki/schema/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@
Schema.object({
optimizer_args_custom: Schema.array(String).role('table').description('自定义 optimizer_args,一行一个'),
})

]),

PREVIEW_IMAGE: Schema.intersect([
Expand Down Expand Up @@ -240,4 +241,4 @@
}

return data
})()
})()
Loading