【AIGC系列】LoRA模型文生图

LoRA概念

LoRA(全称 Low-Rank Adaptation,低秩适应)是一种针对大型 AI 模型(如大语言模型 LLM、扩散模型等)的高效微调技术,核心目标是在不全量更新预训练模型参数的前提下,通过少量参数调整实现模型在特定任务 / 领域的适配,解决了大模型全量微调 “参数多、成本高、显存占用大” 的痛点。

LoRA 优势

在这里插入图片描述

LoRA典型应用场景

  • 大模型的领域适配:将通用大模型(如 GPT-3.5、LLaMA)微调为 “领域专用模型”,例如医疗领域(理解病历、医学问答)、法律领域(合同分析、法条解读)、代码领域(特定语言代码生成)。
  • 个性化定制:为模型注入 “个性化特征”,例如让 LLM 生成特定风格的文本(如古风、学术论文)、让扩散模型(如 Stable Diffusion)生成特定风格的图像(如动漫、写实人像)。
  • 多任务轻量化部署:一个基础预训练模型可搭配多个 LoRA 权重,针对不同任务(如翻译、摘要、情感分析)动态加载对应的 LoRA,无需为每个任务部署独立的全量模型,大幅降低部署成本。

我们为什么要使用LoRA

通用大模型+LoRA,生成的图片可用性会大大增强。
在这里插入图片描述

LoRA可以实现各类型的风格,让图像具有特定氛围,为画面添加指定元素,实现特定材质,提升画面质感,甚至调节人物年龄、肤色等特征
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

LoRA训练

基础大模型+少量风格数据集训练–>得到特定风格的LoRA模型,叠加大模型使用就可以得到理想画面
在这里插入图片描述

模型对比

LoRA风格效果多样,画面细节丰富,但是不能独立使用。
在这里插入图片描述

LoRA叠加使用

混合新风格

在这里插入图片描述

叠加效果

实现更精致更复杂的出图在这里插入图片描述

在这里插入图片描述

单个LoRA的权重推荐0.8-1之间,多个LoRA权重根据实际效果调整
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

LORA生图

找到喜欢的风格,尝试用多个LoRA混合生图。
本次案例使用模型:http://liblib.art/sd?id=1759055590620

在这里插入图片描述
在这里插入图片描述

deepseek提示词效果

提示词可以借助deepseek等模型
可以复制示例的提示词,然后让AI给你模仿着写。

比如说:

1girl,solo,long_hair,looking_at_viewer,brown_hair,black_hair,hair_ornament,dress,jewelry,bare_shoulders,sitting,flower,earrings,parted_lips,detached_sleeves,sky,indoors,white_dress,blue_sky,cup,petals,window,chinese_clothes,facial_mark,table,curtains,tassel,purple_dress,shawl,mountain,forehead_mark,teapot,vase,hagoromo,lotus,hanfu,open_window,round_window,windowsill,
////,(simple_background:1.2),(sdwang:1.3),Visual impact,(rei (sanbonzakura):1.2),Depth of field,absurdres,realistic,best-quality,masterpiece,with a high-end texture,RTNS,masterpiece,amazing quality,Semi-realistic,fantasy,high contrast,detailed shading,perspective,depth of field,best quality,realistic anatomy,reoen,absurdres,realistic,best-quality,masterpiece,with a high-end texture,仿照这个提示词,我想要生成一个像是阴阳师的不知火舞的古风女子的形象,请写出提示词
在这里插入图片描述
在这里插入图片描述

chatGPT5提示词效果

在这里插入图片描述
在这里插入图片描述

自己创建一个模型

使用基础模型,这是一个古风写真:https://www.liblib.art/modelinfo/f9be61d77f47427595da128ed5821460?from=search&versionUuid=b6d960ffdae54f76abec16f689e331a3

粘贴提示词

1girl,masterpiece, best quality, ultra-detailed, 1girl, solo, hanfu, ancient Chinese style, Onmyōji aesthetic, dynamic pose, long flowing black hair, red and white color scheme, hair ornament, intricate jewelry, detached sleeves, bare shoulders, looking at viewer, parted lips, seductive expression, //// fantasy, flames, cherry blossoms, traditional Japanese architecture, depth of field, absurdres, realistic, high contrast, detailed shading, cinematic lighting, RTNS, masterpiece, amazing quality, semi-realistic, fantasy, perspective

生成图片:
在这里插入图片描述

加入多种其他LoRA风格混合,调整比重
在这里插入图片描述
在这里插入图片描述
正向提示词:

1girl, solo, photorealistic, ultra realistic, long flowing hair (black to dark brown), looking at viewer, original character inspired by Onmyoji / traditional Japanese/Chinese aesthetics (do not copy any specific copyrighted character), elegant hanfu-inspired outfit with bare shoulders and detached sleeves, deep red and purple silk with gold embroidery and tassels, shawl draped over shoulders, subtle forehead mark, delicate facial mark, natural makeup, parted lips, confident gaze, hair ornament (gold + floral + flame motif), realistic hair strands, fine jewelry and earrings, holding a flame-shaped fan, sitting on a wooden windowsill, round open window, distant mountains and blue sky outside, lotus petals drifting, porcelain vase and teapot on table, soft curtain, warm rim lighting, cinematic softbox + late-afternoon golden hour, shallow depth of field, realistic skin texture, visible pores and subsurface scattering, natural specular highlights, fabric microtexture, detailed folds, realistic anatomy, photoreal skin shading, 50mm lens, f1.8, high dynamic range, 8k, masterpiece, best quality, ultra-detailed face, high resolution, film grain (subtle), natural color grading, dramatic yet soft contrast

负向提示词:

lowres, bad anatomy, deformed, blurry, cartoon, painting, watermark, signature, text, nsfw, explicit, underage, character likeness, duplicate character, uncanny valley

调整LoRA风格和参数
在这里插入图片描述
调整图片大小
在这里插入图片描述
在这里插入图片描述


大家多尝试吧,生成其他东西也可以,不用全是美女!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值