{"id":13456176,"url":"https://github.com/huggingface/diffusers","last_synced_at":"2026-05-01T07:03:53.760Z","repository":{"id":37080475,"uuid":"498011141","full_name":"huggingface/diffusers","owner":"huggingface","description":"🤗 Diffusers: State-of-the-art diffusion models for image, video, and audio generation in PyTorch and FLAX.","archived":false,"fork":false,"pushed_at":"2025-05-12T14:14:22.000Z","size":68973,"stargazers_count":28933,"open_issues_count":676,"forks_count":5949,"subscribers_count":212,"default_branch":"main","last_synced_at":"2025-05-12T14:49:16.466Z","etag":null,"topics":["deep-learning","diffusion","flax","flux","hacktoberfest","image-generation","image2image","image2video","jax","latent-diffusion-models","pytorch","score-based-generative-modeling","stable-diffusion","stable-diffusion-diffusers","text2image","text2video","video2video"],"latest_commit_sha":null,"homepage":"https://huggingface.co/docs/diffusers","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/huggingface.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-05-30T16:04:02.000Z","updated_at":"2025-05-12T13:56:22.000Z","dependencies_parsed_at":"2023-09-22T09:25:00.301Z","dependency_job_id":"e9b3e670-4a40-46ae-9b95-2c89c1a18d05","html_url":"https://github.com/huggingface/diffusers","commit_stats":{"total_commits":4480,"total_committers":789,"mean_commits":5.678073510773131,"dds":0.7928571428571428,"last_synced_commit":"2a1d2f62180aa01637b4c1d98e36c7570fd06b1f"},"previous_names":[],"tags_count":89,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huggingface%2Fdiffusers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huggingface%2Fdiffusers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huggingface%2Fdiffusers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huggingface%2Fdiffusers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/huggingface","download_url":"https://codeload.github.com/huggingface/diffusers/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253761013,"owners_count":21960052,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","diffusion","flax","flux","hacktoberfest","image-generation","image2image","image2video","jax","latent-diffusion-models","pytorch","score-based-generative-modeling","stable-diffusion","stable-diffusion-diffusers","text2image","text2video","video2video"],"created_at":"2024-07-31T08:01:17.313Z","updated_at":"2026-05-01T07:03:53.755Z","avatar_url":"https://github.com/huggingface.png","language":"Python","readme":"\u003c!---\nCopyright 2022 - The HuggingFace Team. All rights reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cbr\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/huggingface/diffusers/main/docs/source/en/imgs/diffusers_library.jpg\" width=\"400\"/\u003e\n    \u003cbr\u003e\n\u003cp\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/huggingface/diffusers/blob/main/LICENSE\"\u003e\u003cimg alt=\"GitHub\" src=\"https://img.shields.io/github/license/huggingface/datasets.svg?color=blue\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/huggingface/diffusers/releases\"\u003e\u003cimg alt=\"GitHub release\" src=\"https://img.shields.io/github/release/huggingface/diffusers.svg\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://pepy.tech/project/diffusers\"\u003e\u003cimg alt=\"GitHub release\" src=\"https://static.pepy.tech/badge/diffusers/month\"\u003e\u003c/a\u003e\n    \u003ca href=\"CODE_OF_CONDUCT.md\"\u003e\u003cimg alt=\"Contributor Covenant\" src=\"https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://twitter.com/diffuserslib\"\u003e\u003cimg alt=\"X account\" src=\"https://img.shields.io/twitter/url/https/twitter.com/diffuserslib.svg?style=social\u0026label=Follow%20%40diffuserslib\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n🤗 Diffusers is the go-to library for state-of-the-art pretrained diffusion models for generating images, audio, and even 3D structures of molecules. Whether you're looking for a simple inference solution or training your own diffusion models, 🤗 Diffusers is a modular toolbox that supports both. Our library is designed with a focus on [usability over performance](https://huggingface.co/docs/diffusers/conceptual/philosophy#usability-over-performance), [simple over easy](https://huggingface.co/docs/diffusers/conceptual/philosophy#simple-over-easy), and [customizability over abstractions](https://huggingface.co/docs/diffusers/conceptual/philosophy#tweakable-contributorfriendly-over-abstraction).\n\n🤗 Diffusers offers three core components:\n\n- State-of-the-art [diffusion pipelines](https://huggingface.co/docs/diffusers/api/pipelines/overview) that can be run in inference with just a few lines of code.\n- Interchangeable noise [schedulers](https://huggingface.co/docs/diffusers/api/schedulers/overview) for different diffusion speeds and output quality.\n- Pretrained [models](https://huggingface.co/docs/diffusers/api/models/overview) that can be used as building blocks, and combined with schedulers, for creating your own end-to-end diffusion systems.\n\n## Installation\n\nWe recommend installing 🤗 Diffusers in a virtual environment from PyPI or Conda. For more details about installing [PyTorch](https://pytorch.org/get-started/locally/), please refer to their official documentation.\n\n### PyTorch\n\nWith `pip` (official package):\n\n```bash\npip install --upgrade diffusers[torch]\n```\n\nWith `conda` (maintained by the community):\n\n```sh\nconda install -c conda-forge diffusers\n```\n\n### Apple Silicon (M1/M2) support\n\nPlease refer to the [How to use Stable Diffusion in Apple Silicon](https://huggingface.co/docs/diffusers/optimization/mps) guide.\n\n## Quickstart\n\nGenerating outputs is super easy with 🤗 Diffusers. To generate an image from text, use the `from_pretrained` method to load any pretrained diffusion model (browse the [Hub](https://huggingface.co/models?library=diffusers\u0026sort=downloads) for 30,000+ checkpoints):\n\n```python\nfrom diffusers import DiffusionPipeline\nimport torch\n\npipeline = DiffusionPipeline.from_pretrained(\"stable-diffusion-v1-5/stable-diffusion-v1-5\", torch_dtype=torch.float16)\npipeline.to(\"cuda\")\npipeline(\"An image of a squirrel in Picasso style\").images[0]\n```\n\nYou can also dig into the models and schedulers toolbox to build your own diffusion system:\n\n```python\nfrom diffusers import DDPMScheduler, UNet2DModel\nfrom PIL import Image\nimport torch\n\nscheduler = DDPMScheduler.from_pretrained(\"google/ddpm-cat-256\")\nmodel = UNet2DModel.from_pretrained(\"google/ddpm-cat-256\").to(\"cuda\")\nscheduler.set_timesteps(50)\n\nsample_size = model.config.sample_size\nnoise = torch.randn((1, 3, sample_size, sample_size), device=\"cuda\")\ninput = noise\n\nfor t in scheduler.timesteps:\n    with torch.no_grad():\n        noisy_residual = model(input, t).sample\n        prev_noisy_sample = scheduler.step(noisy_residual, t, input).prev_sample\n        input = prev_noisy_sample\n\nimage = (input / 2 + 0.5).clamp(0, 1)\nimage = image.cpu().permute(0, 2, 3, 1).numpy()[0]\nimage = Image.fromarray((image * 255).round().astype(\"uint8\"))\nimage\n```\n\nCheck out the [Quickstart](https://huggingface.co/docs/diffusers/quicktour) to launch your diffusion journey today!\n\n## How to navigate the documentation\n\n| **Documentation**                                                   | **What can I learn?**                                                                                                                                                                           |\n|---------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Tutorial](https://huggingface.co/docs/diffusers/tutorials/tutorial_overview)                                                            | A basic crash course for learning how to use the library's most important features like using models and schedulers to build your own diffusion system, and training your own diffusion model.  |\n| [Loading](https://huggingface.co/docs/diffusers/using-diffusers/loading)                                                             | Guides for how to load and configure all the components (pipelines, models, and schedulers) of the library, as well as how to use different schedulers.                                         |\n| [Pipelines for inference](https://huggingface.co/docs/diffusers/using-diffusers/overview_techniques)                                             | Guides for how to use pipelines for different inference tasks, batched generation, controlling generated outputs and randomness, and how to contribute a pipeline to the library.               |\n| [Optimization](https://huggingface.co/docs/diffusers/optimization/fp16)                                                        | Guides for how to optimize your diffusion model to run faster and consume less memory.                                                                                                          |\n| [Training](https://huggingface.co/docs/diffusers/training/overview) | Guides for how to train a diffusion model for different tasks with different training techniques.                                                                                               |\n## Contribution\n\nWe ❤️  contributions from the open-source community!\nIf you want to contribute to this library, please check out our [Contribution guide](https://github.com/huggingface/diffusers/blob/main/CONTRIBUTING.md).\nYou can look out for [issues](https://github.com/huggingface/diffusers/issues) you'd like to tackle to contribute to the library.\n- See [Good first issues](https://github.com/huggingface/diffusers/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) for general opportunities to contribute\n- See [New model/pipeline](https://github.com/huggingface/diffusers/issues?q=is%3Aopen+is%3Aissue+label%3A%22New+pipeline%2Fmodel%22) to contribute exciting new diffusion models / diffusion pipelines\n- See [New scheduler](https://github.com/huggingface/diffusers/issues?q=is%3Aopen+is%3Aissue+label%3A%22New+scheduler%22)\n\nAlso, say 👋 in our public Discord channel \u003ca href=\"https://discord.gg/G7tWnz98XR\"\u003e\u003cimg alt=\"Join us on Discord\" src=\"https://img.shields.io/discord/823813159592001537?color=5865F2\u0026logo=discord\u0026logoColor=white\"\u003e\u003c/a\u003e. We discuss the hottest trends about diffusion models, help each other with contributions, personal projects or just hang out ☕.\n\n\n## Popular Tasks \u0026 Pipelines\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003cth\u003eTask\u003c/th\u003e\n    \u003cth\u003ePipeline\u003c/th\u003e\n    \u003cth\u003e🤗 Hub\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr style=\"border-top: 2px solid black\"\u003e\n    \u003ctd\u003eUnconditional Image Generation\u003c/td\u003e\n    \u003ctd\u003e\u003ca href=\"https://huggingface.co/docs/diffusers/api/pipelines/ddpm\"\u003e DDPM \u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e\u003ca href=\"https://huggingface.co/google/ddpm-ema-church-256\"\u003e google/ddpm-ema-church-256 \u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr style=\"border-top: 2px solid black\"\u003e\n    \u003ctd\u003eText-to-Image\u003c/td\u003e\n    \u003ctd\u003e\u003ca href=\"https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/text2img\"\u003eStable Diffusion Text-to-Image\u003c/a\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ca href=\"https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5\"\u003e stable-diffusion-v1-5/stable-diffusion-v1-5 \u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eText-to-Image\u003c/td\u003e\n    \u003ctd\u003e\u003ca href=\"https://huggingface.co/docs/diffusers/api/pipelines/unclip\"\u003eunCLIP\u003c/a\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ca href=\"https://huggingface.co/kakaobrain/karlo-v1-alpha\"\u003e kakaobrain/karlo-v1-alpha \u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eText-to-Image\u003c/td\u003e\n    \u003ctd\u003e\u003ca href=\"https://huggingface.co/docs/diffusers/api/pipelines/deepfloyd_if\"\u003eDeepFloyd IF\u003c/a\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ca href=\"https://huggingface.co/DeepFloyd/IF-I-XL-v1.0\"\u003e DeepFloyd/IF-I-XL-v1.0 \u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eText-to-Image\u003c/td\u003e\n    \u003ctd\u003e\u003ca href=\"https://huggingface.co/docs/diffusers/api/pipelines/kandinsky\"\u003eKandinsky\u003c/a\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ca href=\"https://huggingface.co/kandinsky-community/kandinsky-2-2-decoder\"\u003e kandinsky-community/kandinsky-2-2-decoder \u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr style=\"border-top: 2px solid black\"\u003e\n    \u003ctd\u003eText-guided Image-to-Image\u003c/td\u003e\n    \u003ctd\u003e\u003ca href=\"https://huggingface.co/docs/diffusers/api/pipelines/controlnet\"\u003eControlNet\u003c/a\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ca href=\"https://huggingface.co/lllyasviel/sd-controlnet-canny\"\u003e lllyasviel/sd-controlnet-canny \u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eText-guided Image-to-Image\u003c/td\u003e\n    \u003ctd\u003e\u003ca href=\"https://huggingface.co/docs/diffusers/api/pipelines/pix2pix\"\u003eInstructPix2Pix\u003c/a\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ca href=\"https://huggingface.co/timbrooks/instruct-pix2pix\"\u003e timbrooks/instruct-pix2pix \u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eText-guided Image-to-Image\u003c/td\u003e\n    \u003ctd\u003e\u003ca href=\"https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/img2img\"\u003eStable Diffusion Image-to-Image\u003c/a\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ca href=\"https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5\"\u003e stable-diffusion-v1-5/stable-diffusion-v1-5 \u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr style=\"border-top: 2px solid black\"\u003e\n    \u003ctd\u003eText-guided Image Inpainting\u003c/td\u003e\n    \u003ctd\u003e\u003ca href=\"https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/inpaint\"\u003eStable Diffusion Inpainting\u003c/a\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ca href=\"https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-inpainting\"\u003e stable-diffusion-v1-5/stable-diffusion-inpainting \u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr style=\"border-top: 2px solid black\"\u003e\n    \u003ctd\u003eImage Variation\u003c/td\u003e\n    \u003ctd\u003e\u003ca href=\"https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/image_variation\"\u003eStable Diffusion Image Variation\u003c/a\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ca href=\"https://huggingface.co/lambdalabs/sd-image-variations-diffusers\"\u003e lambdalabs/sd-image-variations-diffusers \u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr style=\"border-top: 2px solid black\"\u003e\n    \u003ctd\u003eSuper Resolution\u003c/td\u003e\n    \u003ctd\u003e\u003ca href=\"https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/upscale\"\u003eStable Diffusion Upscale\u003c/a\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ca href=\"https://huggingface.co/stabilityai/stable-diffusion-x4-upscaler\"\u003e stabilityai/stable-diffusion-x4-upscaler \u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eSuper Resolution\u003c/td\u003e\n    \u003ctd\u003e\u003ca href=\"https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/latent_upscale\"\u003eStable Diffusion Latent Upscale\u003c/a\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ca href=\"https://huggingface.co/stabilityai/sd-x2-latent-upscaler\"\u003e stabilityai/sd-x2-latent-upscaler \u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n## Popular libraries using 🧨 Diffusers\n\n- https://github.com/microsoft/TaskMatrix\n- https://github.com/invoke-ai/InvokeAI\n- https://github.com/InstantID/InstantID\n- https://github.com/apple/ml-stable-diffusion\n- https://github.com/Sanster/lama-cleaner\n- https://github.com/IDEA-Research/Grounded-Segment-Anything\n- https://github.com/ashawkey/stable-dreamfusion\n- https://github.com/deep-floyd/IF\n- https://github.com/bentoml/BentoML\n- https://github.com/bmaltais/kohya_ss\n- +14,000 other amazing GitHub repositories 💪\n\nThank you for using us ❤️.\n\n## Credits\n\nThis library concretizes previous work by many different authors and would not have been possible without their great research and implementations. We'd like to thank, in particular, the following implementations which have helped us in our development and without which the API could not have been as polished today:\n\n- @CompVis' latent diffusion models library, available [here](https://github.com/CompVis/latent-diffusion)\n- @hojonathanho original DDPM implementation, available [here](https://github.com/hojonathanho/diffusion) as well as the extremely useful translation into PyTorch by @pesser, available [here](https://github.com/pesser/pytorch_diffusion)\n- @ermongroup's DDIM implementation, available [here](https://github.com/ermongroup/ddim)\n- @yang-song's Score-VE and Score-VP implementations, available [here](https://github.com/yang-song/score_sde_pytorch)\n\nWe also want to thank @heejkoo for the very helpful overview of papers, code and resources on diffusion models, available [here](https://github.com/heejkoo/Awesome-Diffusion-Models) as well as @crowsonkb and @rromb for useful discussions and insights.\n\n## Citation\n\n```bibtex\n@misc{von-platen-etal-2022-diffusers,\n  author = {Patrick von Platen and Suraj Patil and Anton Lozhkov and Pedro Cuenca and Nathan Lambert and Kashif Rasul and Mishig Davaadorj and Dhruv Nair and Sayak Paul and William Berman and Yiyi Xu and Steven Liu and Thomas Wolf},\n  title = {Diffusers: State-of-the-art diffusion models},\n  year = {2022},\n  publisher = {GitHub},\n  journal = {GitHub repository},\n  howpublished = {\\url{https://github.com/huggingface/diffusers}}\n}\n```\n","funding_links":[],"categories":["Python","📋 List of Open-Source Projects","Lo nuevo que está dando vuelta..","New Large-Scale Datasets","Tools","Image, Video \u0026 Multimodal Generators","Other","Video \u0026 Animation","语言资源库","其他_机器视觉","🤖 Machine Learning \u0026 AI","Official Resources","HarmonyOS","Repos","stable-diffusion","开源项目","Frameworks \u0026 Libraries","👑Stable Diffusion","二、开源库（按数据类型分类，附实用场景）","Multimodal","🧠 深度学习","📋 Contents","Machine Learning","Multimodal AI","Open Source Projects"],"sub_categories":["Tools and Extensions","🤗 diffusers: a modular toolbox for diffusion techniques","Libraries","python","网络服务_其他","Tools","Windows Manager","辅助开发工具","Python","2. 图像（高保真生成首选）","Deep Learning Frameworks","4. Diffusion Model","关键技术方向","🎨 6. Generative Media Tools"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuggingface%2Fdiffusers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuggingface%2Fdiffusers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuggingface%2Fdiffusers/lists"}