collect-workloads
БесплатноБез исполняемых скриптовНе проверенAuto-collect workloads from SGLang inference runs using FlashInfer logging API. Dumps tensors, sanitizes them according to kernel definitions, and submits PR…
от flashinfer-ai★ 314 звёзд на GitHubОб этом скилле
Collect Workloads
Collect real-world workloads by running SGLang inference with FlashInfer Level 10 logging, then sanitize and submit to the flashinfer-ai/flashinfer-trace HuggingFace dataset.
No code changes to SGLang or FlashInfer are required. Collection works entirely through FlashInfer's built-in logging API.
Scripts
| Script | Purpose |
|---|---|
scripts/collect_stream.py |
Preferred end-to-end streaming script: per-batch-size inference → sanitize → incremental HF push → eval → trace upload |
scripts/collect_workloads.py |
Older entry point: runs SGLang inference + sanitizes dumps (collects all batch sizes then pushes once) |
scripts/sanitize_dumps.py |
Converts FlashInfer Level 10 dump dirs → JSONL + safetensors; supports --max-new-workloads N for streaming mode |
Streaming collection (preferred)
# Must run under gpu-lock so CUDA_VISIBLE_DEVICES is set
tools/gpu-lock --gpus 8 --exec-timeout 10800 -- \
python3 scripts/collect_stream.py \
--def-name gqa_paged_decode_h5_kv1_d128_ps64 \
--model-key llama-4-scout-ps64 \
--model-path /path/to/model \
--batch-sizes 64 128 \
--pr-num 263 \
[--peer-node-addr nvl72089-T16] \
[--trace-dir tmp/flashinfer-trace]
# Ragged prefill — add disable-radix-cache + disable-piecewise-cuda-graph
tools/gpu-lock --gpus 8 --exec-timeout 10800 -- \
python3 scripts/collect_stream.py \
--def-name gqa_ragged_prefill_causal_h5_kv1_d128 \
--model-key llama-4-scout \
--model-path /path/to/model \
--batch-sizes 64 128 \
--pr-num 265 \
--extra-server-flag --disable-radix-cache --disable-piecewise-cuda-graph
# Paged prefill — add enable-deterministic-inference
tools/gpu-lock --gpus 8 --exec-timeout 10800 -- \
python3 scripts/collect_stream.py \
--def-name gqa_paged_prefill_causal_h5_kv1_d128_ps64 \
--model-key llama-4-scout-ps64 \
--model-path /path/to/model \
--batch-sizes 64 128 \
--pr-num 264 \
--extra-server-flag --disable-cuda-graph --enable-deterministic-inference
Streaming workflow per batch size:
bench_serving.pywithDUMP_MAX_COUNT=500(exhausted in round 1 of 2)sanitize_dumps.py --max-new-workloads 4— appends 4 diverse workloads- Incremental HF push: updated JSONL + new blobs (no deletes)
rm -rfdump dir
After all batch sizes: flashinfer-bench run eval → push trace → PR2 done.
Key flags:
--dump-count 500(default) — budget per server session--workloads-per-batch 4(default) — workloads added per batch size--num-batches 2(default) — inference rounds; budget typically hit in round 1--no-eval— skip eval+trace push (useful when flashinfer-bench is unavailable)--no-push— dry run: collect and sanitize without uploading--replace-first— replace instead of append on first batch size
Auto-detection from definition tags:
tp:N→ sets--tp N(useCUDA_VISIBLE_DEVICES=0,0to simulate TP=2 on 1 GPU)page_sizeconst axis → sets--page-size N
Workflow
Phase 0: Install Latest Packages
git -C tmp/flashinfer pull && git -C tmp/sglang pull
conda run -n flashinfer_bench pip install -e tmp/flashinfer --no-build-isolation
conda run -n flashinfer_bench pip install -e "tmp/sglang/python[all]"
Phase 1: Resolve Target Definitions
--definitions <name> [name ...]: specific definitions by name--op-type <type>: all definitions underdefinitions/{op_type}/--all: all definitions in the repo
Phase 2: FlashInfer Logging Configuration
Parses fi_api:<dotted.api.name> tags from each definition to build FLASHINFER_DUMP_INCLUDE:
- Wrapper class APIs (e.g.
BatchDecodeWithPagedKVCacheWrapper) → include.run, and.planif the definition hasint32/int64inputs BatchPrefillWithRaggedKVCacheWrapper: SGLang calls.forward()/.forward_return_lse()(not.run()) — those are automatically added toFLASHINFER_DUMP_INCLUDEfor Ragged wrappers- Plain function APIs (e.g.
rmsnorm) → include by function name
Key env vars set automatically:
FLASHINFER_LOGLEVEL=10
FLASHINFER_DUMP_DIR=./workload_dumps_<timestamp>
FLASHINFER_DUMP_SAFETENSORS=1
FLASHINFER_DUMP_INCLUDE=<fi_api patterns> # only log matching API calls
FLASHINFER_DUMP_EXCLUDE=*.__init__
FLASHINFER_DUMP_MAX_COUNT=500 # ~4 batches × 16 layers × 8 TP ranks per session
FLASHINFER_DUMP_MAX_SIZE_GB=30
DUMP_MAX_COUNT sizing: with --restart-per-batch-size, each server session independently counts toward DUMP_MAX_COUNT. 500 covers ~4 full forward passes for TP=8, 16-layer models (4 × 16 × 8 = 512 run() calls). Use 500 as the standard value when collecting per-batch-size.
Phase 2b (optional): Piggyback definition trace dump
Setting FLASHINFER_TRACE_DUMP=1 and FLASHINFER_TRACE_DUMP_DIR=<dir> alongside the
logging vars above tells FlashInfer to write a Definition JSON for every
@flashinfer_api(trace=...)-decorated call (one file pe
Установить collect-workloads в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл collect-workloads?
Auto-collect workloads from SGLang inference runs using FlashInfer logging API. Dumps tensors, sanitizes them according to kernel definitions, and submits PR to flashinfer-trace workload repo.
Как установить скилл collect-workloads?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл collect-workloads запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic