Views
No views yet
1from diffusers import DiffusionPipeline
2import torch
3
4model_name = "Qwen/Qwen-Image"
5
6# Load the pipeline
7if torch.cuda.is_available():
8 torch_dtype = torch.bfloat16
9 device = "cuda"
10else:
11 torch_dtype = torch.float32
12 device = "cpu"
13
14pipe = DiffusionPipeline.from_pretrained(model_name, torch_dtype=torch_dtype)
15pipe = pipe.to(device)1# Load LoRA weights
2pipe.load_lora_weights("flymy-ai/qwen-image-anime-irl-lora", weight_name='flymy_anime_irl.safetensors', adapter_name="lora")1prompt = '''Real life Anime in a cozy kitchen, eating noodles with chopsticks, while a curious cat looks out the window.'''
2negative_prompt = " "
3image = pipe(
4 prompt=prompt,
5 negative_prompt=negative_prompt,
6 width=1024,
7 height=1024,
8 num_inference_steps=50,
9 true_cfg_scale=4,
10 generator=torch.Generator(device="cuda").manual_seed(4633346 + 2)
11).images[0]
12
13# Display the image (in Jupyter or save to file)
14image.show()
15# or
16image.save("output.png")ComfyUI/models/.safetensors filesflymy-ai/qwen-image-lora/pytorch_lora_weights.safetensors to ComfyUI/models/loras/qwen_image_lora_example.json located in this repository


