File size: 1,215 Bytes
b99b14c 32d8ca8 6f5223f 32d8ca8 b99b14c 2566a25 de6b3d7 2566a25 de6b3d7 2566a25 9c83d9b 2566a25 9c83d9b 2566a25 f6d8e85 2566a25 9c83d9b 2566a25 d12b46a e450099 d12b46a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
---
license: other
tags:
- pytorch
- stable-diffusion
- stable-diffusion-diffusers
- diffusers
---
# This is a Custom Diffusion model fine-tuned from the Stable Diffusion v1-4.
Custom Diffusion allows you to fine-tune text-to-image diffusion models, such as Stable Diffusion, given a few images of a new concept (~4-20).
Here we give an example model fine-tuned using 5 images of a cat downloaded from UnSplash. The example code of inference is shown below.
## Example code of inference
```
git clone https://github.com/adobe-research/custom-diffusion
cd custom-diffusion
```
```python
from diffusers import StableDiffusionPipeline
from src import diffuser_training
device = 'cuda'
model_id = "CompVis/stable-diffusion-v1-4"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipe = pipe.to(device)
diffuser_training.load_model(pipe.text_encoder, pipe.tokenizer, pipe.unet, 'custom_diffusion_cat.bin')
prompt = "<new1> cat swimming in a pool"
images = pipe(prompt, num_inference_steps=200, guidance_scale=6., eta=1.).images
```
<center>
<img src="https://huggingface.co/nupurkmr9/custom_diffusion_cat/resolve/main/cat.png" width="600" align="center" >
</center>
|