v41 serve worker: local volume first, HF only as fallback
Browse files21 unmodified lines22232425262728295 unmodified lines3536373839404142434445464721 unmodified linespython3 -m pip install --quiet --no-cache-dir --break-system-packages huggingface_hub 2>/dev/null \|| python3 -m pip install --quiet --no-cache-dir huggingface_hubecho "--- downloading the published GGUF"python3 - "$GGUF_REPO" "$GGUF_DIR" "$OUT" <<'PYEOF'import json, os, sys, timefrom huggingface_hub import HfApi, hf_hub_downloadrepo, dest, out = sys.argv[1:4]5 unmodified linest0 = time.time()hf_hub_download(repo, name, local_dir=dest, token=os.environ.get("HF_TOKEN"))size = os.path.getsize(os.path.join(dest, name))mbps = size / max(1e-6, time.time() - t0) / 1e6print(f" {name}: {size/1e9:.2f} GB in {time.time()-t0:.0f}s ({mbps:.0f} MB/s)", flush=True)record = {"shards": len(files), "seconds": round(time.time() - started, 1),"bytes": sum(os.path.getsize(os.path.join(dest, f)) for f in files)}json.dump(record, open(os.path.join(out, "download.json"), "w"), indent=1)print(json.dumps(record, indent=1))PYEOFecho "--- patching the DeepSeek-V4 GGUF name map for llama.cpp naming + V4.1 indexer tensors"PATCH_DIR=$WORK/sglang-pr; mkdir -p "$PATCH_DIR"21 unmodified lines2223242526272829303132333435363738394041425 unmodified lines4849505152535455565758596021 unmodified linespython3 -m pip install --quiet --no-cache-dir --break-system-packages huggingface_hub 2>/dev/null \|| python3 -m pip install --quiet --no-cache-dir huggingface_hub# Local first: a network volume in this datacenter means zero GPU time spent downloading.if ls "$GGUF_DIR"/*.gguf >/dev/null 2>&1; thenecho "--- using local shards in $GGUF_DIR"python3 - "$GGUF_DIR" "$OUT" <<'PYEOF'import glob, json, os, sysdest, out = sys.argv[1:3]files = sorted(glob.glob(os.path.join(dest, "*.gguf")))record = {"source": "local-volume", "shards": len(files),"bytes": sum(os.path.getsize(f) for f in files), "files": [os.path.basename(f) for f in files]}json.dump(record, open(os.path.join(out, "download.json"), "w"), indent=1)print(json.dumps(record, indent=1))PYEOFelseecho "--- no local shards; downloading the published GGUF from $GGUF_REPO"python3 - "$GGUF_REPO" "$GGUF_DIR" "$OUT" <<'PYEOF'import json, os, sys, timefrom huggingface_hub import HfApi, hf_hub_downloadrepo, dest, out = sys.argv[1:4]5 unmodified linest0 = time.time()hf_hub_download(repo, name, local_dir=dest, token=os.environ.get("HF_TOKEN"))size = os.path.getsize(os.path.join(dest, name))print(f" {name}: {size/1e9:.2f} GB in {time.time()-t0:.0f}s", flush=True)record = {"source": "hf", "shards": len(files), "seconds": round(time.time() - started, 1),"bytes": sum(os.path.getsize(os.path.join(dest, f)) for f in files)}json.dump(record, open(os.path.join(out, "download.json"), "w"), indent=1)print(json.dumps(record, indent=1))PYEOFfiecho "--- patching the DeepSeek-V4 GGUF name map for llama.cpp naming + V4.1 indexer tensors"PATCH_DIR=$WORK/sglang-pr; mkdir -p "$PATCH_DIR"
worker/gpu-serve.sh+18-5