Mightys commited on
Commit
f4ae472
·
verified ·
1 Parent(s): 886da4b

Upload 2 files

Browse files
Comfyui-Lightning/on_start.sh ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # This script runs every time your Studio starts, from your home directory.
4
+ echo "Preparando carpetas temporales..."
5
+ python ~/temp_dir.py
6
+
7
+ # Logs from previous runs can be found in ~/.lightning_studio/logs/
8
+
9
+ # List files under fast_load that need to load quickly on start (e.g. model checkpoints).
10
+ #
11
+ # ! fast_load
12
+ # <your file here>
13
+
14
+ # Add your startup commands below.
15
+ #
16
+ # Example: streamlit run my_app.py
17
+ # Example: gradio my_app.py
Comfyui-Lightning/temp_dir.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ # temp_dir.py – enlaza carpetas temporales de ComfyUI a /tmp
3
+ import subprocess
4
+ from pathlib import Path
5
+
6
+ def _run(cmd: str) -> None:
7
+ print(f"+ {cmd}")
8
+ subprocess.run(cmd, shell=True, check=False)
9
+
10
+ def enlaces_tmp_comfy() -> None:
11
+ """Crea enlaces simbólicos para que ComfyUI use /tmp y libere espacio en disco."""
12
+ base = Path("/teamspace/studios/this_studio")
13
+ cmds = [
14
+ "rm -rf /teamspace/studios/this_studio/tmp ~/tmp",
15
+ "ln -vs /tmp ~/tmp",
16
+ "rm -rf /teamspace/studios/this_studio/ComfyUI/models/checkpoints/tmp_models",
17
+ "mkdir -p /tmp/models",
18
+ "ln -vs /tmp/models /teamspace/studios/this_studio/ComfyUI/models/checkpoints/tmp_models",
19
+ "rm -rf /teamspace/studios/this_studio/ComfyUI/models/loras/tmp_lora",
20
+ "mkdir -p /tmp/lora",
21
+ "ln -vs /tmp/lora /teamspace/studios/this_studio/ComfyUI/models/loras/tmp_lora",
22
+ "rm -rf /teamspace/studios/this_studio/ComfyUI/models/diffusion_models",
23
+ "mkdir -p /tmp/diffusion_models",
24
+ "ln -vs /tmp/diffusion_models /teamspace/studios/this_studio/ComfyUI/models/diffusion_models",
25
+ "rm -rf /teamspace/studios/this_studio/ComfyUI/models/text_encoders",
26
+ "mkdir -p /tmp/text_encoders",
27
+ "ln -vs /tmp/text_encoders /teamspace/studios/this_studio/ComfyUI/models/text_encoders",
28
+ "rm -rf /teamspace/studios/this_studio/ComfyUI/models/unet",
29
+ "mkdir -p /tmp/unet",
30
+ "ln -vs /tmp/unet /teamspace/studios/this_studio/ComfyUI/models/unet",
31
+ "rm -rf /teamspace/studios/this_studio/ComfyUI/models/controlnet",
32
+ "mkdir -p /tmp/controlnet",
33
+ "ln -vs /tmp/controlnet /teamspace/studios/this_studio/ComfyUI/models/controlnet",
34
+ ]
35
+ for c in cmds:
36
+ _run(c)
37
+ print("✅ Carpetas temporales de ComfyUI enlazadas.")
38
+
39
+ if __name__ == "__main__":
40
+ enlaces_tmp_comfy()