MrA7A3 commited on
Commit
bb80a2b
·
verified ·
1 Parent(s): ed973c5

KAPO rollout fix: sync bootstrap_space_runtime.py

Browse files
Files changed (1) hide show
  1. bootstrap_space_runtime.py +22 -35
bootstrap_space_runtime.py CHANGED
@@ -6,36 +6,28 @@ import sys
6
  from pathlib import Path
7
 
8
  DEFAULT_ENV = {
9
- "BRAIN_AUTO_NGROK": "0",
10
- "BRAIN_AUTO_PUBLISH_URL_ON_STARTUP": "0",
11
- "BRAIN_LANGUAGES": "ar,en",
12
- "BRAIN_PLATFORM_NAME": "hf_debugger_main",
13
- "BRAIN_PROVIDER": "huggingface",
14
- "BRAIN_REUSE_PUBLIC_URL_ON_RESTART": "0",
15
- "BRAIN_ROLES": "debugger,fallback",
16
- "BRAIN_TEMPLATE": "hf-space-cpu",
17
- "BRAIN_TUNNEL_PROVIDER": "none",
18
- "FIREBASE_ENABLED": "0",
19
- "GOOGLE_DRIVE_BOOTSTRAP_URL": "https://drive.google.com/uc?export=download&id=19jyBWsQ9ciJVPi2PUigu5ti3gJ24A6TG",
20
- "HF_ACCELERATOR": "cpu",
21
- "HF_SPACE_DOCKER": "1",
22
- "KAGGLE_AUTO_BOOTSTRAP": "0",
23
- "KAPO_BOOTSTRAP_URL": "https://drive.google.com/uc?export=download&id=19jyBWsQ9ciJVPi2PUigu5ti3gJ24A6TG",
24
- "KAPO_COMPUTE_PROFILE": "cpu",
25
- "KAPO_DISABLE_EMBEDDINGS": "1",
26
- "KAPO_HF_INFERENCE_API": "0",
27
- "KAPO_HF_TRANSFORMERS_RUNTIME": "1",
28
- "KAPO_LAZY_EMBED_STARTUP": "1",
29
- "KAPO_LAZY_MODEL_STARTUP": "1",
30
- "KAPO_PATCH_BUNDLE_URL": "https://drive.google.com/uc?export=download&id=1PwpKBh_1pJ6syBihyCBHHDwypGRmUGQP",
31
- "KAPO_PATCH_MANIFEST_URL": "https://drive.google.com/uc?export=download&id=1kuzboReag0emMj-wU8pn64K4_Hvps_jy",
32
- "KAPO_REMOTE_ENV_PASSWORD_B64": "bEcyRlZNTzhobFA0V3lVeWdzQWItQURubnZHU0w3d1M",
33
- "KAPO_REMOTE_ENV_URL_B64": "aHR0cHM6Ly9kcml2ZS5nb29nbGUuY29tL3VjP2V4cG9ydD1kb3dubG9hZCZpZD0xeHN1cENNNThtTklIQ3JtWTZEcVBUV0pFME5HaE5yMW0",
34
- "KAPO_SHARED_STATE_BACKEND": "google_drive",
35
- "MODEL_PROFILE_ID": "hf-debugger-qwen25-7b-instruct",
36
- "MODEL_REPO": "Qwen/Qwen2.5-1.5B-Instruct",
37
- "REMOTE_BRAIN_ONLY": "1",
38
- "SPACE_PUBLIC_URL": "https://MrA7A3-AiDebuggerClean.hf.space"
39
  }
40
 
41
 
@@ -72,13 +64,8 @@ def main() -> None:
72
  for key, value in DEFAULT_ENV.items():
73
  os.environ.setdefault(str(key), str(value))
74
  space_host = str(os.getenv('SPACE_HOST', '')).strip().rstrip('/')
75
- space_id = str(os.getenv('SPACE_ID', '')).strip()
76
- public_url = ''
77
  if space_host:
78
  public_url = space_host if space_host.startswith('http://') or space_host.startswith('https://') else f'https://{space_host}'
79
- elif space_id and '/' in space_id:
80
- public_url = 'https://' + space_id.replace('/', '-').lower() + '.hf.space'
81
- if public_url:
82
  os.environ['BRAIN_PUBLIC_URL'] = public_url.rstrip('/')
83
  runtime_root.mkdir(parents=True, exist_ok=True)
84
  overlay_root.mkdir(parents=True, exist_ok=True)
 
6
  from pathlib import Path
7
 
8
  DEFAULT_ENV = {
9
+ "REMOTE_BRAIN_ONLY": "1",
10
+ "KAGGLE_AUTO_BOOTSTRAP": "0",
11
+ "BRAIN_AUTO_NGROK": "0",
12
+ "BRAIN_AUTO_PUBLISH_URL_ON_STARTUP": "0",
13
+ "BRAIN_REUSE_PUBLIC_URL_ON_RESTART": "0",
14
+ "HF_SPACE_DOCKER": "1",
15
+ "KAPO_COMPUTE_PROFILE": "cpu",
16
+ "HF_ACCELERATOR": "cpu",
17
+ "KAPO_HF_TRANSFORMERS_RUNTIME": "1",
18
+ "KAPO_LAZY_MODEL_STARTUP": "1",
19
+ "KAPO_LAZY_EMBED_STARTUP": "1",
20
+ "MODEL_PROFILE_ID": "hf-debugger-qwen25-7b-instruct",
21
+ "MODEL_REPO": "Qwen/Qwen2.5-1.5B-Instruct",
22
+ "BRAIN_ROLES": "fallback",
23
+ "BRAIN_LANGUAGES": "ar,en",
24
+ "BRAIN_PLATFORM_NAME": "hf_debugger_main",
25
+ "BRAIN_TEMPLATE": "hf-space-cpu",
26
+ "BRAIN_PROVIDER": "huggingface",
27
+ "FIREBASE_ENABLED": "1",
28
+ "FIREBASE_PROJECT_ID": "citadel4travels",
29
+ "FIREBASE_NAMESPACE": "kapo",
30
+ "BRAIN_REUSE_PUBLIC_URL_ON_RESTART": "0",
 
 
 
 
 
 
 
 
31
  }
32
 
33
 
 
64
  for key, value in DEFAULT_ENV.items():
65
  os.environ.setdefault(str(key), str(value))
66
  space_host = str(os.getenv('SPACE_HOST', '')).strip().rstrip('/')
 
 
67
  if space_host:
68
  public_url = space_host if space_host.startswith('http://') or space_host.startswith('https://') else f'https://{space_host}'
 
 
 
69
  os.environ['BRAIN_PUBLIC_URL'] = public_url.rstrip('/')
70
  runtime_root.mkdir(parents=True, exist_ok=True)
71
  overlay_root.mkdir(parents=True, exist_ok=True)