Update README.md
Browse files
README.md
CHANGED
|
@@ -16,21 +16,14 @@ Here we give an example model fine-tuned using 5 images of a cat downloaded from
|
|
| 16 |
|
| 17 |
## Example code of inference
|
| 18 |
```python
|
| 19 |
-
import os
|
| 20 |
-
import sys
|
| 21 |
-
import torch
|
| 22 |
|
| 23 |
-
os.system("git clone https://github.com/adobe-research/custom-diffusion")
|
| 24 |
-
sys.path.append("custom-diffusion")
|
| 25 |
from diffusers import StableDiffusionPipeline
|
| 26 |
-
from src import diffuser_training
|
| 27 |
|
| 28 |
device = 'cuda'
|
|
|
|
| 29 |
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
| 30 |
pipe = pipe.to(device)
|
| 31 |
|
| 32 |
-
weight_path = 'custom_diffusion_cat.bin'
|
| 33 |
-
diffuser_training.load_model(pipe.text_encoder, pipe.tokenizer, pipe.unet, weight_path, '<new1>')
|
| 34 |
prompt = "<new1> cat swimming in a pool"
|
| 35 |
images = pipe(prompt, num_inference_steps=200, guidance_scale=6., eta=1.).images
|
| 36 |
```
|
|
|
|
| 16 |
|
| 17 |
## Example code of inference
|
| 18 |
```python
|
|
|
|
|
|
|
|
|
|
| 19 |
|
|
|
|
|
|
|
| 20 |
from diffusers import StableDiffusionPipeline
|
|
|
|
| 21 |
|
| 22 |
device = 'cuda'
|
| 23 |
+
model_id = 'nupurkmr9/custom_diffusion_cat/cat'
|
| 24 |
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
| 25 |
pipe = pipe.to(device)
|
| 26 |
|
|
|
|
|
|
|
| 27 |
prompt = "<new1> cat swimming in a pool"
|
| 28 |
images = pipe(prompt, num_inference_steps=200, guidance_scale=6., eta=1.).images
|
| 29 |
```
|