【AI绘画重磅开源】Stable Diffusion 3.5 Large 和 Large Turbo 让任何人都 ...

打印 上一主题 下一主题

主题 1864|帖子 1864|积分 5592


Stable Diffusion 3.5模型发布,图像生成更真实,性能提升,并专注于多样化输出和易用性。
StabilityAI昨天发布了其全新的Stable Diffusion 3.5系列 AI 图像模型,与之前的3.0版本相比,这次升级明显进步了图像的逼真度、对提示的响应能力以及文本渲染效果。
与 SD3.0 类似,Stable Diffusion 3.5有三个版本——大型版 (8B)、大型加速版 (8B Turbo) 和中型版 (2.6B)。这些模型都可以根据用户需求进行定制,并能在消费级硬件上运行,同时也可以通过稳定AI社区许可证使用。
简单来说,这一升级让任何用户都能更轻松地生成逼真的 AI 图像。在一份新闻稿中,StabilityAI承认今年6月发布的中型模型“未能完全到达我们的标准或社区的期望”。
公司进一步解释道:“在听取了宝贵的社区反馈后,我们决定花更多时间开辟一个可以大概推进我们改变视觉媒体使命的版本,而不是快速修补。”
我们的AI编辑Ryan Morrison已经测试了3.5版,他认为这次升级明显提升,甚至大概超过迩来发布的Flux 1.1 Pro的能力。
Stable Diffusion3.5有什么新功能?

StabilityAI 表现,新模型的重点是可定制性、高效性能和多样化输出。“Stable Diffusion3.5是我们迄今为止最强大的模型,体现了我们为创作者提供广泛可用且先辈工具的承诺。”公司发言人解释道。
这意味着图像可以进行精细调解,模型可以“开箱即用”在消费级硬件上运行,生成的图像会更加独特。


Ryan Morrison 对Stable Diffusion 3.5的大型版进行了快速测试,发现其生成速度快,可以大概准确响应提示,且风格控制能力强。相比3.0版尤其是中型版,这次升级明显。
新版本还加入了更多的风格选择,包括摄影、绘画等,甚至可以通过标签提示来指定特定风格,如波西米亚风格或时尚风格。此外,通过在提示中突出关键字,可以引导模型朝特定方向发展。
公司分析指出:“Stable Diffusion 3.5大型版在提示响应方面处于市场领先地位,图像质量也与更大规模的模型相媲美。”
“Stable Diffusion 3.5加速版提供了同级别中最快的推理速度,且在图像质量和提示响应上也保持了高度竞争力,即便与其他同规模非蒸馏模型相比。”
“Stable Diffusion 3.5中型版则在中型模型中体现优秀,兼顾了提示响应和图像质量,是高效且高质量体现的理想选择。”
该模型可供非商业用途免费使用,包括科研项目,以及年收入不超过100万美元的小型和中型企业使用。超过这一收入范围的企业则需获得企业许可证。
Github:https://github.com/Stability-AI/sd3.5
stable-diffusion-3.5-large

Huggingface: stabilityai/stable-diffusion-3.5-large

Stable Diffusion 3.5 Large 是一个多模式扩散变更器(MMDiT)文本到图像模型,在图像质量、排版、复杂提示理解和资源效率方面都有改进。
  1. ├── text_encoders/  
  2. │   ├── README.md
  3. │   ├── clip_g.safetensors
  4. │   ├── clip_l.safetensors
  5. │   ├── t5xxl_fp16.safetensors
  6. │   └── t5xxl_fp8_e4m3fn.safetensors
  7. ├── README.md
  8. ├── LICENSE
  9. ├── sd3_large.safetensors
  10. ├── SD3.5L_example_workflow.json
  11. └── sd3_large_demo.png
  12. ** File structure below is for diffusers integration**
  13. ├── scheduler/
  14. ├── text_encoder/
  15. ├── text_encoder_2/
  16. ├── text_encoder_3/
  17. ├── tokenizer/
  18. ├── tokenizer_2/
  19. ├── tokenizer_3/
  20. ├── transformer/
  21. ├── vae/
  22. └── model_index.json
复制代码
快速上手

  1. pip install -U diffusers
复制代码
  1. import torch
  2. from diffusers import StableDiffusion3Pipeline
  3. pipe = StableDiffusion3Pipeline.from_pretrained("stabilityai/stable-diffusion-3.5-large", torch_dtype=torch.bfloat16)
  4. pipe = pipe.to("cuda")
  5. image = pipe(
  6.     "A capybara holding a sign that reads Hello World",
  7.     num_inference_steps=28,
  8.     guidance_scale=3.5,
  9. ).images[0]
  10. image.save("capybara.png")
复制代码
我手头上24GB也 out of memory /(ㄒoㄒ)/~~
使用扩散器量化模型 减少 VRAM 使用量,让模型得当低 VRAM GPU
  1. pip install bitsandbytes
复制代码
  1. from diffusers import BitsAndBytesConfig, SD3Transformer2DModel
  2. from diffusers import StableDiffusion3Pipeline
  3. import torch
  4. model_id = "stabilityai/stable-diffusion-3.5-large"
  5. nf4_config = BitsAndBytesConfig(
  6.     load_in_4bit=True,
  7.     bnb_4bit_quant_type="nf4",
  8.     bnb_4bit_compute_dtype=torch.bfloat16
  9. )
  10. model_nf4 = SD3Transformer2DModel.from_pretrained(
  11.     model_id,
  12.     subfolder="transformer",
  13.     quantization_config=nf4_config,
  14.     torch_dtype=torch.bfloat16
  15. )
  16. pipeline = StableDiffusion3Pipeline.from_pretrained(
  17.     model_id,
  18.     transformer=model_nf4,
  19.     torch_dtype=torch.bfloat16
  20. )
  21. pipeline.enable_model_cpu_offload()
  22. prompt = "A whimsical and creative image depicting a hybrid creature that is a mix of a waffle and a hippopotamus, basking in a river of melted butter amidst a breakfast-themed landscape. It features the distinctive, bulky body shape of a hippo. However, instead of the usual grey skin, the creature's body resembles a golden-brown, crispy waffle fresh off the griddle. The skin is textured with the familiar grid pattern of a waffle, each square filled with a glistening sheen of syrup. The environment combines the natural habitat of a hippo with elements of a breakfast table setting, a river of warm, melted butter, with oversized utensils or plates peeking out from the lush, pancake-like foliage in the background, a towering pepper mill standing in for a tree.  As the sun rises in this fantastical world, it casts a warm, buttery glow over the scene. The creature, content in its butter river, lets out a yawn. Nearby, a flock of birds take flight"
  23. image = pipeline(
  24.     prompt=prompt,
  25.     num_inference_steps=28,
  26.     guidance_scale=4.5,
  27.     max_sequence_length=512,
  28. ).images[0]
  29. image.save("whimsical.png")
复制代码
注意:至少12GB的显存,由于enable_model_cpu_offload,内存也最好多点,我 T4 的环境没起来,就在ram爆了。P100环境能运行,建议用专业平台。(RAM 21.2GB/29 GB VRAM 11GB/16GB )
stable-diffusion-3.5-large-turbo

Huggingface: stabilityai/stable-diffusion-3.5-large-turbo

Stable Diffusion 3.5 Large Turbo 是一款多模态扩散变更器 (MMDiT) 文本到图像模型,接纳了对抗扩散蒸馏 (ADD),在图像质量、排版、复杂提示理解和资源效率方面的性能都有所进步,重点是减少了推理步调。
  1. ├── text_encoders/  (text_encoder/text_encoder_1/text_encoder_2 are for diffusers)
  2. │   ├── README.md
  3. │   ├── clip_g.safetensors
  4. │   ├── clip_l.safetensors
  5. │   ├── t5xxl_fp16.safetensors
  6. │   └── t5xxl_fp8_e4m3fn.safetensors
  7. ├── README.md
  8. ├── LICENSE
  9. ├── sd3_large_turbo.safetensors
  10. ├── SD3.5L_Turbo_example_workflow.json
  11. └── sd3_large_turbo_demo.png
  12. ** File structure below is for diffusers integration**
  13. ├── scheduler/
  14. ├── text_encoder/
  15. ├── text_encoder_2/
  16. ├── text_encoder_3/
  17. ├── tokenizer/
  18. ├── tokenizer_2/
  19. ├── tokenizer_3/
  20. ├── transformer/
  21. ├── vae/
  22. └── model_index.json
复制代码
  1. pip install -U diffusers
复制代码
  1. import torch
  2. from diffusers import StableDiffusion3Pipeline
  3. pipe = StableDiffusion3Pipeline.from_pretrained("stabilityai/stable-diffusion-3.5-large-turbo", torch_dtype=torch.bfloat16)
  4. pipe = pipe.to("cuda")
  5. image = pipe(
  6.     "A capybara holding a sign that reads Hello Fast World",
  7.     num_inference_steps=4,
  8.     guidance_scale=0.0,
  9. ).images[0]
  10. image.save("capybara.png")
复制代码
90 也没起来
减少 VRAM 使用量,让模型得当低 VRAM GPU
  1. pip install bitsandbytes
复制代码
  1. from diffusers import BitsAndBytesConfig, SD3Transformer2DModel
  2. from diffusers import StableDiffusion3Pipeline
  3. from transformers import T5EncoderModel
  4. import torch
  5. model_id = "stabilityai/stable-diffusion-3.5-large-turbo"
  6. nf4_config = BitsAndBytesConfig(
  7.     load_in_4bit=True,
  8.     bnb_4bit_quant_type="nf4",
  9.     bnb_4bit_compute_dtype=torch.bfloat16
  10. )
  11. model_nf4 = SD3Transformer2DModel.from_pretrained(
  12.     model_id,
  13.     subfolder="transformer",
  14.     quantization_config=nf4_config,
  15.     torch_dtype=torch.bfloat16
  16. )
  17. t5_nf4 = T5EncoderModel.from_pretrained("diffusers/t5-nf4", torch_dtype=torch.bfloat16)
  18. pipeline = StableDiffusion3Pipeline.from_pretrained(
  19.     model_id,
  20.     transformer=model_nf4,
  21.     text_encoder_3=t5_nf4,
  22.     torch_dtype=torch.bfloat16
  23. )
  24. pipeline.enable_model_cpu_offload()
  25. prompt = "A whimsical and creative image depicting a hybrid creature that is a mix of a waffle and a hippopotamus, basking in a river of melted butter amidst a breakfast-themed landscape. It features the distinctive, bulky body shape of a hippo. However, instead of the usual grey skin, the creature's body resembles a golden-brown, crispy waffle fresh off the griddle. The skin is textured with the familiar grid pattern of a waffle, each square filled with a glistening sheen of syrup. The environment combines the natural habitat of a hippo with elements of a breakfast table setting, a river of warm, melted butter, with oversized utensils or plates peeking out from the lush, pancake-like foliage in the background, a towering pepper mill standing in for a tree.  As the sun rises in this fantastical world, it casts a warm, buttery glow over the scene. The creature, content in its butter river, lets out a yawn. Nearby, a flock of birds take flight"
  26. image = pipeline(
  27.     prompt=prompt,
  28.     num_inference_steps=4,
  29.     guidance_scale=0.0,
  30.     max_sequence_length=512,
  31. ).images[0]
  32. image.save("whimsical.png")
复制代码
注意:至少12GB的显存,由于enable_model_cpu_offload,内存也最好多点,我 T4 的环境没起来,就在ram爆了。P100环境能运行,建议用专业平台。(RAM 27.7GB/29 GB VRAM 8.3GB/16GB )
最后

跑分神器 SD family:


  • T0: SD3.5
  • T1: SD3
  • T2: SDXL
  • T3: SD 1.5/2.1
你的电脑在哪一级,是不是该换了?

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

半亩花草

论坛元老
这个人很懒什么都没写!
快速回复 返回顶部 返回列表