rayray916 commited on
Commit
9cc9868
·
1 Parent(s): 59ae139

Keep env HF_TOKEN for authenticated pulls; retry Sharp fetch anonymously on failure

Browse files
Files changed (1) hide show
  1. pod-onstart.sh +17 -6
pod-onstart.sh CHANGED
@@ -1,10 +1,11 @@
1
  #!/bin/bash
2
- # Flash-Next aio bootstrap (args mode: invoked via /bin/bash -c "hf download ... && bash").
3
- # 1) nvidia-smi to the UI log first; this is the source of truth for GPU power.
4
  # 2) Halt unless every GPU reports a 600W power limit (before any weights pull).
5
  # 3) Install the Sharp chat template and pin it, then hand off to the aio supervisor.
6
- # A truncated/invalid HF_TOKEN in the container env breaks anonymous pulls; drop it.
7
- unset HF_TOKEN HF_HUB_TOKEN
 
8
  echo "=== onstart: nvidia-smi ($(date -u +%H:%M:%SZ)) ==="
9
  if ! nvidia-smi; then echo "onstart: FATAL nvidia-smi failed" >&2; exit 1; fi
10
  LIMITS=$(nvidia-smi --query-gpu=power.limit --format=csv,noheader,nounits)
@@ -17,13 +18,23 @@ if [ "$BAD" != "0" ]; then
17
  exit 3
18
  fi
19
  echo "onstart: power OK (600W)"
 
 
 
 
 
 
20
  echo "=== onstart: Sharp chat template ==="
21
  CFG=/opt/pennyroyal/configs/pennyroyal
22
  SHARP="$CFG/templates/froggeric-v22.5-sharp.jinja"
23
  if [ ! -f "$SHARP" ]; then
24
- HF=/opt/pennyroyal/.venv/bin/hf
25
  mkdir -p /tmp/sharp
26
- HF_XET_HIGH_PERFORMANCE=1 "$HF" download peculiar-ragdoll/Qwen-Sharp-Chat-Templates chat_template.jinja --local-dir /tmp/sharp >/dev/null 2>&1 || { echo "onstart: FATAL sharp template download failed" >&2; exit 1; }
 
 
 
 
 
27
  install -m 644 /tmp/sharp/chat_template.jinja "$SHARP"
28
  fi
29
  SHA=$(sha256sum "$SHARP" | cut -d' ' -f1)
 
1
  #!/bin/bash
2
+ # Flash-Next aio bootstrap (args mode: /bin/bash -c "hf download ... && bash").
3
+ # 1) nvidia-smi first: in-box source of truth for GPU power.
4
  # 2) Halt unless every GPU reports a 600W power limit (before any weights pull).
5
  # 3) Install the Sharp chat template and pin it, then hand off to the aio supervisor.
6
+ # HF_TOKEN comes from the container env (set by the template) and is left in place
7
+ # for the authenticated weights pull; a broken token only degrades the template fetch.
8
+ HF=/opt/pennyroyal/.venv/bin/hf
9
  echo "=== onstart: nvidia-smi ($(date -u +%H:%M:%SZ)) ==="
10
  if ! nvidia-smi; then echo "onstart: FATAL nvidia-smi failed" >&2; exit 1; fi
11
  LIMITS=$(nvidia-smi --query-gpu=power.limit --format=csv,noheader,nounits)
 
18
  exit 3
19
  fi
20
  echo "onstart: power OK (600W)"
21
+ if [ -n "${HF_TOKEN:-}" ] && [ ${#HF_TOKEN} -ge 20 ]; then
22
+ echo "onstart: HF_TOKEN present in env (len ${#HF_TOKEN}) - authenticated pulls"
23
+ else
24
+ echo "onstart: HF_TOKEN missing/short in env - anonymous pulls"
25
+ unset HF_TOKEN HF_HUB_TOKEN
26
+ fi
27
  echo "=== onstart: Sharp chat template ==="
28
  CFG=/opt/pennyroyal/configs/pennyroyal
29
  SHARP="$CFG/templates/froggeric-v22.5-sharp.jinja"
30
  if [ ! -f "$SHARP" ]; then
 
31
  mkdir -p /tmp/sharp
32
+ HF_XET_HIGH_PERFORMANCE=1 "$HF" download peculiar-ragdoll/Qwen-Sharp-Chat-Templates chat_template.jinja --local-dir /tmp/sharp >/dev/null 2>&1 || {
33
+ echo "onstart: authenticated fetch failed, retrying anonymously" >&2
34
+ unset HF_TOKEN HF_HUB_TOKEN
35
+ HF_XET_HIGH_PERFORMANCE=1 "$HF" download peculiar-ragdoll/Qwen-Sharp-Chat-Templates chat_template.jinja --local-dir /tmp/sharp >/dev/null 2>&1
36
+ }
37
+ [ -f /tmp/sharp/chat_template.jinja ] || { echo "onstart: FATAL sharp template fetch failed" >&2; exit 1; }
38
  install -m 644 /tmp/sharp/chat_template.jinja "$SHARP"
39
  fi
40
  SHA=$(sha256sum "$SHARP" | cut -d' ' -f1)