AIGC文生图lora微调训练案例;SD-Train界面训练stable Diffusion lora模型

lora仓库(1000多个lora微调模型分享):

https://lorastudio.co/models

1、命令代码方式:文生图lora微调训练案例

主要用huggingface相关包:peft、accelerate、diffusers

参考:

https://huggingface.co/blog/lora

https://github.com/huggingface/diffusers/blob/main/examples/text_to_image/train_text_to_image_lora.py ##官方案例代码

https://civitai.com/articles/3105/essential-to-advanced-guide-to-training-a-lora

https://github.com/PixArt-alpha/PixArt-alpha?tab=readme-ov-file (微调脚本基本也是上面官方diffusers的例子)

cpp 复制代码
#下载
git clone https://github.com/PixArt-alpha/PixArt-alpha.git 

#运行
一张4090(更改num_processes=1即可)
accelerate launch --num_processes=1 --main_process_port=36667 train_scripts/train_pixart_lora_hf.py --mixed_precision="fp16" --pretrained_model_name_or_path=/ai/PixArt-XL-2-1024-MS --dataset_name=reach-vb/pokemon-blip-captions --caption_column="text" --resolution=1024 --random_flip --train_batch_size=6 --num_train_epochs=200 --checkpointing_steps=100 --learning_rate=1e-06 --lr_scheduler="constant" --lr_warmup_steps=0 --seed=42 --output_dir="pixart-pokemon-model" --validation_prompt="cute dragon creature" --report_to="tensorboard" --gradient_checkpointing --checkpoints_total_limit=10 --validation_epochs=5 --rank=16
两张4090
accelerate launch --num_processes=2 --main_process_port=36667 train_scripts/train_pixart_lora_hf.py --mixed_precision="fp16" --pretrained_model_name_or_path=/ai/PixArt-XL-2-1024-MS --dataset_name=reach-vb/pokemon-blip-captions --caption_column="text" --resolution=1024 --random_flip --train_batch_size=6 --num_train_epochs=200 --checkpointing_steps=100 --learning_rate=1e-06 --lr_scheduler="constant" --lr_warmup_steps=0 --seed=42 --output_dir="pixart-pokemon-model" --validation_prompt="cute dragon creature" --report_to="tensorboard" --gradient_checkpointing --checkpoints_total_limit=10 --validation_epochs=5 --rank=16

训练时间有点久,200轮

2、可视化界面操作:SD-Train lora

工具相对局限于stable Diffusion 模型才可以微调,其他模型不大支持

参考:

https://github.com/Akegarasu/lora-scripts/blob/main/README-zh.md

https://www.bilibili.com/video/BV15E421G7Qb/

https://www.bilibili.com/video/BV1CA4m1w7zh/

一般使用步骤:

WD标签器与标签编辑器:主要是对图片进行文案prompt反推和编辑文案内容

Lora训练:进行lora训练

相关推荐
全栈弄潮儿39 分钟前
用 AI 生成单元测试:从第一个测试用例开始
aigc·openai·ai编程
AI发掘1 小时前
手写稿被AI检测误标58%?三款AI降重工具实测:只改疑似段,不动原创内容
人工智能·aigc
qy2016skq1 小时前
OpenClaw 源码解读——入门与破局9 双插件协同:Quota Guard 负责“停“,Model Router 负责“绕“
langchain·prompt·aigc·embedding·ai编程·llama·agi
leeyi2 小时前
Agent 间 Transfer 交接:用户在不同 Agent 间无缝切换(第93篇-E79)
人工智能·aigc·agent
李剑一2 小时前
前端转AI要了解的技术,其他人不用看。前端架构基础之:让Js的计算运行在GPU上
前端·aigc·ai编程
qy2016skq3 小时前
OpenClaw 源码解读——入门与破局8 从“报错不切换“到“秒级自动切换“:模型路由插件在 2026.4.14 上的五次迭代实录
langchain·prompt·aigc·embedding·ai编程·ai-native
芯小途202613 小时前
微短剧新规 9 月 1 日施行:AIGC 微短剧的「AI 标识 + 占比追溯」怎么在制作流水线里落地(附自查脚本)
人工智能·aigc
kaliarch14 小时前
WorkBuddy Skill:把重复 SOP 打成可调用的手册包
aigc
Dawson Zhu16 小时前
图结构(Graph)如何重构智能体认知?从DAG规划到GraphRAG的技术拆解
人工智能·语言模型·重构·架构·aigc
奈斯先生Vector16 小时前
从 127.0.0.1:3080 到插件运行时:DeepSeek Harness 远程开发与版本治理实战
linux·运维·人工智能·ubuntu·aigc