ovedrive commited on
Commit
e5f81ff
·
verified ·
1 Parent(s): 863a8ef

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +62 -0
README.md CHANGED
@@ -5,6 +5,68 @@ language:
5
  - zh
6
  library_name: diffusers
7
  pipeline_tag: image-to-image
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  ---
9
  <p align="center">
10
  <img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/qwen_image_edit_logo.png" width="400"/>
 
5
  - zh
6
  library_name: diffusers
7
  pipeline_tag: image-to-image
8
+ quantized_by: abhishekdujari
9
+ base_model:
10
+ - Qwen/Qwen-Image-Edit-2509
11
+ base_model_relation: quantized
12
+ ---
13
+
14
+ This is an NF4 quantized model of Qwen-image-edit-2509 so it can run on GPUs using 20GB VRAM. You can run it on lower VRAM like 16GB.
15
+ There were other NF4 models but they made the mistake of blindly quantizing all layers in the transformer.
16
+ This one does not. We retain some layers at full precision in order to ensure that we get quality output.
17
+
18
+ You can use the original Qwen-Image-Edit parameters.
19
+
20
+ This model is `not yet` available for inference at JustLab.ai
21
+
22
+ Model tested: Working perfectly even with 10 steps.
23
+ Contact: [JustLab.ai](https://justlab.ai) for commercial support
24
+
25
+
26
+ ### Performance on rtx4090
27
+ - 20 steps about 78 seconds.
28
+ - 10 steps about 40 seconds.
29
+
30
+ Interestingly I was under the impression that the Qwen-VL could not be quantized which is why several projects use the full 15Gb model.
31
+ Here I have quantized it too and it seems to be workign fine.
32
+
33
+ Sample script. (min 20GB VRAM)
34
+
35
+ ```python
36
+ import os
37
+ from PIL import Image
38
+ import torch
39
+
40
+ from diffusers import QwenImageEditPlusPipeline
41
+
42
+ model_path = "ovedrive/Qwen-Image-Edit-2509-4bit"
43
+ pipeline = QwenImageEditPlusPipeline.from_pretrained(model_path, torch_dtype=torch.bfloat16)
44
+ print("pipeline loaded") # not true but whatever. do not move to cuda
45
+
46
+ pipeline.set_progress_bar_config(disable=None)
47
+ pipeline.enable_model_cpu_offload() #if you have enough VRAM replace this line with `pipeline.to("cuda")` which is 20GB VRAM
48
+ image = Image.open("./example.png").convert("RGB")
49
+ prompt = "Remove the lady head with white hair"
50
+ inputs = {
51
+ "image": image,
52
+ "prompt": prompt,
53
+ "generator": torch.manual_seed(0),
54
+ "true_cfg_scale": 4.0,
55
+ "negative_prompt": " ",
56
+ "num_inference_steps": 20, # even 10 steps should be enough in many cases
57
+ }
58
+
59
+ with torch.inference_mode():
60
+ output = pipeline(**inputs)
61
+
62
+ output_image = output.images[0]
63
+ output_image.save("output_image_edit.png")
64
+ print("image saved at", os.path.abspath("output_image_edit.png"))
65
+ ```
66
+
67
+
68
+ The original Qwen-Image-Edit-2509 attributions are included verbatim below.
69
+
70
  ---
71
  <p align="center">
72
  <img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/qwen_image_edit_logo.png" width="400"/>