Views
No views yet
A photo-realistic image of a cat3.50.020ddim421024x1024,1280x768no_change1import torch
2from diffusers import DiffusionPipeline
3
4model_id = 'artemonlysuno/simpletuner-lora'
5pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16) # loading directly in bf16
6
7prompt = "A photo-realistic image of a cat"
8negative_prompt = 'blurry, cropped, ugly'
9
10pipeline.to('cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu') # the pipeline is already in its target precision level
11model_output = pipeline(
12 prompt=prompt,
13 negative_prompt=negative_prompt,
14 num_inference_steps=20,
15 generator=torch.Generator(device='cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu').manual_seed(42),
16 width=1024,
17 height=1024,
18 guidance_scale=3.5,
19).images[0]
20
21model_output.save("output.png", format="PNG")
22