Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -15,20 +15,21 @@ num_frames, width, height = 49, 832, 480
|
|
15 |
gpu_id = 0
|
16 |
device = f'cuda:{gpu_id}' if torch.cuda.is_available() else 'cpu'
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
# )
|
23 |
-
|
24 |
-
from huggingface_hub import snapshot_download, hf_hub_download
|
25 |
-
hf_hub_download(
|
26 |
-
repo_id="alibaba-pai/Wan2.1-Fun-1.3B-Control",
|
27 |
-
filename="Wan2.1_VAE.pth",
|
28 |
-
local_dir="ckpt/Wan2.1-Fun-1.3B-Control/",
|
29 |
-
local_dir_use_symlinks=False,
|
30 |
-
resume_download=True,
|
31 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
# snapshot_download( # 下载整个仓库; 下briaai/RMBG-2.0需要token
|
34 |
# repo_id="alibaba-pai/Wan2.1-Fun-1.3B-Control",
|
@@ -46,10 +47,10 @@ hf_hub_download(
|
|
46 |
# resume_download=True,
|
47 |
# )
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
|
54 |
|
55 |
model_manager = ModelManager(device="cpu") # 1.3b: device=cpu: uses 6G VRAM, device=device: uses 16G VRAM; about 1-2 min per video
|
|
|
15 |
gpu_id = 0
|
16 |
device = f'cuda:{gpu_id}' if torch.cuda.is_available() else 'cpu'
|
17 |
|
18 |
+
from modelscope import snapshot_download
|
19 |
+
model_dir = snapshot_download(
|
20 |
+
model_id = 'AI-ModelScope/RMBG-2.0',
|
21 |
+
local_dir = 'ckpt/',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
)
|
23 |
+
print(model_dir)
|
24 |
+
|
25 |
+
# from huggingface_hub import snapshot_download, hf_hub_download
|
26 |
+
# hf_hub_download(
|
27 |
+
# repo_id="alibaba-pai/Wan2.1-Fun-1.3B-Control",
|
28 |
+
# filename="Wan2.1_VAE.pth",
|
29 |
+
# local_dir="ckpt/Wan2.1-Fun-1.3B-Control/",
|
30 |
+
# local_dir_use_symlinks=False,
|
31 |
+
# resume_download=True,
|
32 |
+
# )
|
33 |
|
34 |
# snapshot_download( # 下载整个仓库; 下briaai/RMBG-2.0需要token
|
35 |
# repo_id="alibaba-pai/Wan2.1-Fun-1.3B-Control",
|
|
|
47 |
# resume_download=True,
|
48 |
# )
|
49 |
|
50 |
+
rmbg_model = AutoModelForImageSegmentation.from_pretrained('ckpt/RMBG-2.0', trust_remote_code=True) # ckpt/RMBG-2.0
|
51 |
+
torch.set_float32_matmul_precision(['high', 'highest'][0])
|
52 |
+
rmbg_model.to(device)
|
53 |
+
rmbg_model.eval()
|
54 |
|
55 |
|
56 |
model_manager = ModelManager(device="cpu") # 1.3b: device=cpu: uses 6G VRAM, device=device: uses 16G VRAM; about 1-2 min per video
|