File size: 1,361 Bytes
71da11e 6c27fdd 71da11e c99f7ad 6c27fdd c99f7ad 6c27fdd 71da11e c99f7ad 6c27fdd c99f7ad 6c27fdd c99f7ad 6c27fdd c99f7ad 6c27fdd c99f7ad 6c27fdd c99f7ad 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 39 40 41 42 43 44 45 46 |
#!/usr/bin/env python3
from diffusers import DiffusionPipeline
from safetensors.torch import load_file
import torch
from pathlib import Path
from huggingface_hub import HfApi, hf_hub_download
import os
import hf_image_uploader as hiu
import time
api = HfApi()
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16)
pipe.to("cuda")
# pipe.load_lora_weights("stabilityai/stable-diffusion-xl-base-1.0", weight_name="sd_xl_offset_example-lora_1.0.safetensors", low_cpu_mem_usage=True)
# file = hf_hub_download("TheLastBen/Papercut_SDXL", filename="papercut.safetensors")
file = hf_hub_download("hf-internal-testing/sdxl-0.9-daiton-lora", filename="daiton-xl-lora-test.safetensors")
start_time = time.time()
pipe.load_lora_weights("Pclanglais/TintinIA")
pipe.fuse_lora()
pipe.unfuse_lora()
pipe.unload_lora_weights()
pipe.load_lora_weights("ProomptEngineer/pe-balloon-diffusion-style")
pipe.fuse_lora()
pipe.unload_lora_weights()
pipe.unfuse_lora()
pipe.load_lora_weights("ostris/crayon_style_lora_sdxl")
pipe.fuse_lora()
pipe.unload_lora_weights()
pipe.unfuse_lora()
print(time.time() - start_time)
prompt = "masterpiece, best quality, mountain"
images = pipe(prompt=prompt,
num_inference_steps=20,
generator=torch.manual_seed(0)
).images
hiu.upload(images[0], "patrickvonplaten/images")
|