Skip to content

Commit f8194b2

Browse files
Small improvement of native api docs (sgl-project#5139)
Co-authored-by: zhaochenyang20 <zhaochen20@outlook.com>
1 parent 6d3b35f commit f8194b2

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

docs/backend/native_api.ipynb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,9 @@
371371
"source": [
372372
"## Capture expert selection distribution in MoE models\n",
373373
"\n",
374-
"SGLang Runtime supports recording the number of times an expert is selected in a MoE model run for each expert in the model. This is useful when analyzing the throughput of the model and plan for optimization."
374+
"SGLang Runtime supports recording the number of times an expert is selected in a MoE model run for each expert in the model. This is useful when analyzing the throughput of the model and plan for optimization.\n",
375+
"\n",
376+
"*Note: We only print out the first 10 lines of the csv below for better readability. Please adjust accordingly if you want to analyze the results more deeply.*"
375377
]
376378
},
377379
{
@@ -412,9 +414,13 @@
412414
"\n",
413415
"output_file = glob.glob(\"expert_distribution_*.csv\")[0]\n",
414416
"with open(output_file, \"r\") as f:\n",
415-
" print_highlight(\"Content of dumped record:\")\n",
416-
" for line in f:\n",
417-
" print_highlight(line.strip())"
417+
" print_highlight(\"\\n| Layer ID | Expert ID | Count |\")\n",
418+
" print_highlight(\"|----------|-----------|--------|\")\n",
419+
" next(f)\n",
420+
" for i, line in enumerate(f):\n",
421+
" if i < 9:\n",
422+
" layer_id, expert_id, count = line.strip().split(\",\")\n",
423+
" print_highlight(f\"| {layer_id:8} | {expert_id:9} | {count:6} |\")"
418424
]
419425
},
420426
{

0 commit comments

Comments
 (0)