cmpatino's picture
download
raw
5.05 kB
#!/usr/bin/env bash
# Flint probe on HF Jobs (h200): driver/CUDA, kit install, weights, server start, tool call, throughput.
set -uo pipefail
T0=$(date +%s); mark() { echo "[probe +$(( $(date +%s) - T0 ))s] $*"; }
mark "host: $(uname -m) $(nproc) cpus; df /: $(df -h / | tail -1 | awk '{print $4}') free"
nvidia-smi --query-gpu=name,memory.total,driver_version --format=csv 2>&1 | tail -2
nvidia-smi 2>&1 | grep -i "cuda version" | head -1
python3 -c "import sglang, torch; print('sglang', sglang.__version__, '| torch', torch.__version__, '| cuda', torch.version.cuda)"
export PIP_BREAK_SYSTEM_PACKAGES=1 PIP_ROOT_USER_ACTION=ignore
pip install -q openai 2>&1 | tail -1; python3 -c "import huggingface_hub as h; print('huggingface_hub', h.__version__)"
mark "downloading the kit"
python3 - <<'PY'
from huggingface_hub import snapshot_download
p = snapshot_download("RecursiveSI/flint", allow_patterns=["sglang/*"], local_dir="/opt/flint")
print("kit at", p)
PY
ls /opt/flint/sglang
mark "install.sh"
bash /opt/flint/sglang/install.sh /opt/flint/sglang > /tmp/install.log 2>&1; RC=$?
tail -5 /tmp/install.log; mark "install.sh rc=$RC"
[ $RC -eq 0 ] || { echo "INSTALL FAILED"; sed -n 1,80p /tmp/install.log; exit 20; }
mark "downloading weights"
python3 - <<'PY'
from huggingface_hub import snapshot_download
import time; t=time.time()
p = snapshot_download("RecursiveSI/flint", local_dir="/opt/flint")
print("weights at", p, "in %.0fs" % (time.time()-t))
PY
du -sh /opt/flint | tail -1
mark "starting the server (serve_h200.sh)"
MODEL=/opt/flint PORT=30000 bash /opt/flint/sglang/serve_h200.sh > /tmp/server.log 2>&1 &
SPID=$!
for i in $(seq 1 120); do
if curl -sf localhost:30000/health_generate >/dev/null 2>&1; then mark "server ready"; break; fi
if ! kill -0 $SPID 2>/dev/null; then echo "SERVER DIED"; tail -60 /tmp/server.log; exit 21; fi
sleep 15
done
curl -sf localhost:30000/health_generate >/dev/null || { echo "SERVER NOT READY in 30 min"; tail -40 /tmp/server.log; kill $SPID; exit 22; }
grep -i "fired up\|ready to roll\|max_total_num_tokens\|KV\|mem" /tmp/server.log | tail -5
mark "example_client.py"
python3 /opt/flint/sglang/example_client.py --base-url http://localhost:30000/v1 2>&1 | tail -30
mark "bash-tool request (mini-swe-agent's BASH_TOOL shape) + throughput"
python3 - <<'PY'
import time, json
from openai import OpenAI
c = OpenAI(base_url="http://localhost:30000/v1", api_key="x")
tools = [{"type": "function", "function": {"name": "bash", "description": "Execute a bash command",
"parameters": {"type": "object", "properties": {"command": {"type": "string", "description": "The bash command to execute"}}, "required": ["command"]}}}]
msgs = [{"role": "system", "content": "You are a helpful assistant that can interact with a computer. Every response must use the bash tool."},
{"role": "user", "content": "List the files in the current directory, then print the kernel version."}]
t = time.time()
r = c.chat.completions.create(model="flint", messages=msgs, tools=tools, max_tokens=4096)
dt = time.time() - t
m = r.choices[0].message
print("finish:", r.choices[0].finish_reason, "| tool_calls:", [(tc.function.name, tc.function.arguments) for tc in (m.tool_calls or [])])
print("content:", (m.content or "")[:200].replace("\n", " "))
print("reasoning_content chars:", len(getattr(m, "reasoning_content", None) or ""))
print("usage:", r.usage.prompt_tokens, "prompt /", r.usage.completion_tokens, "completion in %.1fs = %.1f tok/s" % (dt, r.usage.completion_tokens / dt))
# a second turn with the tool result, preserving reasoning_content as the kit requires
assistant = {"role": "assistant", "content": m.content or "", "tool_calls": [{"id": tc.id, "type": "function", "function": {"name": tc.function.name, "arguments": tc.function.arguments}} for tc in (m.tool_calls or [])]}
if getattr(m, "reasoning_content", None): assistant["reasoning_content"] = m.reasoning_content
msgs2 = msgs + [assistant] + [{"role": "tool", "tool_call_id": tc.id, "content": "README.md src\nLinux 6.12.0"} for tc in (m.tool_calls or [])]
t = time.time()
r2 = c.chat.completions.create(model="flint", messages=msgs2, tools=tools, max_tokens=4096)
dt2 = time.time() - t
m2 = r2.choices[0].message
print("turn 2 finish:", r2.choices[0].finish_reason, "| tool_calls:", [(tc.function.name, tc.function.arguments[:80]) for tc in (m2.tool_calls or [])], "| %.1f tok/s" % (r2.usage.completion_tokens / dt2))
# throughput: 4 concurrent 1024-token generations
import concurrent.futures as cf
def gen(i):
t = time.time(); rr = c.chat.completions.create(model="flint", messages=[{"role": "user", "content": f"Write a long essay number {i} about rivers."}], max_tokens=1024)
return rr.usage.completion_tokens, time.time() - t
t = time.time()
with cf.ThreadPoolExecutor(4) as ex: res = list(ex.map(gen, range(4)))
wall = time.time() - t
print("4 concurrent x 1024: %d tokens in %.1fs = %.0f tok/s aggregate" % (sum(r[0] for r in res), wall, sum(r[0] for r in res) / wall))
PY
mark "done"; kill $SPID 2>/dev/null; exit 0

Xet Storage Details

Size:
5.05 kB
·
Xet hash:
8ea914d803c9051ecfb0851c412364e288d453a569ff5cbce9f759f1d428048d

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.