Mightys commited on
Commit
939af0d
verified
1 Parent(s): 97d787a

Upload install_forge_classic.py

Browse files
Files changed (1) hide show
  1. scripts/install_forge_classic.py +96 -0
scripts/install_forge_classic.py ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ install_forge_classic.py
4
+ Script standalone que reproduce todo el setup de tu celda Jupyter
5
+ (enlaces, dependencias, extensiones, wheel de SageAttention, etc.)
6
+ """
7
+
8
+ import os
9
+ import subprocess
10
+ import shutil
11
+ from pathlib import Path
12
+
13
+ ROOT = Path("/teamspace/studios/this_studio").expanduser().resolve()
14
+ FORGE_DIR = ROOT / "sd-webui-forge-classic"
15
+ EXT_DIR = FORGE_DIR / "extensions"
16
+
17
+ # ---------- helpers ----------
18
+ def run(cmd: str, cwd: Path | None = None, capture: bool = False) -> None:
19
+ """Ejecuta un comando shell y muestra salida en tiempo real."""
20
+ print(f"+ {cmd}")
21
+ subprocess.run(cmd, shell=True, check=False, cwd=cwd)
22
+
23
+ def clone(repo: str, depth: int | None = None) -> None:
24
+ """Clona un repo en EXT_DIR."""
25
+ cmd = f"git clone {repo}"
26
+ if depth:
27
+ cmd = f"git clone --depth {depth} {repo}"
28
+ run(cmd, cwd=EXT_DIR)
29
+
30
+ # ---------- main ----------
31
+ def main() -> None:
32
+ os.chdir(ROOT)
33
+
34
+ # 1. download_magic.py & temp_dir.py
35
+ run("wget -q https://huggingface.co/datasets/Mightys/Notebook_Scripts/resolve/main/scripts/download_magic.py")
36
+ run("wget -q https://huggingface.co/datasets/Mightys/Notebook_Scripts/resolve/main/scripts/temp_dir.py")
37
+
38
+ # 2. clonar forge-classic si no existe
39
+ if not FORGE_DIR.exists():
40
+ run("git clone https://github.com/Haoming02/sd-webui-forge-classic.git")
41
+
42
+ # 3. PyTorch + extras
43
+ run("uv pip install torch==2.9.1 torchvision==0.24.1 xformers==0.0.33.post2 triton==3.5.1 "
44
+ "--index-url https://download.pytorch.org/whl/cu128 --no-progress")
45
+
46
+ # 4. ui-config.json y styles.csv
47
+ run("wget -q --show-progress https://huggingface.co/datasets/WhiteAiZ/sd-webui-forge-classic/resolve/main/ui-config.json "
48
+ "-O sd-webui-forge-classic/ui-config.json")
49
+ run("wget -q --show-progress https://huggingface.co/datasets/WhiteAiZ/sd-webui-forge-classic/resolve/main/styles.csv "
50
+ "-O sd-webui-forge-classic/styles.csv")
51
+
52
+ # 5. extensiones
53
+ EXT_DIR.mkdir(exist_ok=True)
54
+ repos = [
55
+ "https://github.com/pamparamm/sd-perturbed-attention",
56
+ "https://github.com/gutris1/sd-image-encryption",
57
+ "https://github.com/yankooliveira/sd-webui-photopea-embed.git",
58
+ "https://github.com/gutris1/sd-hub",
59
+ "https://github.com/Haoming02/sd-forge-couple",
60
+ "https://github.com/etherealxx/batchlinks-webui",
61
+ "https://github.com/gutris1/sd-civitai-browser-plus-plus",
62
+ "https://github.com/AlUlkesh/stable-diffusion-webui-images-browser",
63
+ "https://github.com/DominikDoom/a1111-sd-webui-tagcomplete",
64
+ "https://github.com/Bing-su/adetailer",
65
+ "https://github.com/NoCrypt/sd-fast-pnginfo",
66
+ "https://github.com/viyiviyi/stable-diffusion-webui-zoomimage",
67
+ "https://github.com/gutris1/sd-simple-dimension-preset",
68
+ ]
69
+ for r in repos:
70
+ clone(r, depth=1)
71
+
72
+ # 6. sistema + aria2
73
+ run("sudo apt update -qq")
74
+ run("sudo apt install aria2 -q")
75
+
76
+ # 7. paquetes extra
77
+ run("uv pip install gdown clip gradio==3.41.2 ultralytics==8.3.216 insightface --no-progress")
78
+
79
+ # 8. SageAttention wheel
80
+ wheel = "sageattention-2.1.2-cp312-cp312-linux_x86_64.whl"
81
+ run(f"wget -q --show-progress https://huggingface.co/datasets/WhiteAiZ/T4_SageAttention2_For_Google_Colab/resolve/main/python%203.12/{wheel}")
82
+ run(f"uv pip install {wheel}")
83
+ Path(wheel).unlink(missing_ok=True)
84
+
85
+ # 9. limpieza
86
+ run("rm -rf ~/.cache")
87
+
88
+ # 10. on_start.sh (opcional)
89
+ lightning_studio = ROOT / ".lightning_studio"
90
+ lightning_studio.mkdir(exist_ok=True)
91
+ run("wget -q https://huggingface.co/datasets/Mightys/Notebook_Scripts/resolve/main/scripts/on_start.sh -O .lightning_studio/on_start.sh")
92
+
93
+ print("\n馃帀 Instalaci贸n completada.")
94
+
95
+ if __name__ == "__main__":
96
+ main()