30 lines
1.4 KiB
PowerShell
30 lines
1.4 KiB
PowerShell
# 脸部 LoRA 训练脚本(Qwen-Image Edit-2511 / 16G 显存 / 32G 内存优化版)
|
||
# 用法:powershell -ExecutionPolicy Bypass -File 训练脚本.ps1
|
||
# 前置:素材已整理到 output/train_dataset/(img_001.jpg + img_001.txt 打标)
|
||
|
||
$ErrorActionPreference = "Stop"
|
||
$env:PYTHONUTF8 = "1"
|
||
|
||
$VENV = "D:\AI\sd\musubi-tuner\.venv\Scripts"
|
||
$TOOL = "D:\AI\sd\musubi-tuner\src\musubi_tuner"
|
||
$MODELS = "D:\AI\sd\models\qwen-edit-2511"
|
||
$PROJ = "D:\F\NewI\opencode\daily-workspace\projects\脸部LoRA训练-Qwen-Image"
|
||
|
||
$env:HF_HUB_OFFLINE = "1" # 全程离线,避免联网
|
||
|
||
& "$VENV\accelerate.exe" launch --num_cpu_threads_per_process 1 --mixed_precision bf16 `
|
||
"$TOOL\qwen_image_train_network.py" `
|
||
--dit "$MODELS\transformer\diffusion_pytorch_model-00001-of-00005.safetensors" `
|
||
--vae "$MODELS\diffusion_pytorch_model.safetensors" `
|
||
--text_encoder "$MODELS\text_encoder\model-00001-of-00004.safetensors" `
|
||
--model_version edit-2511 `
|
||
--dataset_config "$PROJ\config\dataset.toml" `
|
||
--sdpa --mixed_precision bf16 `
|
||
--timestep_sampling shift --weighting_scheme none --discrete_flow_shift 2.2 `
|
||
--optimizer_type adamw8bit --learning_rate 5e-5 `
|
||
--gradient_checkpointing `
|
||
--network_module networks.lora_qwen_image --network_dim 16 `
|
||
--fp8_base --fp8_scaled --fp8_vl --blocks_to_swap 32 `
|
||
--max_train_epochs 80 --save_every_n_epochs 10 --seed 42 `
|
||
--output_dir "$PROJ\output\checkpoints" --output_name myface_lora
|