Spaces:
Sleeping
Sleeping
zhangyang-0123
commited on
Commit
·
2c738fc
1
Parent(s):
9b6512a
update
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import numpy as np
|
|
3 |
from huggingface_hub import hf_hub_download
|
4 |
|
5 |
import spaces # [uncomment to use ZeroGPU]
|
6 |
-
from diffusers import
|
7 |
import torch
|
8 |
|
9 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
@@ -11,11 +11,11 @@ model_repo_id = "stabilityai/stable-diffusion-xl-base-1.0" # Replace to the mod
|
|
11 |
|
12 |
torch_dtype = torch.bfloat16
|
13 |
|
14 |
-
pipe =
|
15 |
pipe = pipe.to(device)
|
16 |
|
17 |
# load pruned model
|
18 |
-
pruned_pipe =
|
19 |
pruned_pipe.unet = torch.load(
|
20 |
hf_hub_download("zhangyang-0123/EcoDiffPrunedModels", "model/sdxl/sdxl.pkl"),
|
21 |
map_location="cpu",
|
|
|
3 |
from huggingface_hub import hf_hub_download
|
4 |
|
5 |
import spaces # [uncomment to use ZeroGPU]
|
6 |
+
from diffusers import StableDiffusionXLPipeline
|
7 |
import torch
|
8 |
|
9 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
11 |
|
12 |
torch_dtype = torch.bfloat16
|
13 |
|
14 |
+
pipe = StableDiffusionXLPipeline.from_pretrained(model_repo_id, torch_dtype=torch_dtype)
|
15 |
pipe = pipe.to(device)
|
16 |
|
17 |
# load pruned model
|
18 |
+
pruned_pipe = StableDiffusionXLPipeline.from_pretrained(model_repo_id, torch_dtype=torch_dtype)
|
19 |
pruned_pipe.unet = torch.load(
|
20 |
hf_hub_download("zhangyang-0123/EcoDiffPrunedModels", "model/sdxl/sdxl.pkl"),
|
21 |
map_location="cpu",
|