Update README.md
Browse files
README.md
CHANGED
|
@@ -1,11 +1,81 @@
|
|
| 1 |
---
|
| 2 |
-
license:
|
| 3 |
language:
|
| 4 |
- en
|
| 5 |
- zh
|
|
|
|
| 6 |
library_name: diffusers
|
| 7 |
pipeline_tag: text-to-image
|
|
|
|
|
|
|
|
|
|
| 8 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
<p align="center">
|
| 10 |
<img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/qwen_image_logo.png" width="400"/>
|
| 11 |
<p>
|
|
@@ -225,4 +295,4 @@ If Qwen-Image-2512 proves helpful in your research, we’d greatly appreciate yo
|
|
| 225 |
primaryClass={cs.CV},
|
| 226 |
url={https://arxiv.org/abs/2508.02324},
|
| 227 |
}
|
| 228 |
-
```
|
|
|
|
| 1 |
---
|
| 2 |
+
license: cc-by-nc-sa-4.0
|
| 3 |
language:
|
| 4 |
- en
|
| 5 |
- zh
|
| 6 |
+
quantized_by: Abhishek Dujari
|
| 7 |
library_name: diffusers
|
| 8 |
pipeline_tag: text-to-image
|
| 9 |
+
base_model:
|
| 10 |
+
- Qwen/Qwen-Image-2512
|
| 11 |
+
base_model_relation: quantized
|
| 12 |
---
|
| 13 |
+
|
| 14 |
+
This is an NF4 quantized model of Qwen-image 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. This one does not.
|
| 16 |
+
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 parameters as is though I recommend atleast 20 inference steps.
|
| 19 |
+
|
| 20 |
+
This model is available for inference, modifications and commercial use by support AT justlab.ai
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
```python
|
| 24 |
+
from diffusers import DiffusionPipeline
|
| 25 |
+
import torch
|
| 26 |
+
|
| 27 |
+
model_name = "ovedrive/qwen-image-2512-4bit"
|
| 28 |
+
|
| 29 |
+
# Load the pipeline
|
| 30 |
+
if torch.cuda.is_available():
|
| 31 |
+
torch_dtype = torch.bfloat16
|
| 32 |
+
device = "cuda"
|
| 33 |
+
else:
|
| 34 |
+
torch_dtype = torch.float32
|
| 35 |
+
device = "cpu"
|
| 36 |
+
|
| 37 |
+
pipe = DiffusionPipeline.from_pretrained(model_name, torch_dtype=torch_dtype)
|
| 38 |
+
pipe = pipe.to(device)
|
| 39 |
+
|
| 40 |
+
positive_magic = {
|
| 41 |
+
"en": "Ultra HD, 4K, cinematic composition." # for english prompt,
|
| 42 |
+
"zh": "超清,4K,电影级构图" # for chinese prompt,
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
# Generate image
|
| 46 |
+
prompt = '''A coffee shop entrance features a chalkboard sign reading "Qwen Coffee 😊 $2 per cup," with a neon light beside it displaying "通义千问". Next to it hangs a poster showing a beautiful Chinese woman, and beneath the poster is written "π≈3.1415926-53589793-23846264-33832795-02384197". Ultra HD, 4K, cinematic composition'''
|
| 47 |
+
|
| 48 |
+
negative_prompt = " " # using an empty string if you do not have specific concept to remove
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
# Generate with different aspect ratios
|
| 52 |
+
aspect_ratios = {
|
| 53 |
+
"1:1": (1328, 1328),
|
| 54 |
+
"16:9": (1664, 928),
|
| 55 |
+
"9:16": (928, 1664),
|
| 56 |
+
"4:3": (1472, 1140),
|
| 57 |
+
"3:4": (1140, 1472),
|
| 58 |
+
"3:2": (1584, 1056),
|
| 59 |
+
"2:3": (1056, 1584),
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
width, height = aspect_ratios["16:9"]
|
| 63 |
+
|
| 64 |
+
image = pipe(
|
| 65 |
+
prompt=prompt + positive_magic["en"],
|
| 66 |
+
negative_prompt=negative_prompt,
|
| 67 |
+
width=width,
|
| 68 |
+
height=height,
|
| 69 |
+
num_inference_steps=20,
|
| 70 |
+
true_cfg_scale=4.0,
|
| 71 |
+
generator=torch.Generator(device="cuda").manual_seed(42)
|
| 72 |
+
).images[0]
|
| 73 |
+
|
| 74 |
+
image.save("example.png")
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
The original Qwen-Image attributions are included verabtim below.
|
| 78 |
+
|
| 79 |
<p align="center">
|
| 80 |
<img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/qwen_image_logo.png" width="400"/>
|
| 81 |
<p>
|
|
|
|
| 295 |
primaryClass={cs.CV},
|
| 296 |
url={https://arxiv.org/abs/2508.02324},
|
| 297 |
}
|
| 298 |
+
```
|