#!/usr/bin/env python3 import torch import time import hf_image_uploader as hiu start_time = time.time() from diffusers import DiffusionPipeline import torch pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16) pipe.to(torch_dtype=torch.float16) pipe.to("cuda") torch.manual_seed(33) prompt = "a mecha robot" negative_prompt = "text, watermark" torch.manual_seed(0) image = pipe(prompt, negative_prompt=negative_prompt, num_inference_steps=25).images[0] hiu.upload(image, "patrickvonplaten/images") pipe.load_lora_weights("davizca87/sun-flower", weight_name="snfw3rXL-000004.safetensors") pipe.fuse_lora() pipe.unload_lora_weights() torch.manual_seed(0) image = pipe(prompt, negative_prompt=negative_prompt, num_inference_steps=25).images[0] hiu.upload(image, "patrickvonplaten/images") pipe.unfuse_lora() torch.manual_seed(0) image = pipe(prompt, negative_prompt=negative_prompt, num_inference_steps=25).images[0] hiu.upload(image, "patrickvonplaten/images")