Spaces:
Running
on
Zero
Running
on
Zero
File size: 1,026 Bytes
0a7d59a c0f6048 0a7d59a 8891d44 6c638d0 c0f6048 0944537 77d29ae 1bd88dd 8891d44 2c58570 252b569 87e7369 8cc4ce5 87e7369 8cc4ce5 02c3dcf 6aaa86f d165da9 0a7d59a |
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 |
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"
pipe = DiffusionPipeline.from_pretrained(
"aifeifei798/DarkIdol-flux-v1", torch_dtype=dtype
).to(device)
# pipe = DiffusionPipeline.from_pretrained(
# "black-forest-labs/FLUX.1-schnell", torch_dtype=dtype
# ).to(device)
pipe.load_lora_weights(
hf_hub_download("aifeifei798/feifei-flux-lora-v1.1", "feifei-v1.1.safetensors"),
adapter_name="feifei",
)
#pipe.set_adapters(
# ["feifei"],
# adapter_weights=[0.85],
#)
#pipe.fuse_lora(
# adapter_name=["feifei"],
# lora_scale=1.0,
#)
#pipe.enable_sequential_cpu_offload()
pipe.vae.enable_slicing()
pipe.vae.enable_tiling()
# pipe.unload_lora_weights()
torch.cuda.empty_cache()
return pipe
|