Views
No views yet
gguf-connector; simply execute the command below in console/terminalggc q6GGUF file(s) available. Select which one to use:
- qwen-image-edit-iq4_nl.gguf
- qwen-image-edit-q2_k.gguf
- qwen-image-edit-q4_0.gguf
- qwen-image-edit-q8_0.gguf
Enter your choice (1 to 4): _
gguf file in your current directory to interact with; nothing else
./ComfyUI/models/diffusion_models./ComfyUI/models/text_encoders
./ComfyUI/models/vae

pip install git+https://github.com/huggingface/diffusers.git1import torch, os
2from diffusers import QwenImageTransformer2DModel, GGUFQuantizationConfig, QwenImageEditPipeline
3from diffusers.utils import load_image
4
5model_path = "https://huggingface.co/calcuis/qwen-image-edit-gguf/blob/main/qwen-image-edit-iq4_nl.gguf"
6
7transformer = QwenImageTransformer2DModel.from_single_file(
8 model_path,
9 quantization_config=GGUFQuantizationConfig(compute_dtype=torch.bfloat16),
10 torch_dtype=torch.bfloat16,
11 config="callgg/image-edit-decoder",
12 subfolder="transformer"
13 )
14pipeline = QwenImageEditPipeline.from_pretrained("callgg/image-edit-decoder", transformer=transformer, torch_dtype=torch.bfloat16)
15print("pipeline loaded")
16pipeline.enable_model_cpu_offload()
17image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png")
18prompt = "Add a hat to the cat"
19inputs = {
20 "image": image,
21 "prompt": prompt,
22 "generator": torch.manual_seed(0),
23 "true_cfg_scale": 2.5,
24 "negative_prompt": " ",
25 "num_inference_steps": 20,
26}
27with torch.inference_mode():
28 output = pipeline(**inputs)
29 output_image = output.images[0]
30 output_image.save("output.png")
31 print("image saved at", os.path.abspath("output.png"))