test-can-1-2 / inference.py
rdeinla's picture
End of training
3fa2f59 verified
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-1-2", weight_name='pytorch_lora_weights.safetensors')
image = pipeline("A photo of a young canola plant with medium-sized leaves. The leaves are ruffled around the edges and have prominent ridges. It is about 19 days old. It is growing in dark, nutrient-rich soil. It is contained within a smooth, bright blue cylindrical cup on a bright blue background",
guidance_scale = 5.0, negative_prompt = "blurry").images[0]
image.save("canola_12_5_1.png")