aifeifei798's picture
Upload 7 files
6c1c0b0 verified
raw
history blame
1.45 kB
import torch
import spaces
from diffusers import (
DiffusionPipeline,
AutoencoderTiny,
)
from huggingface_hub import hf_hub_download
def feifeimodload():
dtype = torch.bfloat16
device = "cuda" if torch.cuda.is_available() else "cpu"
taef1 = AutoencoderTiny.from_pretrained("aifeifei798/taef1", torch_dtype=dtype).to(
device
)
pipe = DiffusionPipeline.from_pretrained(
"aifeifei798/shuttle-3-diffusion", torch_dtype=dtype, vae=taef1
).to(device)
pipe.load_lora_weights(
hf_hub_download("aifeifei798/feifei-flux-lora-v1", "feifei.safetensors"),
adapter_name="feifei",
)
pipe.load_lora_weights(
hf_hub_download(
"aifeifei798/feifei-flux-lora-v1", "FLUX-dev-lora-add_details.safetensors"
),
adapter_name="FLUX-dev-lora-add_details",
)
pipe.load_lora_weights(
hf_hub_download(
"aifeifei798/feifei-flux-lora-v1", "Shadow-Projection.safetensors"
),
adapter_name="Shadow-Projection",
)
pipe.set_adapters(
["feifei", "FLUX-dev-lora-add_details", "Shadow-Projection"],
adapter_weights=[0.65, 0.35, 0.35],
)
pipe.fuse_lora(
adapter_name=["feifei", "FLUX-dev-lora-add_details", "Shadow-Projection"],
lora_scale=1.0,
)
pipe.unload_lora_weights()
torch.cuda.empty_cache()
return pipe