Spaces:
Paused
Paused
Rishi Desai
commited on
Commit
·
40255fe
1
Parent(s):
a4c6f74
no persistent storage?
Browse files- install.py +9 -7
install.py
CHANGED
|
@@ -2,9 +2,6 @@ import os
|
|
| 2 |
|
| 3 |
COMFYUI_PATH = "./ComfyUI"
|
| 4 |
|
| 5 |
-
HF_CACHE = os.getenv('HF_HOME')
|
| 6 |
-
os.makedirs(HF_CACHE, exist_ok=True)
|
| 7 |
-
|
| 8 |
|
| 9 |
def run_cmd(command):
|
| 10 |
"""Run a shell command"""
|
|
@@ -85,8 +82,7 @@ def download_huggingface_models():
|
|
| 85 |
model_path = hf_hub_download(
|
| 86 |
repo_id=model["repo_id"],
|
| 87 |
filename=model["filename"],
|
| 88 |
-
cache_dir=
|
| 89 |
-
,
|
| 90 |
repo_type=model.get("repo_type", "model"),
|
| 91 |
token=os.getenv('HUGGINGFACE_TOKEN')
|
| 92 |
)
|
|
@@ -203,18 +199,24 @@ def install_custom_nodes():
|
|
| 203 |
|
| 204 |
|
| 205 |
def install_hfdemo_dependencies():
|
|
|
|
| 206 |
run_cmd("python -m pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124")
|
| 207 |
run_cmd("python -m pip install -r requirements.txt")
|
| 208 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
|
| 210 |
def install(is_hf_demo=False):
|
| 211 |
install_lfs_files()
|
| 212 |
install_comfyui()
|
| 213 |
install_custom_nodes()
|
| 214 |
-
download_huggingface_models()
|
| 215 |
-
download_and_extract_antelopev2()
|
| 216 |
if is_hf_demo:
|
| 217 |
install_hfdemo_dependencies()
|
|
|
|
|
|
|
| 218 |
print("🎉 Setup Complete!")
|
| 219 |
|
| 220 |
if __name__ == "__main__":
|
|
|
|
| 2 |
|
| 3 |
COMFYUI_PATH = "./ComfyUI"
|
| 4 |
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
def run_cmd(command):
|
| 7 |
"""Run a shell command"""
|
|
|
|
| 82 |
model_path = hf_hub_download(
|
| 83 |
repo_id=model["repo_id"],
|
| 84 |
filename=model["filename"],
|
| 85 |
+
cache_dir=os.getenv('HF_HOME'),
|
|
|
|
| 86 |
repo_type=model.get("repo_type", "model"),
|
| 87 |
token=os.getenv('HUGGINGFACE_TOKEN')
|
| 88 |
)
|
|
|
|
| 199 |
|
| 200 |
|
| 201 |
def install_hfdemo_dependencies():
|
| 202 |
+
"""Some steps specific to HF (ZeroGPU) spaces"""
|
| 203 |
run_cmd("python -m pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124")
|
| 204 |
run_cmd("python -m pip install -r requirements.txt")
|
| 205 |
|
| 206 |
+
# If we're using persistent storage, set to "/data/huggingface_cache"
|
| 207 |
+
HF_CACHE = "./huggingface_cache"
|
| 208 |
+
os.environ['HF_HOME'] = HF_CACHE
|
| 209 |
+
os.makedirs(HF_CACHE, exist_ok=True)
|
| 210 |
+
|
| 211 |
|
| 212 |
def install(is_hf_demo=False):
|
| 213 |
install_lfs_files()
|
| 214 |
install_comfyui()
|
| 215 |
install_custom_nodes()
|
|
|
|
|
|
|
| 216 |
if is_hf_demo:
|
| 217 |
install_hfdemo_dependencies()
|
| 218 |
+
download_huggingface_models()
|
| 219 |
+
download_and_extract_antelopev2()
|
| 220 |
print("🎉 Setup Complete!")
|
| 221 |
|
| 222 |
if __name__ == "__main__":
|