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('pytorch_lora_weights.safetensors', adapter_name="lora")1prompt = '''Valentin in a natural daylight selfie at a cafe entrance. He looks seriously into the camera, wearing a black coat or jacket and wireless earbud. Background includes wooden frames, warm pendant lights, and urban cafe details. With text "FLYMY AI"'''
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=5,
10 generator=torch.Generator(device="cuda").manual_seed(346346)
11)
12
13# Display the image (in Jupyter or save to file)
14image.show()
15# or
16image.save("output.png")