# fast-constrained-sampling
Code for **Fast constrained sampling in pre-trained diffusion models**

[[arXiv]](https://arxiv.org/abs/2410.18804)


| Image | Inpainting Steps |
| - | - |
| <img src="assets/thecat_masked.jpg" alt="drawing" width="300"/> | <img src="assets/thecat_inpainting.gif" alt="drawing" width="300"/> |

## Usage
In `stable-diffusion` we provide an implementation based on the [LDM repository](https://github.com/CompVis/stable-diffusion).

In `diffusers` we provide an implementation using the [diffusers](https://huggingface.co/docs/diffusers/index) library.


## Bibtex

```
@article{graikos2024fast,
  title={Fast constrained sampling in pre-trained diffusion models},
  author={Graikos, Alexandros and Jojic, Nebojsa and Samaras, Dimitris},
  journal={arXiv preprint arXiv:2410.18804},
  year={2024}
}
```
