4zhvml8 发表于 2024-9-28 12:34:31

重发:AI绘画训练入门教程(1):怎么样训练你想要的的AI现实形象模型之嵌入训练篇

AI艺术家Ask AI for ART<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/utAoay4TWGZPGEXNNicibqhQmicia0bRiaW13Bd2aJ2EIt8GwUohGibiaNIgvKwIgyDxfm1VQYUJEv34UicOibmJRTOibTYQ/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p><strong style="color: blue;"><span style="color: black;">警告!<strong style="color: blue;">本文内训练生成<span style="color: black;">照片</span>仅为交流技术前沿和探讨<span style="color: black;">教育</span><span style="color: black;">运用</span>,不得<span style="color: black;">做为</span><span style="color: black;">商场</span>用途。<span style="color: black;">运用</span>深度合成技术存在<span style="color: black;">必定</span>侵权<span style="color: black;">危害</span>,本文仅为分享技术<span style="color: black;">发展</span>,并不鼓励基于真人<span style="color: black;">创立</span>形象设计,<span style="color: black;">危害</span>后果请<span style="color: black;">自动</span>承担。</strong></span></strong><strong style="color: blue;"><span style="color: black;"><strong style="color: blue;">(此前,本篇教程广受欢迎,但<span style="color: black;">咱们</span><span style="color: black;">认识</span>到其中对<span style="color: black;">以上</span>关键问题<span style="color: black;">无</span>强调!于是<span style="color: black;">咱们</span>宁愿删除它,<span style="color: black;">这次</span>重发,<span style="color: black;">咱们</span>着重强调了以上<span style="color: black;">运用</span>规则,<span style="color: black;">期盼</span><span style="color: black;">大众</span>都能自律,互联网不是法外之地,深度学习<span style="color: black;">一样</span>如此)~</strong></span></strong>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">固定的<span style="color: black;">名人</span>形象,是你<span style="color: black;">起始</span>体系化创作的<span style="color: black;">第1</span>个门槛——几乎所有故事性的创作,都会需要你有相对固定的<span style="color: black;">名人</span>形象。<span style="color: black;">能够</span>自己训练固定形象,是本地开源的stable diffusion最实用和强大的功能之一。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">是的,只要玩AIGC,训练形象模型是从浅尝辄止到生产力应用的<span style="color: black;">第1</span>步,它很重要,<span style="color: black;">同期</span>它<span style="color: black;">亦</span>是一个标准的简单的深度学习过程,<span style="color: black;">针对</span><span style="color: black;">非常多</span><span style="color: black;">无</span>接触过它的人<span style="color: black;">来讲</span>,深度学习这个<span style="color: black;">高挑</span>上名词可能就把<span style="color: black;">大众</span>吓住了。<span style="color: black;">然则</span>,它真的真的<span style="color: black;">无</span><span style="color: black;">那样</span>难!请各位<span style="color: black;">重视</span>,<span style="color: black;">咱们</span>这篇教程不是一篇深度学习的入门课,而是一篇learn by doing,顺带着让你首度直面深度学习的训练课程。<span style="color: black;">日前</span>,中文网络还比较少这类文档,<span style="color: black;">咱们</span>这篇文档结合了自己的经验,<span style="color: black;">亦</span>更新了最新的Lora模型和custom-diffusion<span style="color: black;">办法</span>的<span style="color: black;">有些</span>经验。但总体<span style="color: black;">来讲</span>,<span style="color: black;">咱们</span>对新技术还在摸索<span style="color: black;">周期</span>,本教程可能会存在<span style="color: black;">必定</span>的纰漏。</p>概念说明<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">首要</span>,<span style="color: black;">咱们</span>先介绍下在stable diffusion体系<span style="color: black;">日前</span>常用的形象训练模式。它们分别是:</p><span style="color: black;">嵌入embedding</span><span style="color: black;">Dreambooth模型</span><span style="color: black;">超网络hypernetwork</span><span style="color: black;">Dreambooth LoRA模型。</span><span style="color: black;"><strong style="color: blue;"><span style="color: black;"><span style="color: black;">每一个</span>模式都有自己优点和缺点:</span></strong></span><span style="color: black;"><span style="color: black;">嵌入的主</span><span style="color: black;">要优点是它们的灵活性和小尺寸。<span style="color: black;">嵌入是一个 <span style="color: black;">仅有</span>几KB+ 的文件(是的,它非常小),训练用时<span style="color: black;">亦</span>不算多,<span style="color: black;">能够</span>应用于<span style="color: black;">运用</span>相同<span style="color: black;">基本</span>模型(<span style="color: black;">一般</span>是<span style="color: black;">基本</span>SD1.4\1.5模型)的任何模型。</span>但它的缺点是,它<span style="color: black;">实质</span>上并不是“真正训练”了一个形象,而是<span style="color: black;">经过</span>深度学习找到了和你想要的形象一致的角色形象特征参数,<span style="color: black;">经过</span>这个小模型<span style="color: black;">保留</span>下来。这<span style="color: black;">寓意</span>着,<span style="color: black;">倘若</span>原模型里面这方面的训练缺失的,其实你很难<span style="color: black;">经过</span>嵌入让它“学会”<span style="color: black;">。</span></span></span><span style="color: black;">DB模型是一个 2GB 以上的文件,它的本质是先复制了源模型,在源模型的<span style="color: black;">基本</span>上做了微调(fine tunning)并独立形<span style="color: black;">成为了</span>一个新模型,在它的基本上<span style="color: black;">能够</span>做任何事情。缺点是,训练它需要<span style="color: black;">海量</span> VRAM,<span style="color: black;">亦</span>可能花费<span style="color: black;">海量</span>的时间,虽然<span style="color: black;">日前</span>10-12G显存的消费级显卡<span style="color: black;">亦</span>能跑,但耗时很久且文件<span style="color: black;">体积</span>很大。<span style="color: black;">倘若</span>你只是需要一个或数个<span style="color: black;">名人</span>的形象,其实它并不是最优的训练<span style="color: black;">方法</span><span style="color: black;">选取</span>。</span><span style="color: black;">超网络<span style="color: black;">hypernetwork</span>是一个 80MB 以上的文件,<span style="color: black;">位置于</span>模型之上,<span style="color: black;">能够</span>学习基本模型中不存在的新事物。它相对容易训练,<span style="color: black;">运用</span>上<span style="color: black;">亦</span>和嵌入但<span style="color: black;">通常</span><span style="color: black;">来讲</span>更适合<span style="color: black;">做为</span>微调风格的附加模型来<span style="color: black;">运用</span>。在其他模型中<span style="color: black;">运用</span>时<span style="color: black;">一般</span>不如嵌入灵活。</span><span style="color: black;">LoRA(低阶适应)是一个 36MB 以上的文件,<span style="color: black;">在训练<span style="color: black;">办法</span></span><span style="color: black;">上</span><span style="color: black;">和DB基</span><span style="color: black;">本一致</span><span style="color: black;">,但<span style="color: black;">因为</span>体积小,对显存的<span style="color: black;">需要</span>降低了,使得<span style="color: black;">非常多</span>8G显存<span style="color: black;">乃至</span>6G显存的显卡<span style="color: black;">亦</span>能参与训练,大幅降低了入门门槛。</span>在功能上LoRA与超网络非常<span style="color: black;">类似</span>。<span style="color: black;">然则</span>,它对<span style="color: black;">名人</span>形象的训练非常灵活,<span style="color: black;">非常多</span>形象<span style="color: black;">能够</span>脱离原模型嵌入其他模型<span style="color: black;">运用</span>。</span><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/utAoay4TWGZPGEXNNicibqhQmicia0bRiaW137aDia2DGkv9ErWsauyvkXO9VkH6VC9V2UIf9dc9hz6eAq4KCN8kQQEQ/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;">
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">上面这个图,是国外网站解释以上四种训练差别的示意图,<span style="color: black;">大众</span><span style="color: black;">能够</span><span style="color: black;">仔细</span><span style="color: black;">瞧瞧</span>,理解其中的差异。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在春节<span style="color: black;">时期</span>,Adobe这个<span style="color: black;">全世界</span>图像软件巨头<span style="color: black;">亦</span>和清华大学<span style="color: black;">一块</span>发布了基于嵌入的新改良办法custom-diffusion,看起来像是嵌入模型+Lora的模式,这个本艺术家今天<span style="color: black;">起始</span>测试,效果<span style="color: black;">咱们</span>后面聊。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">此刻</span><span style="color: black;">咱们</span>先从最基本的嵌入模型<span style="color: black;">起始</span>讲,<span style="color: black;">为何</span>先从嵌入讲呢?<span style="color: black;">由于</span>它最简单又最基础,有<span style="color: black;">非常多</span>新<span style="color: black;">伴侣</span>上来就和我讲要DB(dreambooth),dreambooth效果当然好,但它并不是最<span style="color: black;">有效</span>率的,我还是<span style="color: black;">意见</span><span style="color: black;">大众</span>循序渐进<span style="color: black;">把握</span>四种<span style="color: black;">区别</span>的训练技能。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;">嵌入模型训练(Embedding Training)</strong></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">第1</span>步:整理<span style="color: black;">数据集</span></strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">数据集是你要训练的<span style="color: black;">名人</span>的素材,<span style="color: black;">亦</span><span style="color: black;">便是</span>照片、<span style="color: black;">照片</span>等。</span><span style="color: black;"><span style="color: black;">做为</span>原始数据,数据集</span><span style="color: black;">是最重</span><span style="color: black;">要的!</span><span style="color: black;">!</span><span style="color: black;"><span style="color: black;">倘若</span>数据集很</span><span style="color: black;">糟糕,AI的学习<span style="color: black;">亦</span>不会有好的结果。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">因此呢</span>,你必须<span style="color: black;">保证</span>图像质量高(不模糊、<span style="color: black;">无</span>颗粒感、<span style="color: black;">无</span>失帧等),<span style="color: black;">同期</span>最好有<span style="color: black;">必定</span>的数量。<span style="color: black;">你的照片应该有<span style="color: black;">非常多</span>变化——地点、灯光、衣服、表情、活动等。</span></span><span style="color: black;"><span style="color: black;">运用</span>数量</span><span style="color: black;">更</span><span style="color: black;">多的</span><span style="color: black;">多</span><span style="color: black;">样</span><span style="color: black;">化图像</span><span style="color: black;"><span style="color: black;">寓意</span>着以更长的训练时间为代价<span style="color: black;">得到</span>更</span><span style="color: black;">高的</span><span style="color: black;">准确</span><span style="color: black;">性——<span style="color: black;">倘若</span>你不想你的角色形象<span style="color: black;">仅有</span>一两种生硬表情的话。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">通常</span><span style="color: black;">来讲</span>,<span style="color: black;">咱们</span></span><span style="color: black;"><span style="color: black;">意见</span>初学者</span><span style="color: black;"><span style="color: black;">运用</span></span><span style="color: black;">&nbsp;1</span><span style="color: black;">0 张人像</span><span style="color: black;">作</span><span style="color: black;">为起步</span><span style="color: black;">,以减少训练时间,但<span style="color: black;">倘若</span>你是老手,<span style="color: black;">能够</span>把人像<span style="color: black;">增多</span>到30-50张。那样你<span style="color: black;">能够</span>训练出一个几乎百分百还原真实角色的嵌入模型。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/utAoay4TWGZPGEXNNicibqhQmicia0bRiaW138cicoMXBKFLyzcntRyIgzMsNGUlbJNicTRdia28MyuTUtnJK5UsgkgZdA/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;"><span style="color: black;"><span style="color: black;">做为</span>示例,<span style="color: black;">咱们</span>给<span style="color: black;">大众</span>展示</span><span style="color: black;">上面这一组刘天王的数据集,</span><span style="color: black;">这一组是不是好的数据集呢?</span><span style="color: black;"><span style="color: black;">并不</span>完全是,<span style="color: black;">由于</span>14</span><span style="color: black;">张</span><span style="color: black;">照片里面大部分是半身像,</span><span style="color: black;">对面部的特写</span><span style="color: black;">并</span><span style="color: black;">不</span><span style="color: black;">够。</span></span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">从理论上讲,人类非常<span style="color: black;">善于</span>识别人脸,而 AI 则<span style="color: black;">否则</span>。</span><span style="color: black;"><span style="color: black;">咱们</span>需要给 AI 尽可能学习准确面部的最佳机会,<span style="color: black;">因此</span>,</span><span style="color: black;">一半以上的数据集应该是高质量的脸部特写,其余的是上半身和全身照片,以<span style="color: black;">捉捕</span><span style="color: black;">她们</span>的服装风格、姿势和体型等信息。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">幸好,<span style="color: black;">日前</span></span><span style="color: black;">训练嵌入对照片的分辨率<span style="color: black;">需求</span>并不很高,大部分嵌入的训练</span><span style="color: black;">数据</span><span style="color: black;">标准是512</span><span style="color: black;">*512,<span style="color: black;">因此呢</span>,<span style="color: black;">咱们</span><span style="color: black;">能够</span>很容易的</span><span style="color: black;"><span style="color: black;">运用</span><span style="color: black;">各样</span>改图</span><span style="color: black;">工具</span><span style="color: black;"><span style="color: black;">调节</span><span style="color: black;">照片</span>,对</span><span style="color: black;">面部进行特写。<span style="color: black;"><span style="color: black;">咱们</span></span><span style="color: black;"><span style="color: black;">通常</span><span style="color: black;">意见</span>60</span><span style="color: black;">%头像+</span><span style="color: black;">30</span><span style="color: black;">%半身像+</span><span style="color: black;">10%</span><span style="color: black;">全身像。当然,这并不是硬性<span style="color: black;">需求</span>。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/utAoay4TWGZPGEXNNicibqhQmicia0bRiaW13ghIHpLqRpAHVY9UGcXPmXibL8QlcKQTbBoCHNDoyvu4NKFzgjCsvIwQ/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">Birme这个在线剪裁工具是<span style="color: black;">日前</span>最好用的一个在线工具,<span style="color: black;">况且</span>它<span style="color: black;">实质</span>上并<span style="color: black;">无</span>上传照片到网上,<span style="color: black;">不消</span>怕素材<span style="color: black;">泄密</span>,所有剪裁都是基于浏览器脚本实现的,<span style="color: black;">非常</span><span style="color: black;">举荐</span><span style="color: black;">大众</span><span style="color: black;">运用</span>。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">裁剪好了<span style="color: black;">照片</span>,<span style="color: black;">而后</span><span style="color: black;">便是</span><span style="color: black;">起始</span>创建嵌入概念。</p>

    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/utAoay4TWGZPGEXNNicibqhQmicia0bRiaW13ViaZeTbaxOzIfYJdyRBwvTcbQmLdpvg6ZyWnJicicADxwCqdKA5uEwWnw/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">这个Name,<span style="color: black;">便是</span>你要给角色命名,<span style="color: black;">例如</span><span style="color: black;">咱们</span><span style="color: black;">能够</span>输入andylau,但<span style="color: black;">重视</span>,<span style="color: black;">日前</span>不支持中文。</p>

    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">初始化文本,其实<span style="color: black;">亦</span><span style="color: black;">便是</span><span style="color: black;">归类</span>,<span style="color: black;">例如</span>andylau是一个男人,<span style="color: black;">那样</span>你<span style="color: black;">能够</span>输入man,<span style="color: black;">亦</span><span style="color: black;">能够</span>输入male。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">每一个</span>token的向量数:这个<span style="color: black;">通常</span>初学者很难理解,但<span style="color: black;">实质</span>上<span style="color: black;">便是</span>你要给andylau这个概念注入的概念层数,<span style="color: black;">例如</span>andylau,他<span style="color: black;">能够</span><span style="color: black;">包含</span> man, chinese,singer,actor。占用了4个单词位,这<span style="color: black;">便是</span>4个vectors。<span style="color: black;">这般</span><span style="color: black;">通常</span>你<span style="color: black;">能够</span>把这个数值调为比4大的数值容纳<span style="color: black;">更加多</span>的概念。</p>

    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">接下来,<span style="color: black;">便是</span>图像预处理,基于webui,这都是自动化操作。</p>

    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/utAoay4TWGZpswqJ7xl7qfV3ic3ZUyeRINWlFJlW4L87PlRPyicurb6kvyVcpyjibgjMGpv9KcNJDia1OicD4DowlibQ/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">处理完这些,就<span style="color: black;">能够</span>进入真正的训练环节了。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">训练环节之中,设置好学习率,批量<span style="color: black;">体积</span>和梯度<span style="color: black;">累积</span>步数,设置好模板,就<span style="color: black;">能够</span><span style="color: black;">起始</span>训练。</p>

    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/utAoay4TWGZpswqJ7xl7qfV3ic3ZUyeRIBUtmMCene3jYtbdibxPib4wyajTXt5GCWlgTnnumIMAEaTKDCJI1keYQ/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">到了这个环节,<span style="color: black;">这儿</span>基本上<span style="color: black;">便是</span>深度学习的范畴了。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">亦</span>正是在<span style="color: black;">这儿</span>,怎么训练最有效率?怎么训练<span style="color: black;">才可</span>训练好?这些问题,<span style="color: black;">起始</span>变得玄学起来。</p>

    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">上周谷歌团队公开的调优手册里面写到:<strong style="color: blue;"><span style="color: black;">在所有类型的<span style="color: black;">设备</span>学习问题中,<span style="color: black;">无</span>优化器是“最好的”,<span style="color: black;">亦</span><span style="color: black;">便是</span>说,不存在固定的完美的训练参数。</span></strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;"><span style="color: black;">大众</span>有兴趣<span style="color: black;">能够</span>去<span style="color: black;">自动</span>阅读:</span></strong><span style="color: black;">https://github.com/google-research/tuning_playbook</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">简要<span style="color: black;">来讲</span>,训练批量<span style="color: black;">体积</span>,学习率(超参数)之间有<span style="color: black;">繁杂</span>的函数<span style="color: black;">关联</span>性关系,而训练批量对大<span style="color: black;">都数</span>人<span style="color: black;">来讲</span>,受限于硬件<span style="color: black;">尤其</span>是显存<span style="color: black;">体积</span>。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">通常</span>教程里面<span style="color: black;">亦</span>会告诉你,素材样本规模应该&gt;=批量<span style="color: black;">体积</span>*梯度<span style="color: black;">累积</span>步数&nbsp;&nbsp;&nbsp;&nbsp;</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">因此</span>,一个确定性的流程大致如下(参考谷歌调优手册):</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/utAoay4TWGZpswqJ7xl7qfV3ic3ZUyeRIReMbN6Kvygs2lOuFGfuecWRxSM6SWCABDN9kKYib5UN4fqLnsHKdWkg/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">上面这段<span style="color: black;">大众</span>可能看懵了,下面举个例子:</p>

    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">例如</span>说<span style="color: black;">咱们</span><span style="color: black;">运用</span>30张刘天王的照片进行训练,<span style="color: black;">根据</span>10G显存规模显卡的训练,批量<span style="color: black;">体积</span><span style="color: black;">能够</span>有10和6两个<span style="color: black;">选取</span>,对应的梯度<span style="color: black;">累积</span>步数则是3和5。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">通常</span>而言,在6*5这个组合下,<span style="color: black;">咱们</span><span style="color: black;">能够</span>设置0.005的默认学习率,跑个600-1000步<span style="color: black;">瞧瞧</span>效果。<span style="color: black;">亦</span><span style="color: black;">能够</span>设置递减的学习率,<span style="color: black;">例如</span> 0.2:50,0.1:100,0.05:200,0.005:500。这意思是用0.2学习率先跑50步,<span style="color: black;">而后</span>用0.1学习率跑到100步,以此类推。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">但<span style="color: black;">倘若</span>批量<span style="color: black;">体积</span>设为1,则每批只训练1张图,<span style="color: black;">那样</span>步数可能需要跑到6000步以上,显然这是比较低效率的。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">但<span style="color: black;">区别</span>的批次<span style="color: black;">体积</span>分别对应的最优学习率是未知的。<span style="color: black;">乃至</span>,有可能<span style="color: black;">由于</span>上面<span style="color: black;">说到</span>的数据质量的差异,<span style="color: black;">引起</span>类似规模的训练,<span style="color: black;">亦</span>并<span style="color: black;">不可</span>应用<span style="color: black;">一样</span>的参数去学习。</p>

    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">这<span style="color: black;">背面</span>,就完全需要经验<span style="color: black;">累积</span>和有效总结了。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">embedding的效果参考:</p>

    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/utAoay4TWGYMqMPTldSeY8YicHURy3I9iagVoXDY5kOY6cyOPaUskjjLPkdzbKibTbkC1PINZdXJByqmLJWVBJLnQ/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">然则</span>,<span style="color: black;">咱们</span><span style="color: black;">亦</span>要指出,embedding的效果有<span style="color: black;">必定</span>的限制,<span style="color: black;">例如</span><span style="color: black;">以上</span>效果是基于SD1.5模型生成的。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/utAoay4TWGYMqMPTldSeY8YicHURy3I9iaECdHV5nXzepqskKGiavFsVoYM21ohLSKexoUyQywGfotmGy8KzvHglQ/640?wx_fmt=png&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">换成PHOTOREAL2.0模型,很<span style="color: black;">显著</span>,<span style="color: black;">名人</span>五官的细微处<span style="color: black;">出现</span>了变化。<span style="color: black;"><strong style="color: blue;">这是<span style="color: black;">因为</span>主模型切换带来的变化。<span style="color: black;">亦</span><span style="color: black;">便是</span>说,embedding在<span style="color: black;">区别</span>模型之间,并<span style="color: black;">不可</span>100%完美通用,这<span style="color: black;">是由于</span>embedding的技术特征决定的。</strong></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">关于嵌入模型的<span style="color: black;">基本</span>训练教程就写到<span style="color: black;">这儿</span>,本文长达3000字,欢迎<span style="color: black;">大众</span>转发点赞,在下一篇<span style="color: black;">咱们</span>会讲一讲学习率的<span style="color: black;">选取</span>和实例测试的<span style="color: black;">状况</span>。后面<span style="color: black;">咱们</span>会更新其他训练模式的教程和心得。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;">注:本文内训练生成<span style="color: black;">照片</span>仅为交流技术前沿和探讨<span style="color: black;">教育</span><span style="color: black;">运用</span>,不<span style="color: black;">做为</span><span style="color: black;">商场</span>用途。<span style="color: black;">运用</span>深度合成技术存在<span style="color: black;">必定</span>侵权<span style="color: black;">危害</span>,<span style="color: black;">危害</span>后果请<span style="color: black;">自动</span>承担。</strong></span></p>AI绘画教程系列<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">AI绘画入门教程<span style="color: black;">基本</span>篇(5)磨刀不误砍柴工!<span style="color: black;">运用</span>XYZ表格快速<span style="color: black;">认识</span>你手头的模型到底好<span style="color: black;">欠好</span>用</span></a></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">AI绘画入门教程<span style="color: black;">基本</span>篇</span></a><a style="color: black;">(4)</a> <span style="color: black;">-1秒都不浪费!采样<span style="color: black;">办法</span>和步数的最优<span style="color: black;">选取</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">AI绘画入门教程</span></a><a style="color: black;"><span style="color: black;"><span style="color: black;">基本</span>篇</span></a><span style="color: black;">(3)&nbsp;-SDWEBUI的<span style="color: black;">基本</span>功能,你都会用了吗?</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">AI绘画入门教程<span style="color: black;">基本</span>篇(2)&nbsp;<span style="color: black;">怎样</span>写出好的prompt,<span style="color: black;">有些</span>技巧和</span></a>原则</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">AI绘画入门<span style="color: black;">基本</span>篇(1)本地安装STABLE DIFFUSION教程及答疑</span></a></p>




wrjc1hod 发表于 2024-10-3 11:42:18

感谢楼主分享,祝愿外链论坛越办越好!

1fy07h 发表于 2024-10-7 03:32:21

感谢楼主分享,祝愿外链论坛越办越好!

j8typz 发表于 2024-10-7 22:09:45

楼主听话,多发外链好处多,快到碗里来!外链论坛 http://www.fok120.com/

m5k1umn 发表于 2024-10-8 15:37:44

seo常来的论坛,希望我的网站快点收录。

4zhvml8 发表于 2024-11-1 23:40:09

外链发布论坛学习网络优化SEO。
页: [1]
查看完整版本: 重发:AI绘画训练入门教程(1):怎么样训练你想要的的AI现实形象模型之嵌入训练篇