| import torch |
| from diffusers import StableDiffusion3Pipeline |
| from diffusers import AutoPipelineForText2Image |
| from safetensors.torch import load_file |
|
|
| torch.backends.cuda.enable_mem_efficient_sdp(False) |
| torch.backends.cuda.enable_flash_sdp(False) |
|
|
| pipeline = AutoPipelineForText2Image.from_pretrained("stabilityai/stable-diffusion-3-medium-diffusers", torch_dtype=torch.float16).to('cuda') |
|
|
| pipeline.load_lora_weights("rdeinla/test-can-3", weight_name='pytorch_lora_weights.safetensors') |
|
|
| image = pipeline("A photo of a canola plant rosette with large green leaves. The leaves are ruffled around the edges and have prominent ridges. It is about 35 days old. It grows out of a square box covered with bright blue fabric that hides the base of the plant on a bright blue background", |
| guidance_scale = 7.2, negative_prompt = "blurry").images[0] |
|
|
| image.save("canola_3_72_1.png") |