Instructions to use stabilityai/stable-diffusion-3.5-large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use stabilityai/stable-diffusion-3.5-large with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-3.5-large", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
|
Download README.md from stabilityai/stable-diffusion-3.5-large: direct link, hf CLI and curl.
- Browser
- Download file 9.64 kB
-
https://huggingface.co/stabilityai/stable-diffusion-3.5-large/resolve/refs%2Fpr%2F51/README.md
- Command line
-
hf download hf://stabilityai/stable-diffusion-3.5-large@refs/pr/51/README.md
-
curl -L -H "Authorization: Bearer $HF_TOKEN" -o README.md https://huggingface.co/stabilityai/stable-diffusion-3.5-large/resolve/refs%2Fpr%2F51/README.md
9.64 kB
| license: other | |
| license_name: stabilityai-ai-community | |
| license_link: LICENSE.md | |
| tags: | |
| - text-to-image | |
| - stable-diffusion | |
| - diffusers | |
| - art | |
| - music | |
| inference: true | |
| extra_gated_prompt: >- | |
| By clicking "Agree", you agree to the [License | |
| Agreement](https://huggingface.co/stabilityai/stable-diffusion-3.5-large/blob/main/LICENSE.md) | |
| and acknowledge Stability AI's [Privacy | |
| Policy](https://stability.ai/privacy-policy). | |
| extra_gated_fields: | |
| Name: text | |
| Email: text | |
| Country: country | |
| Organization or Affiliation: text | |
| Receive email updates and promotions on Stability AI products, services, and research?: | |
| type: select | |
| options: | |
| - 'Yes' | |
| - 'No' | |
| What do you intend to use the model for?: | |
| type: select | |
| options: | |
| - Research | |
| - Personal use | |
| - Creative Professional | |
| - Startup | |
| - Enterprise | |
| I agree to the License Agreement and acknowledge Stability AI's Privacy Policy: checkbox | |
| language: | |
| - en | |
| - aa | |
| - ae | |
| pipeline_tag: image-to-image | |
| datasets: | |
| - microsoft/orca-agentinstruct-1M-v1 | |
| new_version: genmo/mochi-1-preview | |
| library_name: adapter-transformers | |
| #稳定扩散3.5大 | |
|  | |
| ##模型 | |
|  | |
| [稳定扩散3.5大](https://stability.ai/news/introducing-stable-diffusion-3-5)是一种多模式扩散转换器(MMDiT)文本到图像模型,其特点是在图像质量、排版、复杂的即时理解和资源效率方面提高了性能。 | |
| 请注意:此型号发布于[稳定性社区许可证](https://stability.ai/community-license-agreement).访问[稳定性AI](https://stability.ai/license)学习或[联系我们](https://stability.ai/enterprise)有关商业许可的详细信息。 | |
| ###型号说明 | |
| - **编制单位:**稳定性AI | |
| - **型号类型:**MMDiT文本到图像生成模型 | |
| - **型号说明:**此模型根据文本提示生成图像。[多模扩散变压器](https://arxiv.org/abs/2403.03206)使用三个固定的、预训练的文本编码器,并使用QK标准化来提高训练稳定性。 | |
| ###许可证 | |
| - **社区许可证:**每年总收入低于100万美元的组织或个人可免费用于研究、非商业和商业用途。更多详情请参阅[社区许可协议](https://stability.ai/community-license-agreement)。更多信息请访问https://stability.ai/license. | |
| - **年收入超过100万美元的个人和组织**:请[联系我们](https://stability.ai/enterprise)获得企业许可证。 | |
| ###模型源 | |
| 对于本地或自托管使用,我们建议[ComfyUI](https://github.com/comfyanonymous/ComfyUI)用于基于节点的UI推断,或[扩散器](https://github.com/huggingface/diffusers)或[GitHub](https://github.com/Stability-AI/sd3.5)供编程使用。 | |
| - **ComfyUI:** [GitHub](https://github.com/comfyanonymous/ComfyUI),[工作流示例](https://comfyanonymous.github.io/ComfyUI_examples/sd3/) | |
| - **拥抱面空间:** [空间](https://huggingface.co/spaces/stabilityai/stable-diffusion-3.5-large) | |
| - **扩散器**:[见下文](#using-with-diffusers). | |
| - **GitHub**:[GitHub](https://github.com/Stability-AI/sd3.5). | |
| - **API端点:** | |
| - [稳定性AI API](https://platform.stability.ai/docs/api-reference#tag/Generate/paths/~1v2beta~1stable-image~1generate~1sd3/post) | |
| - [复制](https://replicate.com/stability-ai/stable-diffusion-3.5-large) | |
| - [Deepinfra](https://deepinfra.com/stabilityai/sd3.5) | |
| ###实施详细信息 | |
| - **QK归一化:**实施QK归一化技术,提高训练稳定性。 | |
| - **文本编码器:** | |
| -剪辑:[OpenCLIP-ViT/G](https://github.com/mlfoundations/open_clip),[夹子-ViT/L](https://github.com/openai/CLIP/tree/main),上下文长度77个标记 | |
| -T5:[T5-xxl](https://huggingface.co/google/t5-v1_1-xxl),上下文长度77/256个在训练的不同阶段的标记 | |
| - **培训数据和策略:** | |
| 这一模型是根据各种各样的数据训练的,包括合成数据和经过筛选的公开数据。 | |
| 有关原始MMDiT架构的更多技术细节,请参阅[研究论文](https://stability.ai/news/stable-diffusion-3-research-paper). | |
| ###模型性能 | |
| 看见[博客](https://stability.ai/news/introducing-stable-diffusion-3-5)为我们研究的比较表现在即时坚持和审美质量。 | |
| ##文件结构 | |
| 单击此处访问[“文件和版本”选项卡](https://huggingface.co/stabilityai/stable-diffusion-3.5-large/tree/main) | |
| ```│ | |
| ├--文本编码器/ | |
| │├--README.md | |
| │├--clip_g.safetensors | |
| │├--clip_l.safetensors | |
| │├--t5xxxl_fp16.safetensors | |
| │└--t5xxxl_fp8_e4m3fn.safetensors | |
| │ | |
| ├--README.md | |
| ├--许可证 | |
| ├--sd3_large.safetensors | |
| ├--SD3.5L_example_workflow.json | |
| └--sd3_large_demo.png | |
| **下面的文件结构用于扩散器集成** | |
| ├--调度程序/ | |
| ├--文本编码器/ | |
| ├--text_encoder_2/ | |
| ├--text_encoder_3/ | |
| ├--标记器/ | |
| ├--标记器_2/ | |
| ├--标记器_3/ | |
| ├--变压器/ | |
| ├--vae/ | |
| └--model_index.json | |
| ``` | |
| ##与散流器一起使用 | |
| 升级至最新版本的[🧨 扩散器库](https://github.com/huggingface/diffusers) | |
| ``` | |
| PIP安装-U扩散器 | |
| ``` | |
| 然后你就可以跑了 | |
| ```py | |
| 进口火炬 | |
| 从扩散器导入StableDiffusion3Pipeline | |
| 管道=稳定扩散3管道。from_pretrained(“稳定/稳定扩散-3.5-大”),torch_dtype=torch。bfloat16) | |
| pipe=pipe.to(“cuda”) | |
| image=管道( | |
| “一只手持标语的水豚”, | |
| NUM_interference_steps=28, | |
| guidance_scale=3.5, | |
| ).图像[0] | |
| image.save("capybara.png") | |
| ``` | |
| ###使用扩散器对模型进行量化 | |
| 减少您的VRAM使用量,使型号适合 🤏 VRAM GPU | |
| ``` | |
| PIP安装位和字节 | |
| ``` | |
| ```py | |
| 从扩散器导入BitsAndBytesConfig,SD3Transformer2DModel | |
| 从扩散器导入StableDiffusion3Pipeline | |
| 进口火炬 | |
| model_id="稳定/稳定扩散-3.5-大" | |
| NF4_config=BitsAndBytesConfig( | |
| load_in_4bit=真, | |
| BNB_4bit_quant_type="NF4", | |
| BNB_4bit_compute_dtype=torch.bfloat16 | |
| ) | |
| model_NF4=SD3Transformer2DModel.from_pretrained( | |
| model_id, | |
| 子文件夹="transformer", | |
| quantization_config=NF4_config, | |
| torch_dtype=torch.bfloat16 | |
| ) | |
| pipeline=StableDiffusion3Pipeline.from_pretrained( | |
| model_id, | |
| 变压器=型号NF4, | |
| torch_dtype=torch.bfloat16 | |
| ) | |
| pipeline.enable_model_cpu_offload() | |
| prompt="这是一幅异想天开、创意十足的画面,描绘了一种由华夫饼干和河马混合而成的混合生物,在早餐主题景观中,沐浴在融化的黄油河中。它以河马特有的庞大体型为特色。然而,这种生物的身体不像通常的灰色皮肤,而是像刚从烤盘上拿下来的金棕色酥脆华夫饼。表皮的纹理是熟悉的格子图案华夫饼,每个方块都充满了糖浆的光泽。这是河马的自然栖息地,有早餐餐桌的布置,一条温暖融化的黄油流淌的河流,背景是从葱郁的薄烤饼般的树叶中探出的超大餐具或盘子,还有一棵树旁边的高耸的胡椒磨。在这个奇幻的世界里,当太阳升起时,它投下了温暖的黄油般的光芒。这只满足于黄油河的生物打了个哈欠。附近,一群鸟飞走了。 | |
| image=管道( | |
| prompt=提示, | |
| NUM_interference_steps=28, | |
| 制导标度=4.5, | |
| Max_sequence_length=512, | |
| ).图像[0] | |
| image.save("whimsical.png") | |
| ``` | |
| ###微调 | |
| 请参阅微调指南[在这里](https://stabilityai.notion.site/Stable-Diffusion-3-5-Large-Fine-tuning-Tutorial-11a61cdcd1968027a15bdbd7c40be8c6). | |
| ##uses | |
| ###预期用途 | |
| 预期用途包括: | |
| *艺术作品的产生和在设计和其他艺术过程中的使用。 | |
| *在教育或创意工具中的应用。 | |
| *研究生成模型,包括理解生成模型的局限性。 | |
| 该模型的所有用途必须符合我们的[可接受的使用政策](https://stability.ai/use-policy). | |
| ###超出范围的使用 | |
| 该模型未被训练为真实或真实地表示人物或事件。因此,使用该模型生成这样的内容超出了该模型的能力范围。 | |
| ##安全 | |
| 作为我们设计安全和负责任的人工智能部署方法的一部分,我们采取了慎重的措施,以确保完整性在开发的早期阶段就开始。我们在整个模型开发过程中实施了安全措施。我们实施了旨在降低某些损害风险的安全缓解措施,但我们建议开发人员进行自己的测试,并根据其特定用例应用额外的缓解措施。 | |
| 有关我们的安全方法的更多信息,请访问我们的[安全页](https://stability.ai/safety). | |
| ###完整性评估 | |
| 我们的完整性评估方法包括针对某些损害的结构化评估和红队测试。测试主要以英语进行,可能不包括所有可能的损害。 | |
| ###已识别的风险和缓解措施: | |
| *有害内容:我们在训练模型时使用了经过筛选的数据集,并实施了保护措施,试图在有用性和防止伤害之间取得适当的平衡。但是,这并不能保证所有可能的有害内容都已被删除。高级开发人员和部署人员应谨慎行事,并根据其特定的产品策略和应用程序用例实施内容安全防护栏。 | |
| *误用:技术限制以及开发人员和最终用户培训有助于减少模型的恶意应用。所有用户都必须遵守我们的[可接受的使用政策](https://stability.ai/use-policy),包括应用微调和即时工程机制时。有关违规使用我们产品的信息,请参考稳定性AI可接受使用政策。 | |
| *隐私侵犯:鼓励开发人员和部署人员使用尊重数据隐私的技术遵守隐私法规。 | |
| ###联系 | |
| 请报告模型的任何问题或联系我们: | |
| *安全问题:safety@stability.ai | |
| *安全问题:security@stability.ai | |
| *隐私问题:privacy@stability.ai | |
| *许可证和总则:https://stability.ai/license | |
| *企业许可证:https://stability.ai/enterprise |