File size: 1,030 Bytes
811d1c6 6c27fdd 811d1c6 9478dd2 811d1c6 6c27fdd 811d1c6 6c27fdd 811d1c6 6c27fdd 811d1c6 6c27fdd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
#!/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")
|