[chore] surface the cookbook to users who pip install sglang (#40866)
Co-authored-by: Mick Qian <mickqian@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Mick Qian
Claude Opus 5
parent
cd11037009
commit
17a7484c06
@@ -205,6 +205,8 @@ vsa = ["setuptools", "torch"]
|
||||
|
||||
[project.urls]
|
||||
"Homepage" = "https://github.com/sgl-project/sglang"
|
||||
"Documentation" = "https://docs.sglang.io"
|
||||
"Cookbook" = "https://docs.sglang.io/cookbook"
|
||||
"Bug Tracker" = "https://github.com/sgl-project/sglang/issues"
|
||||
|
||||
[project.scripts]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import argparse
|
||||
|
||||
from sglang.cli.main import COOKBOOK_EPILOG
|
||||
from sglang.cli.utils import get_is_diffusion_model, get_model_path
|
||||
|
||||
|
||||
@@ -10,7 +11,11 @@ def generate(args, extra_argv):
|
||||
add_multimodal_gen_generate_args,
|
||||
)
|
||||
|
||||
parser = argparse.ArgumentParser(description="SGLang Multimodal Generation")
|
||||
parser = argparse.ArgumentParser(
|
||||
description="SGLang Multimodal Generation",
|
||||
epilog=COOKBOOK_EPILOG,
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
)
|
||||
add_multimodal_gen_generate_args(parser)
|
||||
parser.parse_args(extra_argv)
|
||||
return
|
||||
|
||||
@@ -9,8 +9,19 @@ def version(args, extra_argv):
|
||||
print(f"git revision: {get_git_commit_hash()[:7]}")
|
||||
|
||||
|
||||
COOKBOOK_URL = "https://docs.sglang.io/cookbook"
|
||||
COOKBOOK_EPILOG = (
|
||||
f"Deploying a specific model? Its cookbook page at {COOKBOOK_URL} carries the "
|
||||
"recommended command for it: GPU count, parallelism, quantization and the "
|
||||
"flags that matter for that model."
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser = argparse.ArgumentParser(
|
||||
epilog=COOKBOOK_EPILOG,
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
)
|
||||
|
||||
# complex sub commands
|
||||
subparsers = parser.add_subparsers(dest="subcommand", required=True)
|
||||
|
||||
@@ -4,6 +4,7 @@ import argparse
|
||||
import logging
|
||||
import os
|
||||
|
||||
from sglang.cli.main import COOKBOOK_EPILOG
|
||||
from sglang.cli.serve_backends import (
|
||||
SERVE_BACKEND_API_VERSION,
|
||||
ServeBackend,
|
||||
@@ -186,6 +187,9 @@ def serve(args, extra_argv):
|
||||
_print_general_help(registry)
|
||||
else:
|
||||
registry.get(backend_name).backend.run(request)
|
||||
# Printed here rather than as a backend parser's epilog so it appears
|
||||
# exactly once, after whichever backend help ran.
|
||||
print(f"\n{COOKBOOK_EPILOG}")
|
||||
return
|
||||
|
||||
from sglang.srt.plugins import load_plugins
|
||||
|
||||
Reference in New Issue
Block a user