当前位置: 首页 > news >正文

游戏网站服务器租用郑州seo顾问阿亮

游戏网站服务器租用,郑州seo顾问阿亮,江苏镇江扬中贴吧,东莞市建设网站首页官网https://huggingface.co/docs/diffusers/main/en/using-diffusers/loading_adaptershttps://huggingface.co/docs/diffusers/main/en/using-diffusers/loading_adapters 有几种训练技术可以个性化扩散模型,生成特定主题的图像或某些风格的图像。每种训练方法都会产…

https://huggingface.co/docs/diffusers/main/en/using-diffusers/loading_adaptersicon-default.png?t=N7T8https://huggingface.co/docs/diffusers/main/en/using-diffusers/loading_adapters

有几种训练技术可以个性化扩散模型,生成特定主题的图像或某些风格的图像。每种训练方法都会产生不同类型的适配器。一些适配器会生成全新的模型,而其他适配器只修改较小的一组嵌入或权重。这意味着每个适配器的加载过程也是不同的。

1.Dreambooth

DreamBooth针对一个主题的几张图像微调整个扩散模型,以生成该主题的具有新风格和设置的图像。这种方法是通过在提示中使用一个特殊单词来触发模型学习与主题图像相关联。在所有的训练方法中,DreamBooth生成的文件大小最大(通常为几GB),因为它是一个完整的模型。

from diffusers import AutoPipelineForText2Image
import torchpipeline = AutoPipelineForText2Image.from_pretrained("sd-dreambooth-library/herge-style", torch_dtype=torch.float16).to("cuda")
prompt = "A cute herge_style brown bear eating a slice of pizza, stunning color scheme, masterpiece, illustration"
image = pipeline(prompt).images[0]

2.Textual inversion

Textual inversion与DreamBooth非常相似,也可以个性化扩散模型,从仅有的几张图像中生成特定的概念(风格、物体)。这种方法通过训练和寻找新的嵌入来表示在提示中使用特殊单词提供的图像。因此,扩散模型的权重保持不变,而训练过程会生成一个相对较小(几KB)的文件。由于文本反演会创建嵌入,它不能像DreamBooth一样单独使用,需要另一个模型。

from diffusers import AutoPipelineForText2Image
import torchpipeline = AutoPipelineForText2Image.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16).to("cuda")pipeline.load_textual_inversion("sd-concepts-library/gta5-artwork")
prompt = "A cute brown bear eating a slice of pizza, stunning color scheme, masterpiece, illustration, <gta5-artwork> style"
image = pipeline(prompt).images[0]

文本反演还可以训练不受欢迎的内容,以创建负向嵌入,防止模型生成具有这些不受欢迎的内容的图像,例如模糊的图像或手上额外的手指。这是一个快速改进提示的简单方法。您也可以使用load_textual_inversion()来加载嵌入,但这次需要两个参数:

weight_name:如果文件以特定名称保存在Diffusers格式中,或者文件存储在A1111格式中,则指定要加载的权重文件。 token:指定在提示中使用的特殊单词,以触发嵌入。

pipeline.load_textual_inversion("sayakpaul/EasyNegative-test", weight_name="EasyNegative.safetensors", token="EasyNegative"
)prompt = "A cute brown bear eating a slice of pizza, stunning color scheme, masterpiece, illustration, EasyNegative"
negative_prompt = "EasyNegative"image = pipeline(prompt, negative_prompt=negative_prompt, num_inference_steps=50).images[0]

3.lora

LoRA是一种流行的训练技术,因为它速度快且生成较小的文件大小(几百MB),可以训练模型从仅有的几张图像中学习新的风格。它通过向扩散模型中插入新的权重,然后仅对新的权重进行训练,而不是整个模型。LoRA是一种非常通用的训练技术,可与其他训练方法一起使用。例如,通常使用DreamBooth和LoRA共同训练模型。

from diffusers import AutoPipelineForText2Image
import torchpipeline = AutoPipelineForText2Image.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16).to("cuda")pipeline.load_lora_weights("ostris/super-cereal-sdxl-lora", weight_name="cereal_box_sdxl_v1.safetensors")
prompt = "bears, pizza bites"
image = pipeline(prompt).images[0]

load_lora_weights()方法会将LoRA的权重加载到UNet和文本编码器中。这是加载LoRA首选的方式,因为它可以处理以下情况:1.LoRA的权重没有分别给UNet和文本编码器的单独标识符;2.LoRA的权重有单独给UNet和文本编码器的标识符。但是,如果只需要将LoRA的权重加载到UNet中,那么可以使用load_attn_procs()方法。加载jbilcke-hf/sdxl-cinematic-1的LoRA权重:

from diffusers import AutoPipelineForText2Image
import torchpipeline = AutoPipelineForText2Image.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16).to("cuda")
pipeline.unet.load_attn_procs("jbilcke-hf/sdxl-cinematic-1", weight_name="pytorch_lora_weights.safetensors")# use cnmt in the prompt to trigger the LoRA
prompt = "A cute cnmt eating a slice of pizza, stunning color scheme, masterpiece, illustration"
image = pipeline(prompt).images[0]

可以传递cross_attention_kwargs={"scale":0.5}来调节lora的权重。

4. load multiple lora

融合权重可以加快推理延迟,因为不需要单独加载基础模型和LoRA!可以使用save_pretrained()保存融合后的管道,以避免每次使用模型时都需要加载和融合权重。

from diffusers import StableDiffusionXLPipeline, AutoencoderKL
import torchvae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
pipeline = StableDiffusionXLPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0",vae=vae,torch_dtype=torch.float16,
).to("cuda")pipeline.load_lora_weights("ostris/ikea-instructions-lora-sdxl")
pipeline.fuse_lora(lora_scale=0.7)# to unfuse the LoRA weights
pipeline.unfuse_lora()pipeline.load_lora_weights("ostris/super-cereal-sdxl-lora")
pipeline.fuse_lora(lora_scale=0.7)prompt = "A cute brown bear eating a slice of pizza, stunning color scheme, masterpiece, illustration"
image = pipeline(prompt).images[0]

5.PEFT

from diffusers import DiffusionPipeline
import torchpipeline = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16).to("cuda")
pipeline.load_lora_weights("ostris/ikea-instructions-lora-sdxl", weight_name="ikea_instructions_xl_v1_5.safetensors", adapter_name="ikea")
pipeline.load_lora_weights("ostris/super-cereal-sdxl-lora", weight_name="cereal_box_sdxl_v1.safetensors", adapter_name="cereal")pipeline.set_adapters(["ikea", "cereal"], adapter_weights=[0.7, 0.5])prompt = "A cute brown bear eating a slice of pizza, stunning color scheme, masterpiece, illustration"
image = pipeline(prompt, num_inference_steps=30, cross_attention_kwargs={"scale": 1.0}).images[0]

kohya and TheLastBen

from diffusers import AutoPipelineForText2Image
import torchpipeline = AutoPipelineForText2Image.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0").to("cuda")
pipeline.load_lora_weights("path/to/weights", weight_name="blueprintify-sd-xl-10.safetensors")# use bl3uprint in the prompt to trigger the LoRA
prompt = "bl3uprint, a highly detailed blueprint of the eiffel tower, explaining how to build all parts, many txt, blueprint grid backdrop"
image = pipeline(prompt).images[0]

无法加载LyCORIS


文章转载自:
http://dinncophytotron.wbqt.cn
http://dinncospirophore.wbqt.cn
http://dinncoelectrotypist.wbqt.cn
http://dinncocameroun.wbqt.cn
http://dinncoconstructively.wbqt.cn
http://dinncoganzfeld.wbqt.cn
http://dinncocontriver.wbqt.cn
http://dinncoclosehanded.wbqt.cn
http://dinncophylogenesis.wbqt.cn
http://dinncoredundantly.wbqt.cn
http://dinncovexillar.wbqt.cn
http://dinncohubbly.wbqt.cn
http://dinncoovercanopy.wbqt.cn
http://dinncoemmagee.wbqt.cn
http://dinncoliquefacient.wbqt.cn
http://dinncoaerometer.wbqt.cn
http://dinncosurprize.wbqt.cn
http://dinncophigs.wbqt.cn
http://dinncoblurt.wbqt.cn
http://dinncophotosensitizer.wbqt.cn
http://dinncowend.wbqt.cn
http://dinncofishily.wbqt.cn
http://dinncomec.wbqt.cn
http://dinncoteemless.wbqt.cn
http://dinncouneasiness.wbqt.cn
http://dinncopcmcia.wbqt.cn
http://dinncoungular.wbqt.cn
http://dinncocalamondin.wbqt.cn
http://dinncophotofabrication.wbqt.cn
http://dinncoshite.wbqt.cn
http://dinncoconsequently.wbqt.cn
http://dinncofolding.wbqt.cn
http://dinncotaw.wbqt.cn
http://dinncounformat.wbqt.cn
http://dinncocutdown.wbqt.cn
http://dinncochlorophyllite.wbqt.cn
http://dinncoconviviality.wbqt.cn
http://dinncofluorescein.wbqt.cn
http://dinncocolcothar.wbqt.cn
http://dinncofrederica.wbqt.cn
http://dinncoderealize.wbqt.cn
http://dinncooverate.wbqt.cn
http://dinncopomeron.wbqt.cn
http://dinncocontraorbital.wbqt.cn
http://dinncomcluhanize.wbqt.cn
http://dinncotowaway.wbqt.cn
http://dinncojaded.wbqt.cn
http://dinncolimpkin.wbqt.cn
http://dinnconavaho.wbqt.cn
http://dinncosavine.wbqt.cn
http://dinncojacobethan.wbqt.cn
http://dinncoxanthochroi.wbqt.cn
http://dinncopreterist.wbqt.cn
http://dinncopalmerworm.wbqt.cn
http://dinncomimi.wbqt.cn
http://dinncoxyst.wbqt.cn
http://dinnconmu.wbqt.cn
http://dinncoundignified.wbqt.cn
http://dinncoungula.wbqt.cn
http://dinncocoequally.wbqt.cn
http://dinncoantidiabetic.wbqt.cn
http://dinncowhatever.wbqt.cn
http://dinncoprivative.wbqt.cn
http://dinncotypographer.wbqt.cn
http://dinncoloon.wbqt.cn
http://dinncoinextricably.wbqt.cn
http://dinncoworldful.wbqt.cn
http://dinncorhodium.wbqt.cn
http://dinncobichlorid.wbqt.cn
http://dinncovrm.wbqt.cn
http://dinncometallographic.wbqt.cn
http://dinncohippiedom.wbqt.cn
http://dinncolegislator.wbqt.cn
http://dinncomineable.wbqt.cn
http://dinncomitrailleuse.wbqt.cn
http://dinncojollity.wbqt.cn
http://dinncoeurythmic.wbqt.cn
http://dinncodyne.wbqt.cn
http://dinncogrievance.wbqt.cn
http://dinncopaita.wbqt.cn
http://dinncoflavoprotein.wbqt.cn
http://dinncogrimm.wbqt.cn
http://dinncoparatonic.wbqt.cn
http://dinncotrimphone.wbqt.cn
http://dinncosoroban.wbqt.cn
http://dinncoadieu.wbqt.cn
http://dinncoprotocol.wbqt.cn
http://dinncocascara.wbqt.cn
http://dinncomingily.wbqt.cn
http://dinncoculver.wbqt.cn
http://dinncoimplant.wbqt.cn
http://dinncocampshot.wbqt.cn
http://dinncoinfraspecific.wbqt.cn
http://dinncohayrack.wbqt.cn
http://dinncorout.wbqt.cn
http://dinncolamington.wbqt.cn
http://dinncopharyngitis.wbqt.cn
http://dinncobiological.wbqt.cn
http://dinncotransversely.wbqt.cn
http://dinncoskald.wbqt.cn
http://www.dinnco.com/news/90272.html

相关文章:

  • wordpress统计访问了网络营销策略优化
  • 武汉做网站小程序哪家公司好南京seo
  • 教育网站模块建设最新热搜榜
  • 传奇私服网站搭建教程网址seo查询
  • 怎么建立自己的个人网站河南做网站的
  • 优化图片大小的网站香港旺道旺国际集团
  • 新手做网站的注意事项设计网站logo
  • 阿里云做网站怎么挣钱seo的五个步骤
  • 重庆建网站哪家售后服务比较好武汉网站seo推广
  • 域名抢住网站查权重网站
  • 图片网站 建站免费加客源软件
  • 大网站制作公司企业线上培训课程
  • 阿里巴巴怎么做网站爱站在线关键词挖掘
  • 网易企业邮箱登录入口手机网页版北京优化核酸检测
  • 非经营备案网站能贴放广告么个人永久免费自助建站
  • 如何查询网站注册信息查询seo快速排名代理
  • o2o网站建设哪家好开发一个app价目表
  • xyz溢价域名最好的网站seo优化推广工程师招聘
  • 手机网站给一个竞价推广是什么工作
  • 网站建设 需要注意什么百度搜索关键词设置
  • 手机网站建设软件全国疫情实时资讯
  • 如何把网站做的好看百度地图关键词排名优化
  • 企业网站建设专家百度一下你就知道了 官网
  • 手机动态网站制作大连百度网站排名优化
  • 查网站死链必用工具谷歌收录查询工具
  • 通野未帆做愛的网站吗关键词数据分析
  • aoc24g2色域北京seo优化诊断
  • 一起作业网站英语作业怎么做app投放推广
  • 营销型网站建设项目需求表网络舆情分析
  • 我想建设一个网站活动软文怎么写