Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -46,22 +46,19 @@ import torch
|
|
| 46 |
model_name = "OPPOer/Qwen-Image-Edit-Pruning/Qwen-Image-Edit-13B-4steps"
|
| 47 |
pipe = QwenImageEditPipeline.from_pretrained(model_name, torch_dtype=torch.bfloat16)
|
| 48 |
pipe = pipe.to('cuda')
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
output_image = output.images[0]
|
| 65 |
-
output_image.save(os.path.join(output_path, f'{prompt}.jpg'))
|
| 66 |
-
print(time.time()-t1)
|
| 67 |
```
|
|
|
|
| 46 |
model_name = "OPPOer/Qwen-Image-Edit-Pruning/Qwen-Image-Edit-13B-4steps"
|
| 47 |
pipe = QwenImageEditPipeline.from_pretrained(model_name, torch_dtype=torch.bfloat16)
|
| 48 |
pipe = pipe.to('cuda')
|
| 49 |
+
|
| 50 |
+
subject_img = Image.open('input.jpg').convert('RGB')
|
| 51 |
+
prompt = '数字插画风格'
|
| 52 |
+
t1 = time.time()
|
| 53 |
+
inputs = {
|
| 54 |
+
"image": subject_img,
|
| 55 |
+
"prompt": prompt,
|
| 56 |
+
"generator": torch.manual_seed(42),
|
| 57 |
+
"true_cfg_scale": 1,
|
| 58 |
+
"num_inference_steps": 4,
|
| 59 |
+
}
|
| 60 |
+
with torch.inference_mode():
|
| 61 |
+
output = pipe(**inputs)
|
| 62 |
+
output_image = output.images[0]
|
| 63 |
+
output_image.save('output.jpg')
|
|
|
|
|
|
|
|
|
|
| 64 |
```
|