Instructions to use BiliSakura/DiT-diffusers with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use BiliSakura/DiT-diffusers with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("BiliSakura/DiT-diffusers", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps
- Draw Things
- DiffusionBee
| license: cc-by-nc-4.0 | |
| library_name: diffusers | |
| pipeline_tag: text-to-image | |
| tags: | |
| - diffusers | |
| - dit | |
| - image-generation | |
| - class-conditional | |
| - imagenet | |
| widget: | |
| - output: | |
| url: DiT-XL-2-512/demo.png | |
| language: | |
| - en | |
| # BiliSakura/DiT-diffusers | |
| Diffusers-ready checkpoints for **Diffusion Transformers (DiT)**, re-packaged for local/offline use with a project-owned custom `DiTPipeline`. | |
| > **Re-distribution notice:** weights and configs in this repo are re-distributed from [`facebook/DiT-XL-2-512`](https://huggingface.co/facebook/DiT-XL-2-512). Original work: [Scalable Diffusion Models with Transformers (ICCV 2023)](https://openaccess.thecvf.com/content/ICCV2023/html/Peebles_Scalable_Diffusion_Models_with_Transformers_ICCV_2023_paper.html). License: [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/). | |
| This repo is derived from the development bundle in [Visual-Generative-Foundation-Model-Collection](https://github.com/Bili-Sakura/Visual-Generative-Foundation-Model-Collection). Inference only needs: | |
| - This model repo (`BiliSakura/DiT-diffusers`) | |
| - PyPI `diffusers`, `torch`, `safetensors` | |
| ## Important note | |
| This repo intentionally does **not** use Diffusers built-in `diffusers.DiTPipeline`. | |
| Instead, each model subfolder contains `pipeline.py` with a custom class named `DiTPipeline`. | |
| ## Available checkpoints | |
| | Subfolder | Resolution | Source | | |
| | --- | --- | --- | | |
| | [`DiT-XL-2-256/`](DiT-XL-2-256/) | 256Γ256 | [`facebook/DiT-XL-2-256`](https://huggingface.co/facebook/DiT-XL-2-256) | | |
| | [`DiT-XL-2-512/`](DiT-XL-2-512/) | 512Γ512 | [`facebook/DiT-XL-2-512`](https://huggingface.co/facebook/DiT-XL-2-512) | | |
| Each subfolder is a self-contained Diffusers model repo with: | |
| - `model_index.json` (includes ImageNet `id2label`) | |
| - `pipeline.py` (custom `DiTPipeline`) | |
| - `transformer/diffusion_pytorch_model.safetensors` | |
| - `vae/diffusion_pytorch_model.safetensors` | |
| - `scheduler/scheduler_config.json` | |
| ## Demo | |
|  | |
| ```python | |
| from pathlib import Path | |
| import torch | |
| from diffusers import DiffusionPipeline | |
| model_dir = Path("path/to/DiT-XL-2-512") | |
| pipe = DiffusionPipeline.from_pretrained( | |
| str(model_dir), | |
| local_files_only=True, | |
| custom_pipeline=str(model_dir / "pipeline.py"), | |
| trust_remote_code=True, | |
| torch_dtype=torch.bfloat16, | |
| ).to("cuda") | |
| generator = torch.Generator(device="cuda").manual_seed(0) | |
| out = pipe( | |
| class_labels=[207], | |
| num_inference_steps=250, | |
| guidance_scale=4.0, | |
| generator=generator, | |
| ).images[0] | |
| out | |
| ``` | |
| ## Repo layout | |
| ```text | |
| BiliSakura/DiT-diffusers/ | |
| βββ README.md | |
| βββ DiT-XL-2-256/ | |
| βββ DiT-XL-2-512/ | |
| βββ README.md | |
| βββ model_index.json | |
| βββ pipeline.py | |
| βββ demo.png | |
| βββ transformer/ | |
| β βββ config.json | |
| β βββ diffusion_pytorch_model.safetensors | |
| βββ vae/ | |
| β βββ config.json | |
| β βββ diffusion_pytorch_model.safetensors | |
| βββ scheduler/ | |
| βββ scheduler_config.json | |
| ``` | |