Commit f6dbd240 authored by Lianmin Zheng's avatar Lianmin Zheng
Browse files

Improve doc strings (#518)

parent e8a2327d
"""SRT: SGLang Runtime""" """
The entry point of inference server.
SRT = SGLang Runtime.
"""
import asyncio import asyncio
import dataclasses import dataclasses
...@@ -10,7 +13,7 @@ import sys ...@@ -10,7 +13,7 @@ import sys
import threading import threading
import time import time
from http import HTTPStatus from http import HTTPStatus
from typing import Optional from typing import Optional, Dict
# Fix a bug of Python threading # Fix a bug of Python threading
setattr(threading, "_register_atexit", lambda *args, **kwargs: None) setattr(threading, "_register_atexit", lambda *args, **kwargs: None)
...@@ -148,7 +151,6 @@ def launch_server(server_args: ServerArgs, pipe_finish_writer, model_overide_arg ...@@ -148,7 +151,6 @@ def launch_server(server_args: ServerArgs, pipe_finish_writer, model_overide_arg
server_args.dp_size, server_args.dp_size,
) )
# Init local models port args
ports = server_args.additional_ports ports = server_args.additional_ports
tp = server_args.tp_size tp = server_args.tp_size
model_port_args = [] model_port_args = []
...@@ -269,6 +271,12 @@ def launch_server(server_args: ServerArgs, pipe_finish_writer, model_overide_arg ...@@ -269,6 +271,12 @@ def launch_server(server_args: ServerArgs, pipe_finish_writer, model_overide_arg
class Runtime: class Runtime:
"""
A wrapper for the server.
This is used for launching the server in a python program without
using the commond line interface.
"""
def __init__( def __init__(
self, self,
log_level: str = "error", log_level: str = "error",
...@@ -339,7 +347,7 @@ class Runtime: ...@@ -339,7 +347,7 @@ class Runtime:
async def add_request( async def add_request(
self, self,
prompt: str, prompt: str,
sampling_params, sampling_params: Dict,
): ):
json_data = { json_data = {
"text": prompt, "text": prompt,
......
""" """This file contains the SGL programs used for unit testing."""
This file contains the SGL programs used for unit testing.
"""
import json import json
import re import re
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment