ai-forever commited on
Commit
1c703ea
1 Parent(s): 5d96bd0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +28 -1
README.md CHANGED
@@ -21,7 +21,34 @@ 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
  ```
 
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('4k 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
+ ### Image + Image mixing
28
+
29
+ ```python
30
+ from diffusers.models.attention_processor import Kandi3AttnProcessorIpAdapter, Kandi3AttnProcessor
31
+ from diffusers.pipelines.kandinsky3.kandinsky3_pipeline_ip_adapter import KandinskyV3PipelineIpAdapter
32
+ from PIL import Image
33
+ import torch
34
+ pipe = KandinskyV3PipelineIpAdapter.from_pretrained('ai-forever/kandinsky3_ip_adapter', torch_dtype=torch.float16, low_cpu_mem_usage=False, device_map=None)
35
+ pipe = pipe.to('cuda')
36
+ img1 = Image.open('path_to_img1.jpg')
37
+ img2 = Image.open('path_to_img2.jpg')
38
 
39
+ out_img = pipe('4k photo', img=[img1, img2], weights=[0.5, 0.5], negative_prompt='', height=1024, width=1024, guidance_scale=7.5, num_inference_steps=50, cut_context=1)[0][0]
40
+ ```
41
+
42
+ ### Text + Image mixing
43
 
44
+ ```python
45
+ from diffusers.models.attention_processor import Kandi3AttnProcessorIpAdapter, Kandi3AttnProcessor
46
+ from diffusers.pipelines.kandinsky3.kandinsky3_pipeline_ip_adapter import KandinskyV3PipelineIpAdapter
47
+ from PIL import Image
48
+ import torch
49
+ pipe = KandinskyV3PipelineIpAdapter.from_pretrained('ai-forever/kandinsky3_ip_adapter', torch_dtype=torch.float16, low_cpu_mem_usage=False, device_map=None)
50
+ pipe = pipe.to('cuda')
51
+ img = Image.open('path_to_img.jpg')
52
+ caption = 'cat, 4k photo'
53
+ 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, img_weight=0.5)[0][0]
54
  ```