DiffSynth-Studio icon indicating copy to clipboard operation
DiffSynth-Studio copied to clipboard

kolors lora安装例子进行10批训练加载效果很不好

Open lonngxiang opened this issue 1 year ago • 9 comments

这是什么原因呢,数据集太少还是训练批数不够? image

lonngxiang avatar Jul 25 '24 06:07 lonngxiang

这边另外选择了一个pokemon数据集,50张训练10批次,但加载看着效果还是微调效果不好 image

lonngxiang avatar Jul 26 '24 02:07 lonngxiang

lable用中文好像没有英文效果好

lonngxiang avatar Jul 26 '24 03:07 lonngxiang

我们在样例中提供的数据集包含约 5 张图片,部分图片分辨率不高,所以训练很久之后模型会过拟合,效果反而变差,我建议您只训练一个 epoch 并测试效果。

Artiprocher avatar Jul 29 '24 06:07 Artiprocher

对于这个 pokemon 数据集,图像的差异很大,所以我建议您增大 LoRA rank(LoRA 模型中的参数数量,换句话说是模型的容量)。

Artiprocher avatar Jul 29 '24 06:07 Artiprocher

对于这个 pokemon 数据集,图像的差异很大,所以我建议您增大 LoRA rank(LoRA 模型中的参数数量,换句话说是模型的容量)。

整体颜色风格差异不大,增大 LoRA rank这是具体指哪些参数呢

lonngxiang avatar Jul 29 '24 06:07 lonngxiang

CUDA_VISIBLE_DEVICES="0" python examples/train/kolors/train_kolors_lora.py \
  --pretrained_unet_path models/kolors/Kolors/unet/diffusion_pytorch_model.safetensors \
  --pretrained_text_encoder_path models/kolors/Kolors/text_encoder \
  --pretrained_fp16_vae_path models/sdxl-vae-fp16-fix/diffusion_pytorch_model.safetensors \
  --dataset_path data/dog \
  --output_path ./models \
  --max_epochs 1 \
  --steps_per_epoch 500 \
  --height 1024 \
  --width 1024 \
  --center_crop \
  --precision "16-mixed" \
  --learning_rate 1e-4 \
  --lora_rank 4 \
  --lora_alpha 4 \
  --use_gradient_checkpointing

其中的 --lora_rank 4 可以改成 --lora_rank 32,具体数值需要手动调优

Artiprocher avatar Jul 29 '24 06:07 Artiprocher

CUDA_VISIBLE_DEVICES="0" python examples/train/kolors/train_kolors_lora.py \
  --pretrained_unet_path models/kolors/Kolors/unet/diffusion_pytorch_model.safetensors \
  --pretrained_text_encoder_path models/kolors/Kolors/text_encoder \
  --pretrained_fp16_vae_path models/sdxl-vae-fp16-fix/diffusion_pytorch_model.safetensors \
  --dataset_path data/dog \
  --output_path ./models \
  --max_epochs 1 \
  --steps_per_epoch 500 \
  --height 1024 \
  --width 1024 \
  --center_crop \
  --precision "16-mixed" \
  --learning_rate 1e-4 \
  --lora_rank 4 \
  --lora_alpha 4 \
  --use_gradient_checkpointing

其中的 --lora_rank 4 可以改成 --lora_rank 32,具体数值需要手动调优

好的,那50张样本,max_epochs建议多少呢;另外正常lora训练要多少张就可以不错效果呢?

lonngxiang avatar Jul 29 '24 06:07 lonngxiang

我一般习惯 max_epochs=9999999,然后在训练的时候直接测,感觉效果满意之后就 kill 掉;至于需要多少张图,取决于要训什么,一只小狗的话 5 张图就够,如果是复杂的风格则需要更多训练数据

Artiprocher avatar Jul 29 '24 08:07 Artiprocher

请问数据集在哪下载的呢?

zhaoyanjoin avatar Mar 18 '25 09:03 zhaoyanjoin