| --- |
| license: mit |
| tags: |
| - text-to-image |
| - diffusion |
| - latent-diffusion |
| - pytorch |
| - coco |
| library_name: pytorch |
| pipeline_tag: text-to-image |
| --- |
| |
| # anilegin/lightweight-diffusion-ldm |
|
|
| Custom lightweight latent diffusion text-to-image model. |
|
|
| This repository contains inference-only files: |
|
|
| - VAE config and stripped VAE weights |
| - LDM/UNet config and stripped LDM weights |
| - diffusion/sampler code needed for DDPM and DDIM |
| - a simple `inference.py` script |
| - generation defaults in `generation_config.yaml` |
|
|
| The checkpoints are stripped to contain model weights only; optimizer state, scheduler state, and training logs are not included. |
|
|
| ## Install |
|
|
| ```bash |
| git clone https://huggingface.co/anilegin/lightweight-diffusion-ldm |
| cd lightweight-diffusion-ldm |
| pip install -r requirements.txt |
| ``` |
|
|
| ## Generate images |
|
|
| ```bash |
| python inference.py \ |
| --prompt "a small dog sitting on a red couch" \ |
| --sampler ddim \ |
| --num-steps 50 \ |
| --guidance-scale 3.0 \ |
| --precision bf16 \ |
| --output-dir outputs/example |
| ``` |
|
|
| For offline/local-only CLIP loading, make sure `openai/clip-vit-large-patch14` is cached locally and add: |
|
|
| ```bash |
| --local-files-only |
| ``` |
|
|
| ## Notes |
|
|
| This is a custom PyTorch implementation, not a native Diffusers pipeline. The included source code is required for inference. |
|
|
| ## Training data |
|
|
| Trained/evaluated with COCO-style image-caption data. Add more precise dataset, metrics, and limitations here before making the repo public. |
|
|
| ## Citation |
|
|
| If you use this model, please cite the project/repository. |
|
|