PyTorch SDK for Stable Diffusion
Top 56.3% on sourcepulse
This repository provides a minimal, self-contained PyTorch implementation of Stable Diffusion, targeting developers and researchers seeking a readable and hackable codebase for text-to-image generation. It offers core Stable Diffusion functionalities with a focus on clarity and ease of modification, enabling rapid experimentation with various generation parameters.
How It Works
The implementation is built around a simplified PyTorch architecture, directly referencing Stable Diffusion v1.x configurations. It prioritizes code readability and includes essential components for diffusion models, such as samplers and pipeline generation. The design aims to be hackable, allowing users to easily modify or extend functionalities, with loops unrolled for potential performance gains where shape allows.
Quick Start & Requirements
pip install torch numpy Pillow regex
or pip install -r requirements.txt
.data.v20221029.tar
and unpack it into the parent directory of the cloned repository.stable_diffusion_pytorch.pipeline.generate
function.Highlighted Details
k_lms
, k_euler
, k_euler_ancestral
).Maintenance & Community
The project is maintained by kjsman. No specific community channels or roadmap details are provided in the README.
Licensing & Compatibility
All code is licensed under the MIT License. However, the included checkpoint files are subject to the CreativeML Open RAIL-M License, which includes use-based restrictions. Users must adhere to this license for checkpoint usage.
Limitations & Caveats
The README notes that configurations are hard-coded for Stable Diffusion v1.x. While aiming for clarity, the author humorously describes the codebase as potentially "spaghetti," suggesting a learning curve for deep modifications. The CreativeML Open RAIL-M License for checkpoints may impose restrictions on commercial or specific use cases.
1 year ago
1 week