-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathinstall.py
More file actions
78 lines (61 loc) · 2.34 KB
/
install.py
File metadata and controls
78 lines (61 loc) · 2.34 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import sys
import os
import logging
import subprocess
import traceback
EXT_PATH = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, EXT_PATH)
log = logging.getLogger("AniDoc")
download_models = True
try:
folder_paths_path = os.path.abspath(os.path.join(EXT_PATH, "..", "..", "folder_paths.py"))
sys.path.append(os.path.dirname(folder_paths_path))
import folder_paths
DIFFUSERS_DIR = os.path.join(folder_paths.models_dir, "diffusers")
ANIDOC_DIR = os.path.join(DIFFUSERS_DIR, "anidoc")
SVD_I2V_DIR = os.path.join(
DIFFUSERS_DIR,
"stable-video-diffusion-img2vid-xt",
)
except:
download_models = False
COTRACKER = os.path.join(EXT_PATH, "cotracker")
try:
log.info("Installing requirements")
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", f"{EXT_PATH}/requirements.txt", "--no-warn-script-location"])
if download_models:
from huggingface_hub import snapshot_download
log.info("Downloading Necessary models")
try:
log.info(f"Downloading AniDoc model to: {ANIDOC_DIR}")
snapshot_download(
repo_id="Yhmeng1106/anidoc",
ignore_patterns=["*.md"],
local_dir=DIFFUSERS_DIR,
local_dir_use_symlinks=False,
)
except Exception:
traceback.print_exc()
log.error("Failed to download AniDoc model")
try:
log.info(f"Downloading stable diffusion video img2vid to: {SVD_I2V_DIR}")
snapshot_download(
repo_id="vdo/stable-video-diffusion-img2vid-xt-1-1",
allow_patterns=["*.json", "*fp16*"],
ignore_patterns=["*unet*"],
local_dir=SVD_I2V_DIR,
local_dir_use_symlinks=False,
)
except Exception:
traceback.print_exc()
log.error("Failed to download stable diffusion video img2vid")
try:
log.info("Installing CoTracker")
subprocess.check_call([sys.executable, "-m", "pip", "install", COTRACKER])
except Exception:
traceback.print_exc()
log.error("Failed to install CoTracker")
log.info("AniDoc Installation completed")
except Exception:
traceback.print_exc()
log.error("AniDoc Installation failed")