majian0318 commited on
Commit
cd51572
·
verified ·
1 Parent(s): 92c0dd7

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +34 -5
README.md CHANGED
@@ -31,25 +31,21 @@ pip install torch
31
  pip install git+https://github.com/huggingface/diffusers
32
  ```
33
 
34
- ### Qwen-Image-Edit-Pruning Inference
35
  ```python
36
  from diffusers import QwenImageEditPipeline
37
  import os
38
  from PIL import Image
39
  import time
40
  import torch
41
-
42
  model_name = "OPPOer/Qwen-Image-Edit-Pruning/Qwen-Image-Edit-13B"
43
-
44
  pipe = QwenImageEditPipeline.from_pretrained(model_name, torch_dtype=torch.bfloat16)
45
  pipe = pipe.to('cuda')
46
-
47
  output_path = 'outputs'
48
  os.makedirs(output_path, exist_ok=True)
49
  for file_name in os.listdir('examples'):
50
  prompt = file_name.replace('_in.jpg', '')
51
  subject_img = Image.open(os.path.join('examples', file_name)).convert('RGB')
52
-
53
  t1 = time.time()
54
  inputs = {
55
  "image": subject_img,
@@ -63,4 +59,37 @@ for file_name in os.listdir('examples'):
63
  output_image = output.images[0]
64
  output_image.save(os.path.join(output_path, f'{prompt}.jpg'))
65
  print(time.time()-t1)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  ```
 
31
  pip install git+https://github.com/huggingface/diffusers
32
  ```
33
 
34
+ ### Qwen-Image-Edit-13B Inference
35
  ```python
36
  from diffusers import QwenImageEditPipeline
37
  import os
38
  from PIL import Image
39
  import time
40
  import torch
 
41
  model_name = "OPPOer/Qwen-Image-Edit-Pruning/Qwen-Image-Edit-13B"
 
42
  pipe = QwenImageEditPipeline.from_pretrained(model_name, torch_dtype=torch.bfloat16)
43
  pipe = pipe.to('cuda')
 
44
  output_path = 'outputs'
45
  os.makedirs(output_path, exist_ok=True)
46
  for file_name in os.listdir('examples'):
47
  prompt = file_name.replace('_in.jpg', '')
48
  subject_img = Image.open(os.path.join('examples', file_name)).convert('RGB')
 
49
  t1 = time.time()
50
  inputs = {
51
  "image": subject_img,
 
59
  output_image = output.images[0]
60
  output_image.save(os.path.join(output_path, f'{prompt}.jpg'))
61
  print(time.time()-t1)
62
+ ```
63
+
64
+ ### Qwen-Image-Edit-13B Inference
65
+ ```python
66
+ import os
67
+ import torch
68
+ from PIL import Image
69
+ from diffusers import QwenImageEditPlusPipeline
70
+
71
+ model_name = f"OPPOer/Qwen-Image-Edit-Pruning/Qwen-Image-Edit-2509-14B"
72
+ pipeline = QwenImageEditPlusPipeline.from_pretrained(model_name, torch_dtype=torch.bfloat16)
73
+ print("pipeline loaded")
74
+
75
+ pipeline.to('cuda')
76
+ pipeline.set_progress_bar_config(disable=None)
77
+ image1 = Image.open("input1.jpg")
78
+ image2 = Image.open("input2.jpg")
79
+ prompt = "美女坐在沙发上"
80
+ inputs = {
81
+ "image": [image1, image2],
82
+ "prompt": prompt,
83
+ "generator": torch.manual_seed(0),
84
+ "true_cfg_scale": 4.0,
85
+ "negative_prompt": " ",
86
+ "num_inference_steps": 40,
87
+ "guidance_scale": 1.0,
88
+ "num_images_per_prompt": 1,
89
+ }
90
+ with torch.inference_mode():
91
+ output = pipeline(**inputs)
92
+ output_image = output.images[0]
93
+ output_image.save("output_image_edit_plus.png")
94
+ print("image saved at", os.path.abspath("output_image_edit_plus.png"))
95
  ```