Mightys commited on
Commit
5066538
verified
1 Parent(s): 1b15f56

Update Forge_classic_Kaggle/forge_classic_install.py

Browse files
Forge_classic_Kaggle/forge_classic_install.py CHANGED
@@ -1,110 +1,110 @@
1
- #!/usr/bin/env python3
2
- """
3
- install_forge_kaggle.py
4
- Script standalone para Kaggle que instala sd-webui-forge-classic con sus dependencias.
5
- """
6
-
7
- import os
8
- import subprocess
9
- import shutil
10
- from pathlib import Path
11
-
12
- WORK_DIR = Path("/kaggle/working").resolve()
13
- FORGE_DIR = WORK_DIR / "sd-webui-forge-classic"
14
- EXT_DIR = FORGE_DIR / "extensions"
15
-
16
- # ---------- helpers ----------
17
- def run(cmd: str, cwd: Path | None = None, check: bool = False) -> None:
18
- """Ejecuta un comando shell."""
19
- print(f"+ {cmd}")
20
- subprocess.run(cmd, shell=True, check=check, cwd=cwd)
21
-
22
- def clone(repo: str, depth: int | None = None) -> None:
23
- """Clona un repo en EXT_DIR."""
24
- cmd = "git clone"
25
- if depth:
26
- cmd += f" --depth {depth}"
27
- cmd += f" {repo}"
28
- run(cmd, cwd=EXT_DIR)
29
-
30
- def wget(url: str, output: str | None = None, quiet: bool = False, show_progress: bool = False) -> None:
31
- """Descarga con wget."""
32
- cmd = "wget"
33
- if quiet:
34
- cmd += " -q"
35
- if show_progress:
36
- cmd += " --show-progress"
37
- if output:
38
- cmd += f" -O {output}"
39
- cmd += f" {url}"
40
- run(cmd)
41
-
42
- # ---------- main ----------
43
- def main() -> None:
44
- os.chdir(WORK_DIR)
45
-
46
- # 1. libmimalloc.so.2.1
47
- wget("https://huggingface.co/datasets/Mightys/Notebook_Scripts/resolve/main/libmimalloc.so.2.1")
48
-
49
- # 2. download_magic.py
50
- wget("https://huggingface.co/datasets/Mightys/SwarmuiColab/resolve/main/scripts/download_magic.py")
51
-
52
- # 3. clonar forge-classic
53
- if not FORGE_DIR.exists():
54
- run("git clone https://github.com/MightyCrimsonX/sd-webui-forge-classic.git")
55
-
56
- # 4. config.json, styles.csv, ui-config.json
57
- wget(
58
- "https://huggingface.co/datasets/WhiteAiZ/sd-webui-forge-classic/resolve/main/config.json",
59
- output=str(FORGE_DIR / "config.json"),
60
- quiet=True,
61
- show_progress=True
62
- )
63
- wget(
64
- "https://huggingface.co/datasets/WhiteAiZ/sd-webui-forge-classic/resolve/main/styles.csv",
65
- output=str(FORGE_DIR / "styles.csv"),
66
- quiet=True,
67
- show_progress=True
68
- )
69
- wget(
70
- "https://huggingface.co/datasets/WhiteAiZ/sd-webui-forge-classic/resolve/main/ui-config.json",
71
- output=str(FORGE_DIR / "ui-config.json"),
72
- quiet=True,
73
- show_progress=True
74
- )
75
-
76
- # 5. extensiones
77
- EXT_DIR.mkdir(parents=True, exist_ok=True)
78
-
79
- repos = [
80
- "https://github.com/gutris1/sd-image-encryption",
81
- "https://github.com/gutris1/sd-hub",
82
- "https://github.com/Haoming02/sd-forge-couple",
83
- "https://github.com/AlUlkesh/stable-diffusion-webui-images-browser",
84
- "https://github.com/DominikDoom/a1111-sd-webui-tagcomplete",
85
- "https://github.com/gutris1/sd-image-info",
86
- "https://github.com/viyiviyi/stable-diffusion-webui-zoomimage",
87
- "https://github.com/gutris1/sd-simple-dimension-preset",
88
- "https://github.com/hako-mikan/sd-webui-regional-prompter",
89
- "https://github.com/gutris1/sd-civitai-browser-plus-plus",
90
- "https://github.com/pamparamm/sd-perturbed-attention",
91
- ]
92
-
93
- for repo in repos:
94
- clone(repo, depth=1)
95
-
96
- # 6. sistema + aria2
97
- run("sudo apt update -qq")
98
- run("sudo apt install aria2 -q")
99
-
100
- # 7. gdown
101
- run("pip install gdown -q")
102
-
103
- # 8. limpiar output y mostrar mensaje final
104
- os.system("clear" if os.name != "nt" else "cls")
105
- print("\n" + "=" * 50)
106
- print("馃帀 Instalaci贸n completada")
107
- print("=" * 50 + "\n")
108
-
109
- if __name__ == "__main__":
110
  main()
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ forge_classic_install.py
4
+ Script standalone para Kaggle que instala sd-webui-forge-classic con sus dependencias.
5
+ """
6
+
7
+ import os
8
+ import subprocess
9
+ import shutil
10
+ from pathlib import Path
11
+
12
+ WORK_DIR = Path("/kaggle/working").resolve()
13
+ FORGE_DIR = WORK_DIR / "sd-webui-forge-classic"
14
+ EXT_DIR = FORGE_DIR / "extensions"
15
+
16
+ # ---------- helpers ----------
17
+ def run(cmd: str, cwd: Path | None = None, check: bool = False) -> None:
18
+ """Ejecuta un comando shell."""
19
+ print(f"+ {cmd}")
20
+ subprocess.run(cmd, shell=True, check=check, cwd=cwd)
21
+
22
+ def clone(repo: str, depth: int | None = None) -> None:
23
+ """Clona un repo en EXT_DIR."""
24
+ cmd = "git clone"
25
+ if depth:
26
+ cmd += f" --depth {depth}"
27
+ cmd += f" {repo}"
28
+ run(cmd, cwd=EXT_DIR)
29
+
30
+ def wget(url: str, output: str | None = None, quiet: bool = False, show_progress: bool = False) -> None:
31
+ """Descarga con wget."""
32
+ cmd = "wget"
33
+ if quiet:
34
+ cmd += " -q"
35
+ if show_progress:
36
+ cmd += " --show-progress"
37
+ if output:
38
+ cmd += f" -O {output}"
39
+ cmd += f" {url}"
40
+ run(cmd)
41
+
42
+ # ---------- main ----------
43
+ def main() -> None:
44
+ os.chdir(WORK_DIR)
45
+
46
+ # 1. libmimalloc.so.2.1
47
+ wget("https://huggingface.co/datasets/Mightys/Notebook_Scripts/resolve/main/libmimalloc.so.2.1")
48
+
49
+ # 2. download_magic.py
50
+ wget("https://huggingface.co/datasets/Mightys/SwarmuiColab/resolve/main/scripts/download_magic.py")
51
+
52
+ # 3. clonar forge-classic
53
+ if not FORGE_DIR.exists():
54
+ run("git clone https://github.com/MightyCrimsonX/sd-webui-forge-classic.git")
55
+
56
+ # 4. config.json, styles.csv, ui-config.json
57
+ wget(
58
+ "https://huggingface.co/datasets/WhiteAiZ/sd-webui-forge-classic/resolve/main/config.json",
59
+ output=str(FORGE_DIR / "config.json"),
60
+ quiet=True,
61
+ show_progress=True
62
+ )
63
+ wget(
64
+ "https://huggingface.co/datasets/WhiteAiZ/sd-webui-forge-classic/resolve/main/styles.csv",
65
+ output=str(FORGE_DIR / "styles.csv"),
66
+ quiet=True,
67
+ show_progress=True
68
+ )
69
+ wget(
70
+ "https://huggingface.co/datasets/WhiteAiZ/sd-webui-forge-classic/resolve/main/ui-config.json",
71
+ output=str(FORGE_DIR / "ui-config.json"),
72
+ quiet=True,
73
+ show_progress=True
74
+ )
75
+
76
+ # 5. extensiones
77
+ EXT_DIR.mkdir(parents=True, exist_ok=True)
78
+
79
+ repos = [
80
+ "https://github.com/gutris1/sd-image-encryption",
81
+ "https://github.com/gutris1/sd-hub",
82
+ "https://github.com/Haoming02/sd-forge-couple",
83
+ "https://github.com/AlUlkesh/stable-diffusion-webui-images-browser",
84
+ "https://github.com/DominikDoom/a1111-sd-webui-tagcomplete",
85
+ "https://github.com/gutris1/sd-image-info",
86
+ "https://github.com/viyiviyi/stable-diffusion-webui-zoomimage",
87
+ "https://github.com/gutris1/sd-simple-dimension-preset",
88
+ "https://github.com/hako-mikan/sd-webui-regional-prompter",
89
+ "https://github.com/gutris1/sd-civitai-browser-plus-plus",
90
+ "https://github.com/pamparamm/sd-perturbed-attention",
91
+ ]
92
+
93
+ for repo in repos:
94
+ clone(repo, depth=1)
95
+
96
+ # 6. sistema + aria2
97
+ run("sudo apt update -qq")
98
+ run("sudo apt install aria2 -q")
99
+
100
+ # 7. gdown
101
+ run("pip install gdown -q")
102
+
103
+ # 8. limpiar output y mostrar mensaje final
104
+ os.system("clear" if os.name != "nt" else "cls")
105
+ print("\n" + "=" * 50)
106
+ print("馃帀 Instalaci贸n completada")
107
+ print("=" * 50 + "\n")
108
+
109
+ if __name__ == "__main__":
110
  main()