Skip to main content

SGLang plugin for flyte

Project description

Flyte SGLang Plugin

Serve large language models using SGLang with Flyte Apps.

This plugin provides the SGLangAppEnvironment class for deploying and serving LLMs using SGLang.

Installation

pip install --pre flyteplugins-sglang

Usage

import flyte
import flyte.app
from flyteplugins.sglang import SGLangAppEnvironment

# Define the SGLang app environment
sglang_app = SGLangAppEnvironment(
    name="my-llm-app",
    model="s3://your-bucket/models/your-model",
    model_id="your-model-id",
    resources=flyte.Resources(cpu="4", memory="16Gi", gpu="L40s:1"),
    stream_model=True,  # Stream model directly from blob store to GPU
    scaling=flyte.app.Scaling(
        replicas=(0, 1),
        scaledown_after=300,
    ),
)

if __name__ == "__main__":
    flyte.init_from_config()
    app = flyte.serve(sglang_app)
    print(f"Deployed SGLang app: {app.url}")

Features

  • Streaming Model Loading: Stream model weights directly from object storage to GPU memory, reducing startup time and disk requirements.
  • OpenAI-Compatible API: The deployed app exposes an OpenAI-compatible API for chat completions.
  • Auto-scaling: Configure scaling policies to scale up/down based on traffic.
  • Tensor Parallelism: Support for distributed inference across multiple GPUs.

Extra Arguments

You can pass additional arguments to the SGLang server using the extra_args parameter:

sglang_app = SGLangAppEnvironment(
    name="my-llm-app",
    model="s3://your-bucket/models/your-model",
    model_id="your-model-id",
    extra_args="--max-model-len 8192 --enforce-eager",
)

See the SGLang server arguments documentation for available options.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flyteplugins_sglang-2.0.0b58-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file flyteplugins_sglang-2.0.0b58-py3-none-any.whl.

File metadata

File hashes

Hashes for flyteplugins_sglang-2.0.0b58-py3-none-any.whl
Algorithm Hash digest
SHA256 f622d175c3b8707b76d1328b1bbd8f80f14ce1b533fc7f539fc6c3ac7fa95165
MD5 fc67e090d34ca4d30a20ddc1626cc388
BLAKE2b-256 6c39e69a2b99736afb00aab49ed1cad17fee36025545d9f998ffa3ba37114efb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page