Update README.md
Browse files
README.md
CHANGED
|
@@ -14,5 +14,14 @@ pip install git+https://github.com/ai-forever/kandinsky3-diffusers.git
|
|
| 14 |
### Image variations
|
| 15 |
|
| 16 |
```python
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
```
|
|
|
|
| 14 |
### Image variations
|
| 15 |
|
| 16 |
```python
|
| 17 |
+
from diffusers.models.attention_processor import Kandi3AttnProcessorIpAdapter, Kandi3AttnProcessor
|
| 18 |
+
from diffusers.pipelines.kandinsky3.kandinsky3_pipeline_ip_adapter import KandinskyV3PipelineIpAdapter
|
| 19 |
+
from PIL import Image
|
| 20 |
+
import torch
|
| 21 |
+
pipe = KandinskyV3PipelineIpAdapter.from_pretrained('ai-forever/kandinsky3_ip_adapter', torch_dtype=torch.float16, low_cpu_mem_usage=False, device_map=None)
|
| 22 |
+
pipe = pipe.to('cuda')
|
| 23 |
+
img = Image.open('path_to_img.jpg')
|
| 24 |
+
out_img = pipe(caption, img=[img], weights=[1], negative_prompt='', height=1024, width=1024, guidance_scale=7.5, num_inference_steps=50, cut_context=1)[0][0]
|
| 25 |
+
|
| 26 |
|
| 27 |
```
|