diff --git a/docs/cookbook/diffusion/Cosmos/Cosmos3.mdx b/docs/cookbook/diffusion/Cosmos/Cosmos3.mdx index c539ca457a..644fac68be 100644 --- a/docs/cookbook/diffusion/Cosmos/Cosmos3.mdx +++ b/docs/cookbook/diffusion/Cosmos/Cosmos3.mdx @@ -1,5 +1,6 @@ --- title: Cosmos3 +description: "Serve NVIDIA Cosmos3 image, video, sound, and action generation with SGLang Diffusion." metatags: description: "Serve NVIDIA Cosmos3 image, video, sound, and action generation with SGLang Diffusion." --- @@ -8,7 +9,43 @@ import { DiffusionModelTags } from '/src/snippets/diffusion/model-tags.jsx'; -## 1. Model Introduction +import { Deployment } from '/src/snippets/_deployment.jsx'; +import { config } from '/src/snippets/configs/nvidia/cosmos3.jsx'; + +## 1. Quick start + +Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation) for your GPU platform. + +Choose a [generation or policy request](#4-openai-compatible-requests) matching the checkpoint; the Request tab queries model metadata. + + + + + +Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation). Docker is recommended for Linux GPU deployments; run the commands below inside the container or your installed Python environment. + +Cosmos3 guardrails are enabled by default when the package is available: + +```bash Command +pip install "cosmos-guardrail==0.3.1" +``` + +`cosmos-guardrail` downloads gated NVIDIA guardrail weights, so pass a Hugging Face token if your environment needs one. If the package is not installed, SGLang skips Cosmos3 guardrails and logs a warning. To disable Cosmos3 guardrails for local experiments, set `SGLANG_DISABLE_COSMOS3_GUARDRAILS=1` before starting the server. + +There may be problems loading the Cosmos-1.0-Guardrail weights on Ascend NPU. If the *_pickle.UnpicklingError* error occurs during startup, you should change ```weight_only=True``` to ```weights_only=False``` parameter in *cosmos_guardrail/cosmos_utils.py*: +``` +#!/usr/bin/env bash +COSMOS_GUARDRAIL_DIR="$(dirname "$(python -c 'import cosmos_guardrail; print(cosmos_guardrail.__file__)')")" +sed -i 's/weights_only=True/weights_only=False/g' "$COSMOS_GUARDRAIL_DIR/cosmos_utils.py" +``` + + + + + + + +## 2. Model capabilities [NVIDIA Cosmos3](https://huggingface.co/collections/nvidia/cosmos3) is an omnimodal world-model family spanning text/image/video generation, optional synchronized sound, and robot action prediction. Its main advantage is breadth: the same native SGLang pipeline can serve media-generation checkpoints and the DROID policy checkpoint without routing through an LLM sampler. @@ -30,24 +67,6 @@ Sound and action generation require the corresponding checkpoint heads. The pipe The default `flow_shift` is `3.0` for T2I, `10.0` for non-Edge video and all action modes, and `3.0` for Edge video modes. Distilled checkpoints bake the schedule into their sigmas and do not use a request-level `flow_shift`. -## 2. Installation - -Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation). Docker is recommended for Linux GPU deployments; run the commands below inside the container or your installed Python environment. - -Cosmos3 guardrails are enabled by default when the package is available: - -```bash Command -pip install "cosmos-guardrail==0.3.1" -``` - -`cosmos-guardrail` downloads gated NVIDIA guardrail weights, so pass a Hugging Face token if your environment needs one. If the package is not installed, SGLang skips Cosmos3 guardrails and logs a warning. To disable Cosmos3 guardrails for local experiments, set `SGLANG_DISABLE_COSMOS3_GUARDRAILS=1` before starting the server. - -There may be problems loading the Cosmos-1.0-Guardrail weights on Ascend NPU. If the *_pickle.UnpicklingError* error occurs during startup, you should change ```weight_only=True``` to ```weights_only=False``` parameter in *cosmos_guardrail/cosmos_utils.py*: -``` -#!/usr/bin/env bash -COSMOS_GUARDRAIL_DIR="$(dirname "$(python -c 'import cosmos_guardrail; print(cosmos_guardrail.__file__)')")" -sed -i 's/weights_only=True/weights_only=False/g' "$COSMOS_GUARDRAIL_DIR/cosmos_utils.py" -``` ## 3. Serve Cosmos3 Serve `Cosmos3-Nano` directly from the Hugging Face model ID: diff --git a/docs/cookbook/diffusion/Ernie-Image/Ernie-Image.mdx b/docs/cookbook/diffusion/Ernie-Image/Ernie-Image.mdx index 0e31e20c50..d5f1785a46 100644 --- a/docs/cookbook/diffusion/Ernie-Image/Ernie-Image.mdx +++ b/docs/cookbook/diffusion/Ernie-Image/Ernie-Image.mdx @@ -1,5 +1,6 @@ --- title: ERNIE-Image +description: "Deploy ERNIE-Image and ERNIE-Image-Turbo with SGLang Diffusion." metatags: description: "Deploy ERNIE-Image and ERNIE-Image-Turbo with SGLang Diffusion." --- @@ -8,7 +9,20 @@ import { DiffusionModelTags } from '/src/snippets/diffusion/model-tags.jsx'; -## 1. Model Introduction +import { Deployment } from '/src/snippets/_deployment.jsx'; +import { config } from '/src/snippets/configs/baidu/ernie-image.jsx'; + +## 1. Quick start + +Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation) for your GPU platform. + + + + + + + +## 2. Model capabilities [ERNIE-Image](https://huggingface.co/baidu/ERNIE-Image) is Baidu's text-to-image family with separate standard and Turbo checkpoints. The standard model is the quality-oriented path; Turbo is the lower-latency choice, and both load through SGLang's native `ErnieImagePipeline`. @@ -19,10 +33,6 @@ This integration currently targets text-only image generation rather than image | ERNIE-Image | `baidu/ERNIE-Image` | Regular text-to-image checkpoint | | ERNIE-Image-Turbo | `baidu/ERNIE-Image-Turbo` | Turbo text-to-image checkpoint | -## 2. Installation - -Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation). Docker is recommended for Linux GPU deployments; run the commands below inside the container or your installed Python environment. - ## 3. Serve the model The commands below target a single supported NVIDIA CUDA or AMD ROCm GPU. Start with `--performance-mode auto`; use `speed` only when the full pipeline fits comfortably on the selected GPU(s), and use `memory` when you need lower peak GPU memory. diff --git a/docs/cookbook/diffusion/FLUX/FLUX.mdx b/docs/cookbook/diffusion/FLUX/FLUX.mdx index e39331666b..15d231228d 100644 --- a/docs/cookbook/diffusion/FLUX/FLUX.mdx +++ b/docs/cookbook/diffusion/FLUX/FLUX.mdx @@ -1,15 +1,28 @@ --- title: FLUX +description: "Deploy FLUX diffusion models with SGLang - 12B/32B rectified flow transformers for high-quality text-to-image generation." metatags: description: "Deploy FLUX diffusion models with SGLang - 12B/32B rectified flow transformers for high-quality text-to-image generation." --- import { DiffusionModelTags } from '/src/snippets/diffusion/model-tags.jsx'; -import { FluxDeployment } from '/src/snippets/diffusion/flux-deployment.jsx'; -## 1. Model Introduction +import { Deployment } from '/src/snippets/_deployment.jsx'; +import { config } from '/src/snippets/configs/BlackForestLabs/flux.jsx'; + +## 1. Quick start + +Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation) for your GPU platform. + + + + + + + +## 2. Model capabilities [FLUX](https://blackforestlabs.ai/) is Black Forest Labs' rectified-flow image model family. [FLUX.1-dev](https://huggingface.co/black-forest-labs/FLUX.1-dev) is the smaller 12B text-to-image checkpoint; [FLUX.2-dev](https://huggingface.co/black-forest-labs/FLUX.2-dev) is a 32B model that adds instruction-based editing plus single- and multi-reference composition. @@ -20,12 +33,6 @@ FLUX is a strong default when prompt adherence, polished image quality, or refer | `black-forest-labs/FLUX.1-dev` | High-quality text-to-image with the lighter FLUX deployment | No native multi-reference editing path | | `black-forest-labs/FLUX.2-dev` | Text-to-image, editing, and reference-guided composition in one model | 32B model with a larger memory footprint | -## 2. SGLang-diffusion Installation - -SGLang-diffusion offers multiple installation methods. You can choose the most suitable installation method based on your hardware platform and requirements. - -Please refer to the [official SGLang-diffusion installation guide](https://docs.sglang.io/docs/sglang-diffusion/installation) for installation instructions. - ## 3. Model Deployment This section provides deployment configurations optimized for different hardware platforms and use cases. @@ -34,9 +41,7 @@ This section provides deployment configurations optimized for different hardware FLUX models are optimized for high-quality image generation. The recommended launch configurations vary by hardware and model version. -**Interactive Command Generator**: Use the configuration selector below to automatically generate the appropriate deployment command for your hardware platform and model version. SGLang supports serving FLUX on NVIDIA B200, H200, H100, and AMD MI355X, MI325X, MI300X GPUs, Ascend A2, A3 NPUs Series NPUs and Intel Arc B-series graphics(codename: BMG (Battlemage)). - - +Use the [command builder](#1-quick-start) above. ### 3.2 Configuration Tips diff --git a/docs/cookbook/diffusion/Ideogram/Ideogram4.mdx b/docs/cookbook/diffusion/Ideogram/Ideogram4.mdx index 7b46738e25..32294dbf5e 100644 --- a/docs/cookbook/diffusion/Ideogram/Ideogram4.mdx +++ b/docs/cookbook/diffusion/Ideogram/Ideogram4.mdx @@ -1,5 +1,6 @@ --- title: Ideogram 4 +description: "Deploy Ideogram 4 with SGLang Diffusion for high-aesthetic text-to-image generation." metatags: description: "Deploy Ideogram 4 with SGLang Diffusion for high-aesthetic text-to-image generation." --- @@ -8,7 +9,31 @@ import { DiffusionModelTags } from '/src/snippets/diffusion/model-tags.jsx'; -## 1. Model Introduction +import { Deployment } from '/src/snippets/_deployment.jsx'; +import { config } from '/src/snippets/configs/Ideogram/ideogram4.jsx'; + +## 1. Quick start + +Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation) for your GPU platform. + +Set `HF_TOKEN` with access to the gated Ideogram repositories. Install `bitsandbytes>=0.46.1` and `accelerate>=1.1.0` for NF4 and the shared NF4 text encoder. + + + + + +- NVIDIA CUDA GPU. +- SGLang installed with diffusion dependencies. +- `bitsandbytes>=0.46.1` and `accelerate>=1.1.0` for the NF4 checkpoint and the fal variants' shared NF4 text encoder. +- `HF_TOKEN` with access to the Ideogram 4 gated repositories. + + + + + + + +## 2. Model capabilities [Ideogram 4](https://huggingface.co/ideogram-ai/ideogram-4-nf4) is a text-to-image family focused on polished composition and typography-aware generation. SGLang supports the official NF4 and FP8 checkpoints, Comfy-Org's NVFP4 transformer, and fal's distilled Fast and Instant variants. @@ -24,13 +49,6 @@ Choose NF4 when memory is the primary constraint, FP8/NVFP4 for supported accele The fal repositories contain only the transformer component. When either model ID is passed directly to `--model-path`, SGLang loads the text encoder, tokenizer, VAE, and scheduler from the `ideogram-ai/ideogram-4-nf4-diffusers` revision referenced by fal's model cards, then runs the distilled transformer without the unconditional branch. -## 2. Prerequisites - -- NVIDIA CUDA GPU. -- SGLang installed with diffusion dependencies. -- `bitsandbytes>=0.46.1` and `accelerate>=1.1.0` for the NF4 checkpoint and the fal variants' shared NF4 text encoder. -- `HF_TOKEN` with access to the Ideogram 4 gated repositories. - ## 3. Serve the model NF4: diff --git a/docs/cookbook/diffusion/JoyEcho/JoyEcho.mdx b/docs/cookbook/diffusion/JoyEcho/JoyEcho.mdx index cdf52a4b47..d6c98aeb39 100644 --- a/docs/cookbook/diffusion/JoyEcho/JoyEcho.mdx +++ b/docs/cookbook/diffusion/JoyEcho/JoyEcho.mdx @@ -9,7 +9,22 @@ import { DiffusionModelTags } from '/src/snippets/diffusion/model-tags.jsx'; -## 1. Model Introduction +import { Deployment } from '/src/snippets/_deployment.jsx'; +import { config } from '/src/snippets/configs/JoyAI/joyecho.jsx'; + +## 1. Quick start + +Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation) for your GPU platform. + +Prepare the [pinned Echo 1.0 checkpoint](#3-1-prepare-the-echo-1-0-checkpoint) and set `JOY_ECHO_MODEL_PATH` before starting the server. + + + + + + + +## 2. Model capabilities [JoyAI-Echo](https://huggingface.co/jdopensource/JoyAI-Echo) is an 8-step long-form audio-video model built on LTX-2. Its paired memory bank carries decoded visual context and audio latents across prompt changes, making it strongest for multi-shot, minute-scale sequences that need continuity in both picture and soundtrack. @@ -29,10 +44,6 @@ SGLang materializes the Echo 1.0 monolithic release through the built-in [JoyAI- Review the model license on the [JoyAI-Echo Hugging Face page](https://huggingface.co/jdopensource/JoyAI-Echo) before production or commercial use. SGLang support does not grant additional model usage rights. -## 2. SGLang-diffusion Installation - -Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation). Docker is recommended for Linux GPU deployments; run the commands below inside the container or your installed Python environment. - ## 3. Model Deployment ### 3.1 Prepare the Echo 1.0 checkpoint diff --git a/docs/cookbook/diffusion/Krea/Krea-2.mdx b/docs/cookbook/diffusion/Krea/Krea-2.mdx index afc40cfea5..3ef02f15e3 100644 --- a/docs/cookbook/diffusion/Krea/Krea-2.mdx +++ b/docs/cookbook/diffusion/Krea/Krea-2.mdx @@ -1,5 +1,6 @@ --- title: Krea-2 +description: "Deploy Krea-2 with SGLang - fast, high-quality text-to-image generation." metatags: description: "Deploy Krea-2 with SGLang - fast, high-quality text-to-image generation." --- @@ -8,7 +9,20 @@ import { DiffusionModelTags } from '/src/snippets/diffusion/model-tags.jsx'; -## 1. Model Introduction +import { Deployment } from '/src/snippets/_deployment.jsx'; +import { config } from '/src/snippets/configs/Krea/krea2.jsx'; + +## 1. Quick start + +Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation) for your GPU platform. + + + + + + + +## 2. Model capabilities [Krea-2](https://huggingface.co/krea/Krea-2-Turbo) is Krea's photorealistic text-to-image family, built as a single-stream MMDiT with a Qwen3-VL text encoder and Qwen-Image VAE. Both public variants use the same native SGLang pipeline and differ mainly in their sampling target. @@ -19,12 +33,6 @@ Choose Turbo for interactive generation: it is distilled to 8 steps with `guidan | Turbo | `krea/Krea-2-Turbo` | 8 steps, no CFG; fastest path | | Raw | `krea/Krea-2-Raw` | About 52 steps with CFG; higher-fidelity path | -## 2. SGLang-diffusion Installation - -SGLang-diffusion offers multiple installation methods. You can choose the most suitable installation method based on your hardware platform and requirements. - -Please refer to the [official SGLang-diffusion installation guide](https://docs.sglang.io/docs/sglang-diffusion/installation) for installation instructions. - ## 3. Model Deployment This section covers deploying Krea-2-Turbo for fast, high-quality image generation. diff --git a/docs/cookbook/diffusion/LTX/LTX2 & LTX2.3.mdx b/docs/cookbook/diffusion/LTX/LTX2 & LTX2.3.mdx index 241e1b055a..b1ccc08ffa 100644 --- a/docs/cookbook/diffusion/LTX/LTX2 & LTX2.3.mdx +++ b/docs/cookbook/diffusion/LTX/LTX2 & LTX2.3.mdx @@ -6,11 +6,23 @@ metatags: --- import { DiffusionModelTags } from '/src/snippets/diffusion/model-tags.jsx'; -import { LTXDeployment } from '/src/snippets/diffusion/ltx-deployment.jsx'; -## 1. Model Introduction +import { Deployment } from '/src/snippets/_deployment.jsx'; +import { config } from '/src/snippets/configs/Lightricks/ltx2.jsx'; + +## 1. Quick start + +Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation) for your GPU platform. + + + + + + + +## 2. Model capabilities [LTX-2](https://huggingface.co/Lightricks/LTX-2) and [LTX-2.3](https://huggingface.co/Lightricks/LTX-2.3) are Lightricks video models for text-to-video and image-conditioned generation. Their defining deployment choice is the pipeline: one-stage minimizes latency, standard two-stage refines quality, and LTX-2.3 adds a 1920×1088 HQ path. @@ -22,10 +34,6 @@ Use `Lightricks/LTX-2` or `Lightricks/LTX-2.3` as `--model-path`. SGLang loads t **License notice:** LTX-2 and LTX-2.3 are released under the LTX-2 Community License Agreement, not Apache 2.0. The license includes commercial-use restrictions for some entities. Review the [official Lightricks license](https://huggingface.co/Lightricks/LTX-2.3/blob/main/LICENSE) before production or commercial use; SGLang support does not grant additional model usage rights. -## 2. SGLang-diffusion Installation - -Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation). Docker is recommended for Linux GPU deployments; run the commands below inside the container or your installed Python environment. - ## 3. Model Deployment This section provides deployment configurations optimized for different LTX pipelines and hardware targets. @@ -34,9 +42,7 @@ This section provides deployment configurations optimized for different LTX pipe The LTX series supports one-stage and two-stage pipelines. LTX-2.3 also supports the HQ two-stage pipeline. The recommended launch configuration depends on whether the target GPU can keep both two-stage DiTs resident. -**Interactive Command Generator**: Use the configuration selector below to generate a deployment command. The default selection targets a single NVIDIA H200 with `resident` two-stage mode. For multi-GPU serving, start from the 2-GPU or 4-GPU presets and only change parallelism if you need more memory headroom. - - +Use the [command builder](#1-quick-start) above. ### 3.2 Configuration Tips diff --git a/docs/cookbook/diffusion/LTX/LTX2.5.mdx b/docs/cookbook/diffusion/LTX/LTX2.5.mdx index ee867b52a2..7b760058e9 100644 --- a/docs/cookbook/diffusion/LTX/LTX2.5.mdx +++ b/docs/cookbook/diffusion/LTX/LTX2.5.mdx @@ -6,11 +6,36 @@ metatags: --- import { DiffusionModelTags } from '/src/snippets/diffusion/model-tags.jsx'; -import { LTX25Deployment } from '/src/snippets/diffusion/ltx25-deployment.jsx'; -## 1. Model Introduction +import { Deployment } from '/src/snippets/_deployment.jsx'; +import { config } from '/src/snippets/configs/Lightricks/ltx25.jsx'; + +## 1. Quick start + +Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation) for your GPU platform. + + + + + +Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation). Docker is recommended for Linux GPU deployments; run the commands below inside the container or your installed Python environment. + +NATTEN is an optional extra, worth installing only if you plan to use the +[diffusion decoder](#4-6-diffusion-decoder) — see that section for why. + + + + + +To use diffusion decoding, load **Diffusion decoder weights** in Server, then +select **Diffusion** in Request. Duration and decoder selection are request-time +choices; loading the optional decoder requires a server restart. + + + +## 2. Model capabilities [LTX-2.5](https://huggingface.co/Lightricks/LTX-2.5) is an open world model from Lightricks, built for local execution and fine-tuning. Its established use is @@ -31,7 +56,9 @@ before production or commercial use; SGLang support does not grant additional model usage rights. -### 1.1 New in LTX-2.5 + + +### 2.1 New in LTX-2.5 Two capabilities have no equivalent in LTX-2 / LTX-2.3: @@ -49,7 +76,9 @@ Two capabilities have no equivalent in LTX-2 / LTX-2.3: Both are optional and off by default. -### 1.2 Components + + +### 2.2 Components | Path | Component | Used by | | --- | --- | --- | @@ -64,13 +93,6 @@ Both are optional and off by default. Encoding always uses `vae/`, and both decoders consume the same latents, so the decoder choice does not change anything upstream of it. -## 2. SGLang-diffusion Installation - -Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation). Docker is recommended for Linux GPU deployments; run the commands below inside the container or your installed Python environment. - -NATTEN is an optional extra, worth installing only if you plan to use the -[diffusion decoder](#4-6-diffusion-decoder) — see that section for why. - ## 3. Model Deployment ### 3.1 Basic Configuration @@ -83,13 +105,7 @@ sglang serve \ On a single high-VRAM GPU no extra flags are needed. -**Interactive Command Generator**: pick a target and the features you want; the -command updates below. Server-side choices (pipeline class, weights variant, -parallelism) go on `sglang serve`, while per-request choices (auto-duration, -diffusion decoder, resolution) are listed separately, since they belong on the -`sglang generate` call or the request body. - - +Use the [command builder](#1-quick-start) above. ### 3.2 Configuration Tips diff --git a/docs/cookbook/diffusion/LingBot-Video/LingBot-Video-MoE.mdx b/docs/cookbook/diffusion/LingBot-Video/LingBot-Video-MoE.mdx index 22c5effdb9..dba2ce62ab 100644 --- a/docs/cookbook/diffusion/LingBot-Video/LingBot-Video-MoE.mdx +++ b/docs/cookbook/diffusion/LingBot-Video/LingBot-Video-MoE.mdx @@ -9,7 +9,20 @@ import { DiffusionModelTags } from '/src/snippets/diffusion/model-tags.jsx'; -## 1. Model Introduction +import { Deployment } from '/src/snippets/_deployment.jsx'; +import { config } from '/src/snippets/configs/LingBot/lingbot-video.jsx'; + +## 1. Quick start + +Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation) for your GPU platform. + + + + + + + +## 2. Model capabilities [LingBot Video MoE 30B-A3B](https://huggingface.co/robbyant/lingbot-video-moe-30b-a3b) is a text-to-video mixture-of-experts model served through a native SGLang @@ -32,10 +45,6 @@ The checkpoint expects a structured JSON caption rather than an unexpanded natural-language prompt. The JSON is passed as the request's `prompt` string; it is not an `extra_params` object. -## 2. Installation - -Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation). Docker is recommended for Linux GPU deployments; run the commands below inside the container or your installed Python environment. - ## 3. Serve LingBot Video MoE Start the server with the Hugging Face model ID: diff --git a/docs/cookbook/diffusion/LingBot-World/LingBot-World-2.0.mdx b/docs/cookbook/diffusion/LingBot-World/LingBot-World-2.0.mdx index b81759b7b0..51155544bd 100644 --- a/docs/cookbook/diffusion/LingBot-World/LingBot-World-2.0.mdx +++ b/docs/cookbook/diffusion/LingBot-World/LingBot-World-2.0.mdx @@ -1,5 +1,6 @@ --- title: LingBot World 2.0 +description: "Serve LingBot World 2.0 realtime camera-controlled video world models with SGLang-diffusion." metatags: description: "Serve LingBot World 2.0 realtime camera-controlled video world models with SGLang-diffusion." tag: REALTIME @@ -9,13 +10,28 @@ import { DiffusionModelTags } from '/src/snippets/diffusion/model-tags.jsx'; -## 1. Model Introduction +import { Deployment } from '/src/snippets/_deployment.jsx'; +import { config } from '/src/snippets/configs/LingBot/lingbot-world2.jsx'; + +## 1. Quick start + +Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation) for your GPU platform. + +Use the [Realtime WebUI](#3-realtime-webui) to start a camera-controlled session. The Request tab checks model metadata; video generation uses WebSocket, not an HTTP POST. + + + + + +## 2. Model capabilities [LingBot World 2.0](https://huggingface.co/robbyant/lingbot-world-v2-14b-causal-fast-diffusers) is the 14B realtime camera-controlled world model in the LingBot family. It generates continuously from a live causal session, accepts control updates between chunks, and reuses DiT and VAE state for incremental frame delivery. Choose 2.0 when the larger model and interactive KV-window path justify an 8-GPU deployment. Like the earlier LingBot release, it prioritizes responsive control and bounded causal state over the full-clip global context of offline video diffusion. -## 2. Deployment + + +## 3. Deployment ```bash Command export SGLANG_LINGBOT_LAZY_VAE_ENCODE_BLACK_FRAMES=60 @@ -42,7 +58,9 @@ The current and most recent completed chunks remain in BF16. See for the algorithm, tuning options, measured memory-latency tradeoff, and support limits. -## 3. Realtime WebUI + + +## 4. Realtime WebUI The lightweight local WebUI is useful for validating latency, frame transport, and camera control behavior. @@ -56,7 +74,9 @@ Open `http://127.0.0.1:18080` and use: ws://127.0.0.1:30000/v1/realtime_video/generate ``` -## 4. HTTP and WebSocket API + + +## 5. HTTP and WebSocket API LingBot World 2.0 uses the realtime video WebSocket endpoint. The server keeps one live session, generates one chunk at a time, and accepts runtime control events while generation is running. @@ -175,17 +195,23 @@ ws.send_binary(msgspec.msgpack.encode({ })) ``` -## 5. Consistency + + +## 6. Consistency LingBot World 2.0 uses raw-frame websocket GT plus per-chunk latency guards for consistency checks. -## 6. Notes + + +## 7. Notes - Use the realtime endpoint for interactive sessions: `/v1/realtime_video/generate`. - Prefer WebP preview transport for interactive testing; use raw-frame transport for consistency checks. - Long-running sessions should be validated with raw-frame consistency before changing causal cache, condition sampling, or VAE decode behavior. -## 7. Run in ComfyUI + + +## 8. Run in ComfyUI import { ComfyUISupport } from '/src/snippets/diffusion/comfyui-support.jsx'; diff --git a/docs/cookbook/diffusion/LingBot-World/LingBot-World.mdx b/docs/cookbook/diffusion/LingBot-World/LingBot-World.mdx index 1f3e47d55b..8d43bebaab 100644 --- a/docs/cookbook/diffusion/LingBot-World/LingBot-World.mdx +++ b/docs/cookbook/diffusion/LingBot-World/LingBot-World.mdx @@ -1,5 +1,6 @@ --- title: LingBot World +description: "Serve LingBot World realtime camera-controlled video world models with SGLang-diffusion." metatags: description: "Serve LingBot World realtime camera-controlled video world models with SGLang-diffusion." tag: REALTIME @@ -9,13 +10,28 @@ import { DiffusionModelTags } from '/src/snippets/diffusion/model-tags.jsx'; -## 1. Model Introduction +import { Deployment } from '/src/snippets/_deployment.jsx'; +import { config } from '/src/snippets/configs/LingBot/lingbot-world.jsx'; + +## 1. Quick start + +Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation) for your GPU platform. + +Use the [Realtime WebUI](#3-realtime-webui) to start a camera-controlled session. The Request tab checks model metadata; video generation uses WebSocket, not an HTTP POST. + + + + + +## 2. Model capabilities [LingBot World](https://huggingface.co/robbyant/lingbot-world-fast-diffusers) is a realtime camera-controlled video world model. It keeps a live causal session, applies prompt and camera events between chunks, reuses DiT/VAE state, and streams decoded frames instead of finishing a bounded clip before returning. Choose it for interactive exploration and continuous control, not one-shot cinematic generation. The causal window makes long sessions practical but gives up the global bidirectional context available to offline Wan or LTX pipelines; session state and cache policy are therefore part of the serving contract. -## 2. Deployment + + +## 3. Deployment ```bash Command sglang serve \ @@ -37,7 +53,9 @@ The current and most recent completed chunks remain in BF16. See for the algorithm, tuning options, measured memory-latency tradeoff, and support limits. -## 3. Realtime WebUI + + +## 4. Realtime WebUI The lightweight local WebUI is useful for validating latency, frame transport, and camera control behavior. @@ -51,7 +69,9 @@ Open `http://127.0.0.1:18080` and use: ws://127.0.0.1:30000/v1/realtime_video/generate ``` -## 4. HTTP and WebSocket API + + +## 5. HTTP and WebSocket API LingBot World uses the realtime video WebSocket endpoint. The server keeps one live session, generates one chunk at a time, and accepts runtime control events while generation is running. @@ -150,17 +170,23 @@ ws.send_binary(msgspec.msgpack.encode({ })) ``` -## 5. Consistency + + +## 6. Consistency LingBot World uses raw-frame websocket GT plus per-chunk latency guards for consistency checks. -## 6. Notes + + +## 7. Notes - Use the realtime endpoint for interactive sessions: `/v1/realtime_video/generate`. - Prefer WebP preview transport for interactive testing; use raw-frame transport for consistency checks. - Long-running sessions should be validated with raw-frame consistency before changing causal cache, condition sampling, or VAE decode behavior. -## 7. Run in ComfyUI + + +## 8. Run in ComfyUI import { ComfyUISupport } from '/src/snippets/diffusion/comfyui-support.jsx'; diff --git a/docs/cookbook/diffusion/LongCat/LongCat-Image.mdx b/docs/cookbook/diffusion/LongCat/LongCat-Image.mdx index 4c56504a3a..d4cae8c7dd 100644 --- a/docs/cookbook/diffusion/LongCat/LongCat-Image.mdx +++ b/docs/cookbook/diffusion/LongCat/LongCat-Image.mdx @@ -1,5 +1,6 @@ --- title: LongCat-Image +description: "Deploy LongCat-Image with SGLang Diffusion and its native in-process Qwen2.5-VL prompt rewriter." metatags: description: "Deploy LongCat-Image with SGLang Diffusion and its native in-process Qwen2.5-VL prompt rewriter." --- @@ -8,7 +9,20 @@ import { DiffusionModelTags } from '/src/snippets/diffusion/model-tags.jsx'; -## 1. Model Introduction +import { Deployment } from '/src/snippets/_deployment.jsx'; +import { config } from '/src/snippets/configs/LongCat/longcat-image.jsx'; + +## 1. Quick start + +Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation) for your GPU platform. + + + + + + + +## 2. Model capabilities [LongCat-Image](https://huggingface.co/meituan-longcat/LongCat-Image) is a text-to-image model from Meituan. SGLang runs its Qwen2.5-VL prompt rewriter @@ -18,10 +32,6 @@ The native pipeline keeps prompt rewriting and diffusion behind one OpenAI-compa image endpoint. Rewriting is enabled by default for stronger prompt expansion, but each request can disable it when lower latency matters more than the rewritten prompt. -## 2. Installation - -Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation). Docker is recommended for Linux GPU deployments; run the commands below inside the container or your installed Python environment. - ## 3. Serve the model ```bash Command diff --git a/docs/cookbook/diffusion/LongLive/LongLive-2.0.mdx b/docs/cookbook/diffusion/LongLive/LongLive-2.0.mdx index 0d9a8363df..0d487172e7 100644 --- a/docs/cookbook/diffusion/LongLive/LongLive-2.0.mdx +++ b/docs/cookbook/diffusion/LongLive/LongLive-2.0.mdx @@ -7,7 +7,20 @@ import { DiffusionModelTags } from '/src/snippets/diffusion/model-tags.jsx'; -## 1. Model Introduction +import { Deployment } from '/src/snippets/_deployment.jsx'; +import { config } from '/src/snippets/configs/nvidia/longlive2.jsx'; + +## 1. Quick start + +Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation) for your GPU platform. + + + + + + + +## 2. Model capabilities [LongLive 2.0](https://nvlabs.github.io/LongLive/LongLive2/) is NVIDIA's 4-step text/image-to-video model distilled from Wan2.2-TI2V-5B. Its main strength is extending few-step causal generation across prompt changes, so a single request can produce multi-shot sequences without paying a full diffusion schedule for every shot. @@ -15,10 +28,6 @@ Choose it for low-step long or multi-shot generation rather than maximum one-sho The model weights use the NVIDIA Open Model License. See the [paper](https://arxiv.org/abs/2605.18739) and [GitHub repository](https://github.com/NVlabs/LongLive) for training details. -## 2. SGLang-diffusion Installation - -Please refer to the [official SGLang-diffusion installation guide](/docs/sglang-diffusion/installation) for installation instructions. - ## 3. Deployment ```bash Command diff --git a/docs/cookbook/diffusion/MOVA/MOVA.mdx b/docs/cookbook/diffusion/MOVA/MOVA.mdx index 2f9c9aa743..92227367e6 100644 --- a/docs/cookbook/diffusion/MOVA/MOVA.mdx +++ b/docs/cookbook/diffusion/MOVA/MOVA.mdx @@ -1,5 +1,6 @@ --- title: MOVA +description: "Deploy MOVA with SGLang - simultaneous video and audio generation with asymmetric dual-tower architecture, precise lip-sync, and environment-aware sound effects." metatags: description: "Deploy MOVA with SGLang - simultaneous video and audio generation with asymmetric dual-tower architecture, precise lip-sync, and environment-aware sound effects." --- @@ -8,7 +9,27 @@ import { DiffusionModelTags } from '/src/snippets/diffusion/model-tags.jsx'; -## 1. Model Introduction +import { Deployment } from '/src/snippets/_deployment.jsx'; +import { config } from '/src/snippets/configs/OpenMOSS/mova.jsx'; + +## 1. Quick start + +Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation) for your GPU platform. + +Set the output directory before starting the server: + +```bash +export SG_OUTPUT_DIR=/root/output_mova +mkdir -p "$SG_OUTPUT_DIR" +``` + + + + + + + +## 2. Model capabilities [MOVA](https://github.com/OpenMOSS/MOVA) generates video and audio together with an asymmetric dual-tower model connected by bidirectional cross-attention. Its strongest use cases are speaking subjects, visible sound-producing events, and scenes where ambient audio must track the picture rather than be synthesized by a later cascade. @@ -19,12 +40,6 @@ The public 360p and 720p checkpoints both generate up to 8 seconds. Choose 360p | `OpenMOSS-Team/MOVA-360p` | Faster, lower-memory joint audiovisual generation | Up to 8 seconds at 360p | | `OpenMOSS-Team/MOVA-720p` | Higher-resolution lip-sync and environment audio | Up to 8 seconds at 720p | -## 2. SGLang-diffusion Installation - -SGLang-diffusion offers multiple installation methods. You can choose the most suitable installation method based on your hardware platform and requirements. - -Please refer to the [official SGLang-diffusion installation guide](https://docs.sglang.io/docs/sglang-diffusion/installation) for installation instructions. - ## 3. Model Deployment This section provides deployment configurations optimized for different hardware platforms and use cases. @@ -33,11 +48,8 @@ This section provides deployment configurations optimized for different hardware MOVA supports both online serving and CLI generation modes. The recommended launch configurations vary by hardware and resolution. -**Interactive Command Generator**: Use the configuration selector below to automatically generate the appropriate deployment command for your hardware platform. -import { MOVADeployment } from '/src/snippets/diffusion/mova-deployment.jsx' - - +Use the [command builder](#1-quick-start) above. ### 3.2 Configuration Tips diff --git a/docs/cookbook/diffusion/Qwen-Image/Qwen-Image-Edit.mdx b/docs/cookbook/diffusion/Qwen-Image/Qwen-Image-Edit.mdx index 5b5c585130..2d4e3f0fb5 100644 --- a/docs/cookbook/diffusion/Qwen-Image/Qwen-Image-Edit.mdx +++ b/docs/cookbook/diffusion/Qwen-Image/Qwen-Image-Edit.mdx @@ -1,26 +1,33 @@ --- title: Qwen-Image-Edit-2511 +description: "Deploy Qwen-Image-Edit-2511 with SGLang - 20B image editing model with text rendering, character consistency, and geometric reasoning." metatags: description: "Deploy Qwen-Image-Edit-2511 with SGLang - 20B image editing model with text rendering, character consistency, and geometric reasoning." --- import { DiffusionModelTags } from '/src/snippets/diffusion/model-tags.jsx'; -import { QwenImageEditDeployment } from '/src/snippets/diffusion/qwen-image-edit-deployment.jsx'; -## 1. Model Introduction +import { Deployment } from '/src/snippets/_deployment.jsx'; +import { config } from '/src/snippets/configs/Qwen/qwen-image-edit.jsx'; + +## 1. Quick start + +Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation) for your GPU platform. + + + + + + + +## 2. Model capabilities [Qwen-Image-Edit-2511](https://huggingface.co/Qwen/Qwen-Image-Edit-2511) is the 20B editing counterpart to Qwen-Image. It is strongest at changing text, materials, lighting, viewpoint, or composition while reducing drift in regions that were not requested to change. Choose it for identity-sensitive portrait edits, multi-person composition, typography replacement, and geometry-aware design work. It is substantially heavier than small specialist editors, and consistency is improved rather than guaranteed; evaluate untouched-region drift on the actual editing workload. -## 2. SGLang-diffusion Installation - -SGLang-diffusion offers multiple installation methods. You can choose the most suitable installation method based on your hardware platform and requirements. - -Please refer to the [official SGLang-diffusion installation guide](https://docs.sglang.io/docs/sglang-diffusion/installation) for installation instructions. - ## 3. Model Deployment This section provides deployment configurations optimized for different hardware platforms and use cases. @@ -29,9 +36,7 @@ This section provides deployment configurations optimized for different hardware Qwen-Image-Edit-2511 is a 20B parameter model optimized for image editing tasks. The recommended launch configurations vary by hardware. -**Interactive Command Generator**: Use the configuration selector below to automatically generate the appropriate deployment command for your hardware platform. - - +Use the [command builder](#1-quick-start) above. ### 3.2 Configuration Tips diff --git a/docs/cookbook/diffusion/Qwen-Image/Qwen-Image.mdx b/docs/cookbook/diffusion/Qwen-Image/Qwen-Image.mdx index 881dfa9c5e..f3b2c9ec9f 100644 --- a/docs/cookbook/diffusion/Qwen-Image/Qwen-Image.mdx +++ b/docs/cookbook/diffusion/Qwen-Image/Qwen-Image.mdx @@ -1,26 +1,33 @@ --- title: Qwen-Image +description: "Deploy Qwen-Image with SGLang - community contribution guide for Qwen's image generation model." metatags: description: "Deploy Qwen-Image with SGLang - community contribution guide for Qwen's image generation model." --- import { DiffusionModelTags } from '/src/snippets/diffusion/model-tags.jsx'; -import { QwenImageDeployment } from '/src/snippets/diffusion/qwen-image-deployment.jsx'; -## 1. Model Introduction +import { Deployment } from '/src/snippets/_deployment.jsx'; +import { config } from '/src/snippets/configs/Qwen/qwen-image.jsx'; + +## 1. Quick start + +Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation) for your GPU platform. + + + + + + + +## 2. Model capabilities [Qwen-Image](https://huggingface.co/Qwen/Qwen-Image) is a 20B text-to-image model built for strong prompt following and precise rendering of English and Chinese text. It is especially useful for posters, signs, diagrams, and dense layouts where typography and spatial relationships matter as much as general image quality. This page covers generation rather than editing: use Qwen-Image-Edit when an existing image, subject identity, or untouched region must be preserved. The full checkpoint is memory-heavy, while the validated ModelOpt NVFP4 release provides a supported low-precision deployment option with an expected quality tradeoff. -## 2. SGLang-diffusion Installation - -SGLang-diffusion offers multiple installation methods. You can choose the most suitable installation method based on your hardware platform and requirements. - -Please refer to the [official SGLang-diffusion installation guide](../../../docs/sglang-diffusion/installation) for installation instructions. - ## 3. Model Deployment This section provides deployment configurations optimized for different hardware platforms and use cases. @@ -29,9 +36,7 @@ This section provides deployment configurations optimized for different hardware Qwen-Image is a text-to-image model. The recommended launch configurations vary by hardware. SGLang supports serving Qwen-Image on NVIDIA B200, B300, H200, H100, AMD MI300X, MI325X, MI355X GPUs and Ascend A2/A3 Series NPUs. -**Interactive Command Generator**: Use the configuration selector below to automatically generate the appropriate deployment command for your hardware platform. - - +Use the [command builder](#1-quick-start) above. For the validated ModelOpt NVFP4 checkpoint on Blackwell, load the published Qwen-Image-2512 NVFP4 repo directly: diff --git a/docs/cookbook/diffusion/SANA-Video/SANA-Video.mdx b/docs/cookbook/diffusion/SANA-Video/SANA-Video.mdx index 66006723e7..fd76b41c0d 100644 --- a/docs/cookbook/diffusion/SANA-Video/SANA-Video.mdx +++ b/docs/cookbook/diffusion/SANA-Video/SANA-Video.mdx @@ -9,7 +9,20 @@ import { DiffusionModelTags } from '/src/snippets/diffusion/model-tags.jsx'; -## 1. Model Introduction +import { Deployment } from '/src/snippets/_deployment.jsx'; +import { config } from '/src/snippets/configs/SANA/sana-video.jsx'; + +## 1. Quick start + +Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation) for your GPU platform. + + + + + + + +## 2. Model capabilities [SANA-Video 2B 480p](https://huggingface.co/Efficient-Large-Model/SANA-Video_2B_480p_diffusers) is a lightweight text-to-video model served through a native SGLang Diffusion @@ -26,10 +39,6 @@ from the prompt with an optional `motion score: N.` suffix. | --- | --- | --- | | `Efficient-Large-Model/SANA-Video_2B_480p_diffusers` | Text to video | 832x480, 81 frames at 16 FPS | -## 2. Installation - -Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation). Docker is recommended for Linux GPU deployments; run the commands below inside the container or your installed Python environment. - ## 3. Serve SANA-Video ```bash Command diff --git a/docs/cookbook/diffusion/SANA-WM/SANA-WM.mdx b/docs/cookbook/diffusion/SANA-WM/SANA-WM.mdx index 4983ea663c..ed7d60add5 100644 --- a/docs/cookbook/diffusion/SANA-WM/SANA-WM.mdx +++ b/docs/cookbook/diffusion/SANA-WM/SANA-WM.mdx @@ -1,5 +1,6 @@ --- title: SANA-WM +description: "Deploy SANA-WM with SGLang - a camera-controlled text+image-to-video world model with WASD/IJKL 6-DoF camera control, served three ways: dense bidirectional and chunk-causal batch streaming over /v1/videos (SanaWMTwoStagePipeline), and live over a realtime WebSocket API (SanaWMRealtimePipeline, /v1/realtime_video/generate)." metatags: description: "Deploy SANA-WM with SGLang - a camera-controlled text+image-to-video world model with WASD/IJKL 6-DoF camera control, served three ways: dense bidirectional and chunk-causal batch streaming over /v1/videos (SanaWMTwoStagePipeline), and live over a realtime WebSocket API (SanaWMRealtimePipeline, /v1/realtime_video/generate)." --- @@ -8,7 +9,30 @@ import { DiffusionModelTags } from '/src/snippets/diffusion/model-tags.jsx'; -## 1. Model Introduction +import { Deployment } from '/src/snippets/_deployment.jsx'; +import { config } from '/src/snippets/configs/SANA/sana-wm.jsx'; + +## 1. Quick start + +Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation) for your GPU platform. + +For realtime mode, use the [WebSocket client](#7-realtime-websocket-api); the Request tab only checks model metadata in that mode. + + + + + +SGLang-diffusion offers multiple installation methods depending on your hardware platform. Please refer to the [SGLang Diffusion installation guide](../../../docs/sglang-diffusion/installation). + +SANA-WM adds the `SanaWMTransformer3DModel` + GDN kernels, the `SanaWMTwoStagePipeline` (dense bidirectional + chunk-causal streaming), and the `SanaWMRealtimePipeline` with the `/v1/realtime_video` WebSocket router. Use `sglang serve` to launch the diffusion server. + + + + + + + +## 2. Model capabilities [SANA-WM](https://huggingface.co/Efficient-Large-Model/SANA-WM_bidirectional) is NVLabs' 2.6B text-and-image-to-video world model for 720p, minute-scale generation with explicit per-frame 6-DoF camera control. Its hybrid recurrent/softmax attention keeps long causal histories bounded, while an LTX-2 refiner supplies the detail that the fast Stage-1 world model does not produce on its own. @@ -33,12 +57,6 @@ Choose the dense checkpoint for the best bounded-clip quality and the streaming For architecture and training details, see the [SANA-WM paper](https://arxiv.org/abs/2605.15178) and [model card](https://huggingface.co/Efficient-Large-Model/SANA-WM_bidirectional) (Apache-2.0). -## 2. Installation - -SGLang-diffusion offers multiple installation methods depending on your hardware platform. Please refer to the [SGLang Diffusion installation guide](../../../docs/sglang-diffusion/installation). - -SANA-WM adds the `SanaWMTransformer3DModel` + GDN kernels, the `SanaWMTwoStagePipeline` (dense bidirectional + chunk-causal streaming), and the `SanaWMRealtimePipeline` with the `/v1/realtime_video` WebSocket router. Use `sglang serve` to launch the diffusion server. - ## 3. Model Setup Both SANA-WM checkpoints are **public** (Apache-2.0, no gating, no token) and load **directly** — there is no manual assembly step. Pass the HuggingFace repo id to `--model-path` and SGLang downloads, materializes, validates, and loads it: diff --git a/docs/cookbook/diffusion/SenseNova/SenseNova-U1.5-8B-MoT.mdx b/docs/cookbook/diffusion/SenseNova/SenseNova-U1.5-8B-MoT.mdx index f5006040c1..4d9d915fd1 100644 --- a/docs/cookbook/diffusion/SenseNova/SenseNova-U1.5-8B-MoT.mdx +++ b/docs/cookbook/diffusion/SenseNova/SenseNova-U1.5-8B-MoT.mdx @@ -1,5 +1,6 @@ --- title: SenseNova-U1.5-8B-MoT +description: "Run SenseNova-U1.5-8B-MoT text-to-image generation with SGLang's native multimodal generation runtime." metatags: description: "Run SenseNova-U1.5-8B-MoT text-to-image generation with SGLang's native multimodal generation runtime." --- @@ -8,18 +9,25 @@ import { DiffusionModelTags } from '/src/snippets/diffusion/model-tags.jsx'; -## 1. Model Introduction +import { Deployment } from '/src/snippets/_deployment.jsx'; +import { config } from '/src/snippets/configs/SenseNova/sensenova-u15.jsx'; + +## 1. Quick start + +Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation) for your GPU platform. + + + + + + + +## 2. Model capabilities [SenseNova-U1.5-8B-MoT](https://huggingface.co/sensenova/SenseNova-U1.5-8B-MoT) is a text-to-image model in the SenseNova-U1 family. It is useful for high-resolution poster, infographic, and enterprise visual-generation workloads where prompt following, layout structure, and Chinese text rendering are important. Built on [NEO-Unify](https://huggingface.co/blog/sensenova/neo-unify), this release improves composition, color harmony, material rendering, and local visual detail for native high-resolution generation. It also focuses on clearer Chinese and English text rendering, stronger infographic layout structure, and more reliable execution of complex prompts with object counts, spatial relationships, styles, and multiple constraints. -## 2. SGLang-diffusion Installation - -SGLang-diffusion offers multiple installation methods. You can choose the most suitable installation method based on your hardware platform and requirements. - -Please refer to the [official SGLang-diffusion installation guide](../../../docs/sglang-diffusion/installation) for installation instructions. - ## 3. Model Deployment ### 3.1 Offline Image Generation diff --git a/docs/cookbook/diffusion/Wan/Wan2.1.mdx b/docs/cookbook/diffusion/Wan/Wan2.1.mdx index db8abc4b1d..95fab54f8b 100644 --- a/docs/cookbook/diffusion/Wan/Wan2.1.mdx +++ b/docs/cookbook/diffusion/Wan/Wan2.1.mdx @@ -1,26 +1,33 @@ --- title: Wan2.1 +description: "Deploy Wan2.1 video generation models with SGLang - community contribution guide for Wan Video's diffusion models." metatags: description: "Deploy Wan2.1 video generation models with SGLang - community contribution guide for Wan Video's diffusion models." --- import { DiffusionModelTags } from '/src/snippets/diffusion/model-tags.jsx'; -import { Wan21Deployment } from '/src/snippets/diffusion/wan21-deployment.jsx'; -## 1. Model Introduction +import { Deployment } from '/src/snippets/_deployment.jsx'; +import { config } from '/src/snippets/configs/Wan/wan21.jsx'; + +## 1. Quick start + +Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation) for your GPU platform. + + + + + + + +## 2. Model capabilities [Wan2.1](https://github.com/Wan-Video/Wan2.1) is a broad open video family covering text-to-video and image-to-video across 1.3B and 14B checkpoints. Its practical strengths are motion-rich generation, temporal consistency, and readable Chinese/English text, with 480p and 720p variants for different quality and memory targets. Choose the 1.3B T2V model for consumer-GPU experiments and the 14B models when quality matters more than footprint. Wan2.1 is a dense DiT family; for timestep-specialized MoE capacity or the unified 5B TI2V path, use Wan2.2 instead. -## 2. SGLang-diffusion Installation - -SGLang-diffusion offers multiple installation methods. You can choose the most suitable installation method based on your hardware platform and requirements. - -Please refer to the [official SGLang-diffusion installation guide](../../../docs/sglang-diffusion/installation) for installation instructions. - ## 3. Model Deployment This section provides deployment configurations optimized for different hardware platforms and use cases. @@ -29,9 +36,7 @@ This section provides deployment configurations optimized for different hardware The Wan2.1 series offers models in multiple sizes and resolutions. SGLang supports Wan2.1 deployment on NVIDIA B200, B300, H200, H100, and AMD MI300X, MI325X, MI355X GPUs and Ascend A2/A3 Series NPUs. The recommended launch configurations vary by hardware, model size, and memory headroom. -**Interactive Command Generator**: Use the configuration selector below to automatically generate an appropriate deployment command for your model variant and options. - - +Use the [command builder](#1-quick-start) above. ### 3.2 Configuration Tips diff --git a/docs/cookbook/diffusion/Wan/Wan2.2.mdx b/docs/cookbook/diffusion/Wan/Wan2.2.mdx index 3ee5618663..d3b8e29bdf 100644 --- a/docs/cookbook/diffusion/Wan/Wan2.2.mdx +++ b/docs/cookbook/diffusion/Wan/Wan2.2.mdx @@ -1,15 +1,28 @@ --- title: Wan2.2 +description: "Deploy Wan2.2 video generation models with SGLang - MoE architecture, cinematic aesthetics, and efficient 720P@24fps generation." metatags: description: "Deploy Wan2.2 video generation models with SGLang - MoE architecture, cinematic aesthetics, and efficient 720P@24fps generation." --- import { DiffusionModelTags } from '/src/snippets/diffusion/model-tags.jsx'; -import { Wan22Deployment } from '/src/snippets/diffusion/wan22-deployment.jsx'; -## 1. Model Introduction +import { Deployment } from '/src/snippets/_deployment.jsx'; +import { config } from '/src/snippets/configs/Wan/wan22.jsx'; + +## 1. Quick start + +Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation) for your GPU platform. + + + + + + + +## 2. Model capabilities [Wan2.2](https://github.com/Wan-Video/Wan2.2) extends the Wan family with timestep-specialized Mixture-of-Experts models and a unified 5B TI2V checkpoint. It targets cinematic composition, lighting, and complex motion while supporting text-to-video, image-to-video, and hybrid text/image conditioning. @@ -21,12 +34,6 @@ for image-to-video generation. Use `Wan-AI/Wan2.2-I2V-A14B-Diffusers` when I2V quality is the priority. -## 2. SGLang-diffusion Installation - -SGLang-diffusion offers multiple installation methods. You can choose the most suitable installation method based on your hardware platform and requirements. - -Please refer to the [official SGLang-diffusion installation guide](https://docs.sglang.io/docs/sglang-diffusion/installation) for installation instructions. - ## 3. Model Deployment This section provides deployment configurations optimized for different hardware platforms and use cases. @@ -35,9 +42,7 @@ This section provides deployment configurations optimized for different hardware The Wan2.2 series offers models in various sizes, architectures and input types, optimized for different hardware platforms. The recommended launch configurations vary by hardware and model size. -**Interactive Command Generator**: Use the configuration selector below to automatically generate the appropriate deployment command for your hardware platform, model size. SGLang supports serving Wan2.2 on NVIDIA B200, H200, AMD MI300X, MI325X, MI355X GPUs and Ascend A2/A3 Series NPUs. - - +Use the [command builder](#1-quick-start) above. ### 3.2 Configuration Tips diff --git a/docs/cookbook/diffusion/Z-Image/Z-Image-Turbo.mdx b/docs/cookbook/diffusion/Z-Image/Z-Image-Turbo.mdx index f38c431142..011bbd85e7 100644 --- a/docs/cookbook/diffusion/Z-Image/Z-Image-Turbo.mdx +++ b/docs/cookbook/diffusion/Z-Image/Z-Image-Turbo.mdx @@ -1,26 +1,33 @@ --- title: Z-Image-Turbo +description: "Deploy Z-Image-Turbo with SGLang - community contribution guide for Z-Image's fast image generation model." metatags: description: "Deploy Z-Image-Turbo with SGLang - community contribution guide for Z-Image's fast image generation model." --- import { DiffusionModelTags } from '/src/snippets/diffusion/model-tags.jsx'; -import { ZImageTurboDeployment } from '/src/snippets/diffusion/zimage-turbo-deployment.jsx'; -## 1. Model Introduction +import { Deployment } from '/src/snippets/_deployment.jsx'; +import { config } from '/src/snippets/configs/TongyiMAI/z-image-turbo.jsx'; + +## 1. Quick start + +Follow the [SGLang Diffusion installation guide](/docs/sglang-diffusion/installation) for your GPU platform. + + + + + + + +## 2. Model capabilities [Z-Image-Turbo](https://huggingface.co/Tongyi-MAI/Z-Image-Turbo) is a distilled 6B single-stream DiT for fast text-to-image generation. It reaches its intended operating point in 8 function evaluations and is particularly strong at photorealistic scenes, prompt adherence, and English/Chinese text rendering. Choose it when latency and a relatively small deployment footprint matter more than the editability or maximum capacity of larger image models. It is a generation-only checkpoint; use Qwen-Image-Edit or FLUX.2 when the request includes source images or identity-preserving edits. -## 2. SGLang-diffusion Installation - -SGLang-diffusion offers multiple installation methods. You can choose the most suitable installation method based on your hardware platform and requirements. - -Please refer to the [official SGLang-diffusion installation guide](https://docs.sglang.io/docs/sglang-diffusion/installation) for installation instructions. - ## 3. Model Deployment This section provides deployment configurations optimized for different hardware platforms and use cases. @@ -29,9 +36,7 @@ This section provides deployment configurations optimized for different hardware Z-Image-Turbo is optimized for high-quality image generation with only 8 inference steps. The recommended launch configurations vary by hardware. -**Interactive Command Generator**: Use the configuration selector below to automatically generate the appropriate deployment command for your hardware platform and model version. SGLang supports serving Z-Image-Turbo on NVIDIA B200, H200, H100, and AMD MI355X, MI325X, MI300X GPUs, Ascend A2, A3 NPUs and Intel Arc Pro B-Series GPUs(codename: BMG (Battlemage)). - - +Use the [command builder](#1-quick-start) above. ### 3.2 Configuration Tips diff --git a/docs/custom.css b/docs/custom.css index 76fb5d4f9f..7b9f0ebbc3 100644 --- a/docs/custom.css +++ b/docs/custom.css @@ -362,6 +362,17 @@ html.dark table tbody tr:nth-child(even) td, .sgd-builder-controls, .sgd-builder-output-rail { min-width: 0; } .sgd-builder-controls { container: builder-controls / inline-size; padding: 4px 16px 20px; } +.sgd-builder-docs-tip { + display: block; + margin: 0; + padding: 12px 16px; + border-top: 1px solid var(--sgdb-line); + color: var(--sgdb-muted); + font-size: 12px; + line-height: 1.5; +} +.sgd-builder-docs-tip a { color: var(--sgdb-serve); text-decoration: underline; text-underline-offset: 3px; } + .sgd-builder-scope-panel { display: grid; gap: 0; } .sgd-builder-recipe { display: flex; diff --git a/docs/scripts/tests/diffusion-builders.test.mjs b/docs/scripts/tests/diffusion-builders.test.mjs new file mode 100644 index 0000000000..00ee1a7026 --- /dev/null +++ b/docs/scripts/tests/diffusion-builders.test.mjs @@ -0,0 +1,214 @@ +import assert from "node:assert/strict"; +import { readFileSync, readdirSync } from "node:fs"; +import { join } from "node:path"; +import { fileURLToPath } from "node:url"; +import { spawnSync } from "node:child_process"; +import test from "node:test"; + +const docs = fileURLToPath(new URL("../..", import.meta.url)); +const walk = (dir) => + readdirSync(dir, { withFileTypes: true }).flatMap((entry) => + entry.isDirectory() ? walk(join(dir, entry.name)) : [join(dir, entry.name)], + ); +const pages = walk(join(docs, "cookbook/diffusion")).filter((path) => path.endsWith(".mdx")); +const configs = new Map(); +for (const page of pages) { + const content = readFileSync(page, "utf8"); + const path = content.match(/import\s+\{\s*config\s*\}\s+from\s+["']([^"']+)["']/)?.[1]; + if (!path) continue; + const source = readFileSync(join(docs, path), "utf8"); + configs.set(page, (await import("data:text/javascript," + encodeURIComponent(source))).config); +} +const get = (suffix) => [...configs].find(([path]) => path.endsWith(suffix))[1]; +const selection = (config, overrides = {}) => ({ + ...config.commandBuilder.defaultSelection, + ...Object.fromEntries(config.overlayDims.map((dim) => [dim.id, dim.default])), + ...overrides, +}); +const resolve = (config, overrides = {}) => config.commandBuilder.resolveDeployment(selection(config, overrides)); +const curl = (config, overrides = {}) => + typeof config.curl === "function" ? config.curl(selection(config, overrides)) : config.curl; +const body = (config, overrides = {}) => JSON.parse(curl(config, overrides).match(/-d '([\s\S]+)'$/)[1]); +const migrated = [...configs.values()].filter((config) => + config.commandBuilder.resource.verifiedRecipes.some((recipe) => recipe.id.endsWith("-documented")), +); + +test("every diffusion model uses one shared builder before model capabilities", () => { + const models = pages.filter((path) => readFileSync(path, "utf8").includes("= 29); + for (const page of models) { + const content = readFileSync(page, "utf8"); + const quick = content.indexOf("## 1. Quick start"); + const builder = content.indexOf(""); + const capabilities = content.indexOf("## 2. Model capabilities"); + assert.ok(quick >= 0 && quick < builder && builder < capabilities, page); + assert.equal(content.match(/ path.endsWith("-deployment.jsx"))); +}); + +test("server builder has a footer link to the CLI reference", () => { + const shared = readFileSync(join(docs, "src/snippets/_deployment.jsx"), "utf8"); + assert.match(shared, /builderScope === "serve" && \(\s*

/); + const tip = shared.indexOf('className="sgd-builder-docs-tip"'); + assert.ok(tip > shared.indexOf('className="sgd-builder-output-rail"')); + const href = shared.slice(tip).match(/href="([^"]+)"/)[1]; + assert.equal(href, "/docs/sglang-diffusion/api/cli"); + assert.match(readFileSync(join(docs, `${href}.mdx`), "utf8"), /title: CLI reference/); +}); + +test("migrated recipes retain unverified status, valid scopes and editable ports", () => { + assert.equal(migrated.length, 22); + const shared = readFileSync(join(docs, "src/snippets/_deployment.jsx"), "utf8"); + const builtInIds = new Set([...shared.matchAll(/\bid: "([^"]+)"/g)].map((match) => match[1])); + for (const config of migrated) { + for (const hw of config.supportedHardware) { + assert.ok(builtInIds.has(hw) || config.hardware.some((entry) => entry.id === hw), `${config.modelName}: hidden ${hw}`); + } + for (const dim of config.overlayDims) assert.ok(["base", "serve", "request"].includes(dim.scope)); + for (const recipe of config.commandBuilder.resource.verifiedRecipes) { + const result = resolve(config, { ...recipe, topology_mode: "manual" }); + assert.deepEqual(result.builder.errors, [], config.modelName + " " + recipe.hw); + assert.equal(recipe.unverified, true); + assert.equal(result.verified, false); + assert.deepEqual(result.builder.verification, { serve: "unverified", request: "unverified" }); + assert.equal(result.flags.filter((flag) => flag.startsWith("--port ")).length, 1); + assert.ok(result.flags.includes("--port {{PORT}}")); + assert.equal(config.placeholders.PORT.default, config.placeholders.CURL_PORT.default); + } + } +}); + +test("migrated builders reject invalid resources and undocumented topology", () => { + for (const config of migrated) { + for (const overrides of [ + { hw: "unknown" }, + { nodes: 2 }, + { gpus_per_node: 0 }, + { gpus_per_node: 1.5 }, + { gpus_per_node: config.commandBuilder.resource.limits.gpus_per_node.max + 1 }, + { topology_mode: "manual", tp_size: 16, ulysses_degree: 16, ring_degree: 8 }, + ]) { + const result = resolve(config, overrides); + assert.ok(result.builder.errors.length, config.modelName + JSON.stringify(overrides)); + assert.deepEqual(result.builder.verification, { serve: "error", request: "error" }); + assert.equal(result.verified, false); + } + } +}); + +test("all reachable migrated options produce valid shell requests and no unresolved model", () => { + let checked = 0; + for (const config of migrated) { + let states = config.supportedHardware.map((hw) => selection(config, { hw })); + for (const dim of config.overlayDims) { + states = states.flatMap((s) => + dim.options + .filter((option) => !option.showWhen || option.showWhen(s)) + .map((option) => ({ ...s, [dim.id]: option.id })), + ); + } + for (const s of states) { + const result = config.commandBuilder.resolveDeployment(s); + assert.doesNotMatch(result.flags.join(" "), /undefined|NaN/); + const command = typeof config.curl === "function" ? config.curl(s) : config.curl; + assert.doesNotMatch(command, /undefined|\\n/); + const shell = spawnSync("bash", ["-n"], { input: command, encoding: "utf8" }); + assert.equal(shell.status, 0, config.modelName + shell.stderr); + const json = command.match(/-d '([\s\S]+)'$/)?.[1]; + if (json) assert.doesNotThrow(() => JSON.parse(json)); + checked++; + } + } + assert.ok(checked > 300); +}); + +test("legacy image hardware, precision and checkpoint choices remain available", () => { + const flux = get("/FLUX/FLUX.mdx"); + const qwen = get("/Qwen-Image/Qwen-Image.mdx"); + const edit = get("/Qwen-Image/Qwen-Image-Edit.mdx"); + const zimage = get("/Z-Image/Z-Image-Turbo.mdx"); + assert.equal(flux.supportedHardware.length, 10); + assert.equal(qwen.supportedHardware.length, 9); + assert.equal(edit.supportedHardware.length, 7); + assert.equal(zimage.supportedHardware.length, 9); + assert.ok(resolve(flux, { hw: "arc_b", version: "flux2-dev", gpus_per_node: 4 }).flags.includes("--tp-size 4")); + assert.ok(resolve(flux, { hw: "a2", version: "flux2-dev", gpus_per_node: 2 }).flags.includes("--tp-size 2")); + assert.ok( + resolve(qwen, { hw: "b200", precision: "nvfp4" }).flags.includes( + "--model-path lmsys/qwen-image-2512-modelopt-nvfp4-sglang", + ), + ); + assert.equal(qwen.overlayDims[0].options[1].showWhen({ hw: "h100" }), false); + assert.ok(resolve(zimage, { hw: "a3", gpus_per_node: 2 }).flags.includes("--tp-size 2")); + assert.match(curl(edit), /\/v1\/images\/edits/); + assert.match(curl(edit), /image=@\{\{INPUT_IMAGE\}\}/); +}); + +test("Wan preserves standard, multi-GPU, Ascend and LoRA recipes", () => { + for (const version of ["1", "2"]) { + const config = get(`/Wan/Wan2.${version}.mdx`); + assert.equal(config.overlayDims.find((dim) => dim.id === "variant").options.length, 3); + for (const hw of config.supportedHardware.filter((id) => !["a2", "a3"].includes(id))) { + const gpus = version === "2" && hw === "b300" ? 8 : 4; + const result = resolve(config, { hw, gpus_per_node: gpus }); + assert.deepEqual(result.builder.errors, []); + for (const flag of [ + "--dit-layerwise-offload true", + `--num-gpus ${gpus}`, + "--ulysses-degree 2", + "--enable-cfg-parallel", + ]) + assert.ok(result.flags.includes(flag)); + } + const ascend = resolve(config, { hw: "a3", gpus_per_node: 8 }); + for (const flag of ["--tp-size 2", "--sp-degree 4", "--num-gpus 8", "--attention-backend laser_attn"]) + assert.ok(ascend.flags.includes(flag)); + assert.equal(body(config, { variant: "i2v-14b" }).input_reference, "{{INPUT_IMAGE}}"); + } + assert.ok(resolve(get("/Wan/Wan2.1.mdx")).flags.includes("--lora-path NIVEDAN/wan2.1-lora")); + assert.ok(!resolve(get("/Wan/Wan2.2.mdx")).flags.some((flag) => flag.startsWith("--lora-path"))); +}); + +test("LTX request controls do not leak into startup and decoder loading is explicit", () => { + const config = get("/LTX/LTX2.5.mdx"); + const startup = resolve(config, { decoder_weights: "loaded" }); + const request = resolve(config, { decoder_weights: "loaded", decoder: "diffusion", duration: "auto" }); + assert.deepEqual(request.flags, startup.flags); + assert.ok(request.flags.includes("--load-diffusion-decoder")); + assert.ok(resolve(config, { decoder: "diffusion" }).builder.errors.length); + assert.equal(body(config, { decoder: "diffusion", duration: "auto" }).use_diffusion_decoder, true); + assert.equal(body(config, { duration: "auto" }).auto_duration, true); + assert.equal(body(config, { duration: "auto" }).num_frames, undefined); + assert.equal(body(config).num_frames, 121); + assert.equal(body(config, { pipeline: "two-stage", weights: "dev" }).size, "1920x1088"); + assert.equal(body(config, { weights: "dev" }).guidance_scale, 3); + const previous = get("/LTX/LTX2 & LTX2.3.mdx"); + assert.equal( + previous.commandBuilder.resource.verifiedRecipes.find((recipe) => recipe.hw === "cuda").device, + "original", + ); + assert.ok( + resolve(previous, { gpus_per_node: 4, lora: "transition" }).flags.includes( + "--lora-weight-name ltx2.3-transition.safetensors", + ), + ); +}); + +test("structured prompts and realtime protocols remain model-specific", () => { + const ideogram = get("/Ideogram/Ideogram4.mdx"); + const fal = body(ideogram, { checkpoint: "instant" }); + assert.ok(JSON.parse(fal.prompt).compositional_deconstruction.elements.length); + assert.equal(fal.preset, undefined); + assert.equal(body(ideogram).preset, "V4_QUALITY_48"); + const lingbot = JSON.parse(body(get("/LingBot-Video/LingBot-Video-MoE.mdx")).prompt); + assert.ok(lingbot.prominent_elements[0].actions.length); + for (const suffix of ["/LingBot-World/LingBot-World.mdx", "/LingBot-World/LingBot-World-2.0.mdx"]) + assert.match(curl(get(suffix)), /\/v1\/models$/); + const sana = get("/SANA-WM/SANA-WM.mdx"); + assert.match(curl(sana, { checkpoint: "streaming", mode: "realtime" }), /\/v1\/models$/); + assert.equal(body(sana).diffusers_kwargs.action, "w-80,wl-80,l-80,wj-80"); + assert.ok(resolve(sana, { checkpoint: "dense", mode: "realtime" }).builder.errors.length); +}); diff --git a/docs/src/snippets/_deployment.jsx b/docs/src/snippets/_deployment.jsx index efa03268bf..f64d71915a 100644 --- a/docs/src/snippets/_deployment.jsx +++ b/docs/src/snippets/_deployment.jsx @@ -2371,6 +2371,13 @@ export const Deployment = ({ config, benchmarks, agenticLink }) => { + {builderScope === "serve" && ( +

+ Tip: For more server options, see the{" "} + CLI reference. +

+ )} + {modal === "env" && (
setModal(null)}>
event.stopPropagation()}> diff --git a/docs/src/snippets/configs/BlackForestLabs/flux.jsx b/docs/src/snippets/configs/BlackForestLabs/flux.jsx new file mode 100644 index 0000000000..d553a9a00a --- /dev/null +++ b/docs/src/snippets/configs/BlackForestLabs/flux.jsx @@ -0,0 +1,159 @@ +export const config = (() => { + const modelOf = (s) => + "black-forest-labs/" + (s.version === "flux2-dev" || s.hw === "arc_b" ? "FLUX.2-dev" : "FLUX.1-dev"); + const plan = (s) => { + const flags = ["--model-path " + modelOf(s)]; + let gpus = 1; + let tp = 1; + if (s.hw === "a3" || (s.hw === "a2" && s.version === "flux2-dev")) { + gpus = 2; + tp = 2; + flags.push("--tp-size 2", "--num-gpus 2"); + } else if (s.hw === "a2") flags.push("--num-gpus 1"); + else if (s.hw === "arc_b") { + gpus = 4; + tp = 4; + flags.push( + "--num-gpus 4", + "--tp-size 4", + "--component-residency dit=resident,text_encoder=layerwise-offload", + "--dit-cpu-offload False", + ); + } else flags.push("--ulysses-degree=1", "--ring-degree=1"); + return { flags, gpus, topology: { tp_size: tp, ulysses_degree: 1, ring_degree: 1 } }; + }; + const defaults = { + hw: "b200", + nodes: 1, + gpus_per_node: 1, + topology_mode: "auto", + tp_size: 1, + ulysses_degree: 1, + ring_degree: 1, + version: "flux1-dev", + }; + const config = { + modelName: "FLUX", + supportedHardware: ["b200", "b300", "h200", "h100", "mi300x", "mi325x", "mi355x", "a2", "a3", "arc_b"], + hardware: [ + { id: "a2", label: "Ascend A2", vram: "", vendor: "npu" }, + { id: "a3", label: "Ascend A3", vram: "2 NPUs / card", vendor: "npu" }, + { id: "arc_b", label: "Intel BMG", vram: "", vendor: "intel" }, + ], + groupHardware: false, + matchDims: [], + overlayDims: [ + { + id: "version", + title: "Checkpoint", + scope: "base", + default: "flux1-dev", + options: [ + { id: "flux1-dev", label: "FLUX.1-dev", showWhen: (s) => s.hw !== "arc_b" }, + { id: "flux2-dev", label: "FLUX.2-dev" }, + ], + }, + ], + commandBuilder: { + defaultSelection: defaults, + resource: { + limits: { nodes: { min: 1, max: 1 }, gpus_per_node: { min: 1, max: 8 } }, + verifiedRecipes: ["b200", "b300", "h200", "h100", "mi300x", "mi325x", "mi355x", "a2", "a3", "arc_b"].map( + (hw) => { + const s = { ...defaults, hw }; + const p = plan(s); + return { + ...s, + id: hw + "-documented", + gpus_per_node: p.gpus, + ...p.topology, + default: true, + unverified: true, + }; + }, + ), + autoTopology: (s) => plan(s).topology, + validateTopology: (s, t) => { + const p = plan(s); + const errors = [...(p.errors || [])]; + if (!config.supportedHardware.includes(s.hw)) errors.push("Choose a listed hardware platform."); + if (Number(s.nodes) !== 1) errors.push("This recipe covers one node."); + const count = Number(s.gpus_per_node); + if (!Number.isInteger(count) || count < 1 || count > 8) + errors.push("Choose an integer GPU count within the documented limits."); + if (Number(s.gpus_per_node) !== p.gpus) errors.push("This recipe requires " + p.gpus + " GPUs / node."); + if (["tp_size", "ulysses_degree", "ring_degree"].some((key) => Number(t[key]) !== p.topology[key])) + errors.push("This topology is not a documented recipe for the selected model and hardware."); + return errors; + }, + }, + resolveDeployment: (s) => { + const p = plan(s); + const topology = + s.topology_mode === "manual" + ? { + tp_size: Number(s.tp_size), + ulysses_degree: Number(s.ulysses_degree), + ring_degree: Number(s.ring_degree), + } + : p.topology; + const errors = config.commandBuilder.resource.validateTopology(s, topology); + const status = errors.length ? "error" : "unverified"; + const flags = [...p.flags]; + if (!flags.some((flag) => flag.startsWith("--port "))) flags.push("--port {{PORT}}"); + const automaticSP = + flags.find((flag) => flag.startsWith("--sp-degree ")) && + !flags.some((flag) => flag.startsWith("--ulysses-degree")); + const summary = automaticSP + ? ["TP " + topology.tp_size, "SP " + topology.ulysses_degree + " (runtime-selected exchange)"] + : ["TP " + topology.tp_size, "Ulysses " + topology.ulysses_degree, "Ring " + topology.ring_degree]; + if (flags.includes("--enable-cfg-parallel")) summary.push("CFG 2"); + return { + match: { hw: s.hw }, + nnodes: 1, + verified: false, + flags, + env: p.env || [], + builder: { + topology, + topologySummary: p.summary || summary.join(" / "), + errors, + warnings: [ + ...(p.warnings || []), + "Documented recipe; this exact server and request combination has not been HTTP-verified.", + ], + verification: { serve: status, request: status }, + }, + }; + }, + }, + modelNames: { default: modelOf(defaults) }, + placeholders: { + PORT: { target: "command", label: "Server port", default: "30000" }, + CURL_HOST: { target: "curl", label: "Server host", default: "127.0.0.1" }, + CURL_PORT: { target: "curl", label: "Request port", default: "30000" }, + }, + curl: (s) => + [ + "curl -sS http://{{CURL_HOST}}:{{CURL_PORT}}/v1/images/generations", + "-H 'Content-Type: application/json'", + "-d '" + + JSON.stringify( + { + model: modelOf(s), + prompt: "A quiet lakeside cabin at sunrise", + n: 1, + response_format: "b64_json", + ...{}, + }, + null, + 2, + ) + + "'", + ].join(" \\\n "), + runModes: ["python"], + showPlaygroundLink: false, + github: { cookbookModel: modelOf(defaults) }, + }; + return config; +})(); diff --git a/docs/src/snippets/configs/Ideogram/ideogram4.jsx b/docs/src/snippets/configs/Ideogram/ideogram4.jsx new file mode 100644 index 0000000000..3d9aed7653 --- /dev/null +++ b/docs/src/snippets/configs/Ideogram/ideogram4.jsx @@ -0,0 +1,177 @@ +export const config = (() => { + const modelOf = (s) => + ({ + nf4: "ideogram-ai/ideogram-4-nf4", + fp8: "ideogram-ai/ideogram-4-fp8", + nvfp4: "Comfy-Org/Ideogram-4", + fast: "fal/ideogram-v4-fast", + instant: "fal/ideogram-v4-instant", + })[s.checkpoint || "nf4"]; + const plan = (s) => { + const flags = ["--model-path " + modelOf(s), ...["--num-gpus 1", "--performance-mode auto", "--port {{PORT}}"]]; + let gpus = 1; + let t = { tp_size: 1, ulysses_degree: 1, ring_degree: 1 }; + const env = []; + const warnings = []; + const errors = []; + env.push("HF_TOKEN=$HF_TOKEN"); + if (s.checkpoint === "nvfp4" && s.hw !== "b200") + errors.push("The documented NVFP4 recipe requires Blackwell; select B200."); + if (s.checkpoint === "fast") + warnings.push( + "Floating-point Fast inference bypasses its intended NVFP4 path and may degrade quality; use Instant for local inference.", + ); + return { flags, gpus, topology: t, env, warnings, errors }; + }; + const defaults = { + hw: "cuda", + nodes: 1, + gpus_per_node: 1, + topology_mode: "auto", + tp_size: 1, + ulysses_degree: 1, + ring_degree: 1, + checkpoint: "nf4", + }; + const config = { + modelName: "Ideogram 4", + supportedHardware: ["cuda", "b200"], + hardware: [{ id: "cuda", label: "NVIDIA CUDA", vram: "", vendor: "nvidia" }], + groupHardware: false, + matchDims: [], + overlayDims: [ + { + id: "checkpoint", + title: "Checkpoint", + scope: "base", + default: "nf4", + options: [ + { id: "nf4", label: "ideogram-4-nf4" }, + { id: "fp8", label: "ideogram-4-fp8" }, + { id: "nvfp4", label: "Ideogram-4" }, + { id: "fast", label: "ideogram-v4-fast" }, + { id: "instant", label: "ideogram-v4-instant" }, + ], + }, + ], + commandBuilder: { + defaultSelection: defaults, + resource: { + limits: { nodes: { min: 1, max: 1 }, gpus_per_node: { min: 1, max: 1 } }, + verifiedRecipes: ["cuda", "b200"].map((hw) => { + const s = { ...defaults, hw }; + const p = plan(s); + return { + ...s, + id: hw + "-documented", + gpus_per_node: p.gpus, + ...p.topology, + default: true, + unverified: true, + }; + }), + autoTopology: (s) => plan(s).topology, + validateTopology: (s, t) => { + const p = plan(s); + const errors = [...(p.errors || [])]; + if (!config.supportedHardware.includes(s.hw)) errors.push("Choose a listed hardware platform."); + if (Number(s.nodes) !== 1) errors.push("This recipe covers one node."); + const count = Number(s.gpus_per_node); + if (!Number.isInteger(count) || count < 1 || count > 1) + errors.push("Choose an integer GPU count within the documented limits."); + if (Number(s.gpus_per_node) !== p.gpus) errors.push("This recipe requires " + p.gpus + " GPUs / node."); + if (["tp_size", "ulysses_degree", "ring_degree"].some((key) => Number(t[key]) !== p.topology[key])) + errors.push("This topology is not a documented recipe for the selected model and hardware."); + return errors; + }, + }, + resolveDeployment: (s) => { + const p = plan(s); + const topology = + s.topology_mode === "manual" + ? { + tp_size: Number(s.tp_size), + ulysses_degree: Number(s.ulysses_degree), + ring_degree: Number(s.ring_degree), + } + : p.topology; + const errors = config.commandBuilder.resource.validateTopology(s, topology); + const status = errors.length ? "error" : "unverified"; + const flags = [...p.flags]; + if (!flags.some((flag) => flag.startsWith("--port "))) flags.push("--port {{PORT}}"); + const automaticSP = + flags.find((flag) => flag.startsWith("--sp-degree ")) && + !flags.some((flag) => flag.startsWith("--ulysses-degree")); + const summary = automaticSP + ? ["TP " + topology.tp_size, "SP " + topology.ulysses_degree + " (runtime-selected exchange)"] + : ["TP " + topology.tp_size, "Ulysses " + topology.ulysses_degree, "Ring " + topology.ring_degree]; + if (flags.includes("--enable-cfg-parallel")) summary.push("CFG 2"); + return { + match: { hw: s.hw }, + nnodes: 1, + verified: false, + flags, + env: p.env || [], + builder: { + topology, + topologySummary: p.summary || summary.join(" / "), + errors, + warnings: [ + ...(p.warnings || []), + "Documented recipe; this exact server and request combination has not been HTTP-verified.", + ], + verification: { serve: status, request: status }, + }, + }; + }, + }, + modelNames: { default: modelOf(defaults) }, + placeholders: { + PORT: { target: "command", label: "Server port", default: "30010" }, + CURL_HOST: { target: "curl", label: "Server host", default: "127.0.0.1" }, + CURL_PORT: { target: "curl", label: "Request port", default: "30010" }, + }, + curl: (s) => + [ + "curl -sS http://{{CURL_HOST}}:{{CURL_PORT}}/v1/images/generations", + "-H 'Content-Type: application/json'", + "-d '" + + JSON.stringify( + { + model: modelOf(s), + prompt: "A quiet lakeside cabin at sunrise", + n: 1, + response_format: "b64_json", + ...{ + prompt: ["fast", "instant"].includes(s.checkpoint) + ? JSON.stringify({ + high_level_description: + "A bold typographic poster centered on the exact words INSTANT BY FAL, printed in black and electric orange on warm white paper.", + compositional_deconstruction: { + background: "Warm white textured paper with generous negative space.", + elements: [ + { + type: "text", + text: "INSTANT BY FAL", + desc: "Large uppercase geometric sans-serif lettering, precisely centered.", + }, + ], + }, + }) + : "A cinematic poster of a quiet bookstore at dusk with elegant hand-lettered signage", + size: "1024x1024", + seed: 0, + ...(!["fast", "instant"].includes(s.checkpoint) ? { preset: "V4_QUALITY_48" } : {}), + }, + }, + null, + 2, + ) + + "'", + ].join(" \\\n "), + runModes: ["python"], + showPlaygroundLink: false, + github: { cookbookModel: modelOf(defaults) }, + }; + return config; +})(); diff --git a/docs/src/snippets/configs/JoyAI/joyecho.jsx b/docs/src/snippets/configs/JoyAI/joyecho.jsx new file mode 100644 index 0000000000..255cafca21 --- /dev/null +++ b/docs/src/snippets/configs/JoyAI/joyecho.jsx @@ -0,0 +1,143 @@ +export const config = (() => { + const modelOf = (s) => + ({ + default: "jdopensource/JoyAI-Echo", + })[s.checkpoint || "default"]; + const plan = (s) => { + const flags = ["--model-path " + modelOf(s), ...[]]; + let gpus = 1; + let t = { tp_size: 1, ulysses_degree: 1, ring_degree: 1 }; + const env = []; + const warnings = []; + const errors = []; + flags[0] = '--model-path "$JOY_ECHO_MODEL_PATH"'; + flags.push("--model-id jdopensource/JoyAI-Echo"); + gpus = Number(s.gpus_per_node); + if (gpus === 2) { + t.ulysses_degree = 2; + flags.push("--num-gpus 2", "--ulysses-degree 2"); + } + return { flags, gpus, topology: t, env, warnings, errors }; + }; + const defaults = { + hw: "h200", + nodes: 1, + gpus_per_node: 1, + topology_mode: "auto", + tp_size: 1, + ulysses_degree: 1, + ring_degree: 1, + }; + const config = { + modelName: "JoyAI-Echo", + supportedHardware: ["h200", "h100"], + hardware: [], + groupHardware: false, + matchDims: [], + overlayDims: [], + commandBuilder: { + defaultSelection: defaults, + resource: { + limits: { nodes: { min: 1, max: 1 }, gpus_per_node: { min: 1, max: 2 } }, + verifiedRecipes: ["h200", "h100"].map((hw) => { + const s = { ...defaults, hw }; + const p = plan(s); + return { + ...s, + id: hw + "-documented", + gpus_per_node: p.gpus, + ...p.topology, + default: true, + unverified: true, + }; + }), + autoTopology: (s) => plan(s).topology, + validateTopology: (s, t) => { + const p = plan(s); + const errors = [...(p.errors || [])]; + if (!config.supportedHardware.includes(s.hw)) errors.push("Choose a listed hardware platform."); + if (Number(s.nodes) !== 1) errors.push("This recipe covers one node."); + const count = Number(s.gpus_per_node); + if (!Number.isInteger(count) || count < 1 || count > 2) + errors.push("Choose an integer GPU count within the documented limits."); + if (Number(s.gpus_per_node) !== p.gpus) errors.push("This recipe requires " + p.gpus + " GPUs / node."); + if (["tp_size", "ulysses_degree", "ring_degree"].some((key) => Number(t[key]) !== p.topology[key])) + errors.push("This topology is not a documented recipe for the selected model and hardware."); + return errors; + }, + }, + resolveDeployment: (s) => { + const p = plan(s); + const topology = + s.topology_mode === "manual" + ? { + tp_size: Number(s.tp_size), + ulysses_degree: Number(s.ulysses_degree), + ring_degree: Number(s.ring_degree), + } + : p.topology; + const errors = config.commandBuilder.resource.validateTopology(s, topology); + const status = errors.length ? "error" : "unverified"; + const flags = [...p.flags]; + if (!flags.some((flag) => flag.startsWith("--port "))) flags.push("--port {{PORT}}"); + const automaticSP = + flags.find((flag) => flag.startsWith("--sp-degree ")) && + !flags.some((flag) => flag.startsWith("--ulysses-degree")); + const summary = automaticSP + ? ["TP " + topology.tp_size, "SP " + topology.ulysses_degree + " (runtime-selected exchange)"] + : ["TP " + topology.tp_size, "Ulysses " + topology.ulysses_degree, "Ring " + topology.ring_degree]; + if (flags.includes("--enable-cfg-parallel")) summary.push("CFG 2"); + return { + match: { hw: s.hw }, + nnodes: 1, + verified: false, + flags, + env: p.env || [], + builder: { + topology, + topologySummary: p.summary || summary.join(" / "), + errors, + warnings: [ + ...(p.warnings || []), + "Documented recipe; this exact server and request combination has not been HTTP-verified.", + ], + verification: { serve: status, request: status }, + }, + }; + }, + }, + modelNames: { default: modelOf(defaults) }, + placeholders: { + PORT: { target: "command", label: "Server port", default: "30000" }, + CURL_HOST: { target: "curl", label: "Server host", default: "127.0.0.1" }, + CURL_PORT: { target: "curl", label: "Request port", default: "30000" }, + }, + curl: (s) => + [ + "curl -sS http://{{CURL_HOST}}:{{CURL_PORT}}/v1/videos", + "-H 'Content-Type: application/json'", + "-d '" + + JSON.stringify( + { + model: modelOf(s), + prompt: "A quiet street at dusk", + ...{ + size: "832x480", + num_frames: 121, + fps: 25, + num_inference_steps: 8, + guidance_scale: 1.0, + seed: 12345, + }, + }, + null, + 2, + ) + + "'", + ].join(" \\\n "), + runModes: ["python"], + showPlaygroundLink: false, + github: { cookbookModel: modelOf(defaults) }, + }; + return config; +})(); diff --git a/docs/src/snippets/configs/Krea/krea2.jsx b/docs/src/snippets/configs/Krea/krea2.jsx new file mode 100644 index 0000000000..e170e312a8 --- /dev/null +++ b/docs/src/snippets/configs/Krea/krea2.jsx @@ -0,0 +1,166 @@ +export const config = (() => { + const modelOf = (s) => + ({ + turbo: "krea/Krea-2-Turbo", + raw: "krea/Krea-2-Raw", + })[s.checkpoint || "turbo"]; + const plan = (s) => { + const flags = ["--model-path " + modelOf(s), ...["--port {{PORT}}"]]; + let gpus = 1; + let t = { tp_size: 1, ulysses_degree: 1, ring_degree: 1 }; + const env = []; + const warnings = []; + const errors = []; + gpus = Number(s.gpus_per_node); + flags.splice(1, 0, "--num-gpus " + gpus); + if (gpus === 2) { + t = { tp_size: s.parallel === "tp" ? 2 : 1, ulysses_degree: s.parallel === "sp" ? 2 : 1, ring_degree: 1 }; + flags.push(s.parallel === "tp" ? "--tp-size 2" : "--ulysses-degree 2"); + } + if (gpus === 4) { + t = { tp_size: 2, ulysses_degree: 2, ring_degree: 1 }; + flags.push("--tp-size 2", "--ulysses-degree 2"); + } + if (![1, 2, 4].includes(gpus)) errors.push("Choose 1, 2 or 4 GPUs."); + return { flags, gpus, topology: t, env, warnings, errors }; + }; + const defaults = { + hw: "h200", + nodes: 1, + gpus_per_node: 1, + topology_mode: "auto", + tp_size: 1, + ulysses_degree: 1, + ring_degree: 1, + checkpoint: "turbo", + parallel: "sp", + }; + const config = { + modelName: "Krea-2", + supportedHardware: ["h200", "cuda"], + hardware: [{ id: "cuda", label: "NVIDIA CUDA", vram: "", vendor: "nvidia" }], + groupHardware: false, + matchDims: [], + overlayDims: [ + { + id: "checkpoint", + title: "Checkpoint", + scope: "base", + default: "turbo", + options: [ + { id: "turbo", label: "Krea-2-Turbo" }, + { id: "raw", label: "Krea-2-Raw" }, + ], + }, + { + id: "parallel", + title: "Parallelism", + scope: "serve", + default: "sp", + options: [ + { id: "sp", label: "Ulysses" }, + { id: "tp", label: "Tensor parallel" }, + ], + }, + ], + commandBuilder: { + defaultSelection: defaults, + resource: { + limits: { nodes: { min: 1, max: 1 }, gpus_per_node: { min: 1, max: 4 } }, + verifiedRecipes: ["h200", "cuda"].map((hw) => { + const s = { ...defaults, hw }; + const p = plan(s); + return { + ...s, + id: hw + "-documented", + gpus_per_node: p.gpus, + ...p.topology, + default: true, + unverified: true, + }; + }), + autoTopology: (s) => plan(s).topology, + validateTopology: (s, t) => { + const p = plan(s); + const errors = [...(p.errors || [])]; + if (!config.supportedHardware.includes(s.hw)) errors.push("Choose a listed hardware platform."); + if (Number(s.nodes) !== 1) errors.push("This recipe covers one node."); + const count = Number(s.gpus_per_node); + if (!Number.isInteger(count) || count < 1 || count > 4) + errors.push("Choose an integer GPU count within the documented limits."); + if (Number(s.gpus_per_node) !== p.gpus) errors.push("This recipe requires " + p.gpus + " GPUs / node."); + if (["tp_size", "ulysses_degree", "ring_degree"].some((key) => Number(t[key]) !== p.topology[key])) + errors.push("This topology is not a documented recipe for the selected model and hardware."); + return errors; + }, + }, + resolveDeployment: (s) => { + const p = plan(s); + const topology = + s.topology_mode === "manual" + ? { + tp_size: Number(s.tp_size), + ulysses_degree: Number(s.ulysses_degree), + ring_degree: Number(s.ring_degree), + } + : p.topology; + const errors = config.commandBuilder.resource.validateTopology(s, topology); + const status = errors.length ? "error" : "unverified"; + const flags = [...p.flags]; + if (!flags.some((flag) => flag.startsWith("--port "))) flags.push("--port {{PORT}}"); + const automaticSP = + flags.find((flag) => flag.startsWith("--sp-degree ")) && + !flags.some((flag) => flag.startsWith("--ulysses-degree")); + const summary = automaticSP + ? ["TP " + topology.tp_size, "SP " + topology.ulysses_degree + " (runtime-selected exchange)"] + : ["TP " + topology.tp_size, "Ulysses " + topology.ulysses_degree, "Ring " + topology.ring_degree]; + if (flags.includes("--enable-cfg-parallel")) summary.push("CFG 2"); + return { + match: { hw: s.hw }, + nnodes: 1, + verified: false, + flags, + env: p.env || [], + builder: { + topology, + topologySummary: p.summary || summary.join(" / "), + errors, + warnings: [ + ...(p.warnings || []), + "Documented recipe; this exact server and request combination has not been HTTP-verified.", + ], + verification: { serve: status, request: status }, + }, + }; + }, + }, + modelNames: { default: modelOf(defaults) }, + placeholders: { + PORT: { target: "command", label: "Server port", default: "30000" }, + CURL_HOST: { target: "curl", label: "Server host", default: "127.0.0.1" }, + CURL_PORT: { target: "curl", label: "Request port", default: "30000" }, + }, + curl: (s) => + [ + "curl -sS http://{{CURL_HOST}}:{{CURL_PORT}}/v1/images/generations", + "-H 'Content-Type: application/json'", + "-d '" + + JSON.stringify( + { + model: modelOf(s), + prompt: "A quiet lakeside cabin at sunrise", + n: 1, + response_format: "b64_json", + ...{ size: "1024x1024" }, + }, + null, + 2, + ) + + "'", + ].join(" \\\n "), + runModes: ["python"], + showPlaygroundLink: false, + github: { cookbookModel: modelOf(defaults) }, + }; + return config; +})(); diff --git a/docs/src/snippets/configs/Lightricks/ltx2.jsx b/docs/src/snippets/configs/Lightricks/ltx2.jsx new file mode 100644 index 0000000000..659b883e1d --- /dev/null +++ b/docs/src/snippets/configs/Lightricks/ltx2.jsx @@ -0,0 +1,183 @@ +export const config = (() => { + const modelOf = (s) => "Lightricks/" + (s.model === "ltx2" ? "LTX-2" : "LTX-2.3"); + const plan = (s) => { + const gpus = Number(s.gpus_per_node); + const tp = gpus === 4 ? 2 : 1; + const flags = [ + "--model-path " + modelOf(s), + "--pipeline-class-name " + + { "one-stage": "LTX2Pipeline", "two-stage": "LTX2TwoStagePipeline", "two-stage-hq": "LTX2TwoStageHQPipeline" }[ + s.pipeline + ], + ]; + if (gpus === 2) flags.push("--num-gpus 2", "--enable-cfg-parallel"); + if (gpus === 4) flags.push("--num-gpus 4", "--tp-size 2", "--enable-cfg-parallel"); + if (s.model === "ltx23" && s.pipeline !== "one-stage") flags.push("--ltx2-two-stage-device-mode " + s.device); + if (s.lora === "transition" && s.model === "ltx23" && s.pipeline !== "one-stage") + flags.push("--lora-path valiantcat/LTX-2.3-Transition-LORA", "--lora-weight-name ltx2.3-transition.safetensors"); + flags.push("--port {{PORT}}"); + return { + flags, + gpus, + topology: { tp_size: tp, ulysses_degree: 1, ring_degree: 1 }, + errors: [ + ...(![1, 2, 4].includes(gpus) ? ["Choose 1, 2 or 4 GPUs."] : []), + ...(s.model === "ltx2" && s.pipeline === "two-stage-hq" ? ["HQ requires LTX-2.3."] : []), + ], + }; + }; + const defaults = { + hw: "h200", + nodes: 1, + gpus_per_node: 1, + topology_mode: "auto", + tp_size: 1, + ulysses_degree: 1, + ring_degree: 1, + model: "ltx23", + pipeline: "two-stage", + device: "resident", + lora: "none", + }; + const config = { + modelName: "LTX-2 / LTX-2.3", + supportedHardware: ["h200", "cuda"], + hardware: [{ id: "cuda", label: "NVIDIA CUDA", vram: "", vendor: "nvidia" }], + groupHardware: false, + matchDims: [], + overlayDims: [ + { + id: "model", + title: "Checkpoint", + scope: "base", + default: "ltx23", + options: [ + { id: "ltx23", label: "LTX-2.3" }, + { id: "ltx2", label: "LTX-2" }, + ], + }, + { + id: "pipeline", + title: "Pipeline", + scope: "serve", + default: "two-stage", + options: [ + { id: "two-stage", label: "Two stage" }, + { id: "two-stage-hq", label: "Two stage HQ", showWhen: (s) => s.model === "ltx23" }, + { id: "one-stage", label: "One stage" }, + ], + }, + { + id: "device", + title: "Device mode", + scope: "serve", + default: "resident", + options: [ + { id: "resident", label: "Resident" }, + { id: "original", label: "Original" }, + ], + }, + { + id: "lora", + title: "LoRA", + scope: "serve", + default: "none", + options: [ + { id: "none", label: "None" }, + { + id: "transition", + label: "Transition LoRA", + showWhen: (s) => s.model === "ltx23" && s.pipeline !== "one-stage", + }, + ], + }, + ], + commandBuilder: { + defaultSelection: defaults, + resource: { + limits: { nodes: { min: 1, max: 1 }, gpus_per_node: { min: 1, max: 4 } }, + verifiedRecipes: ["h200", "cuda"].map((hw) => { + const s = { ...defaults, hw, device: hw === "cuda" ? "original" : "resident" }; + const p = plan(s); + return { + ...s, + id: hw + "-documented", + gpus_per_node: p.gpus, + ...p.topology, + default: true, + unverified: true, + }; + }), + autoTopology: (s) => plan(s).topology, + validateTopology: (s, t) => { + const p = plan(s); + const errors = [...(p.errors || [])]; + if (!config.supportedHardware.includes(s.hw)) errors.push("Choose a listed hardware platform."); + if (Number(s.nodes) !== 1) errors.push("This recipe covers one node."); + const count = Number(s.gpus_per_node); + if (!Number.isInteger(count) || count < 1 || count > 4) + errors.push("Choose an integer GPU count within the documented limits."); + if (Number(s.gpus_per_node) !== p.gpus) errors.push("This recipe requires " + p.gpus + " GPUs / node."); + if (["tp_size", "ulysses_degree", "ring_degree"].some((key) => Number(t[key]) !== p.topology[key])) + errors.push("This topology is not a documented recipe for the selected model and hardware."); + return errors; + }, + }, + resolveDeployment: (s) => { + const p = plan(s); + const topology = + s.topology_mode === "manual" + ? { + tp_size: Number(s.tp_size), + ulysses_degree: Number(s.ulysses_degree), + ring_degree: Number(s.ring_degree), + } + : p.topology; + const errors = config.commandBuilder.resource.validateTopology(s, topology); + const status = errors.length ? "error" : "unverified"; + const flags = [...p.flags]; + if (!flags.some((flag) => flag.startsWith("--port "))) flags.push("--port {{PORT}}"); + const automaticSP = + flags.find((flag) => flag.startsWith("--sp-degree ")) && + !flags.some((flag) => flag.startsWith("--ulysses-degree")); + const summary = automaticSP + ? ["TP " + topology.tp_size, "SP " + topology.ulysses_degree + " (runtime-selected exchange)"] + : ["TP " + topology.tp_size, "Ulysses " + topology.ulysses_degree, "Ring " + topology.ring_degree]; + if (flags.includes("--enable-cfg-parallel")) summary.push("CFG 2"); + return { + match: { hw: s.hw }, + nnodes: 1, + verified: false, + flags, + env: p.env || [], + builder: { + topology, + topologySummary: p.summary || summary.join(" / "), + errors, + warnings: [ + ...(p.warnings || []), + "Documented recipe; this exact server and request combination has not been HTTP-verified.", + ], + verification: { serve: status, request: status }, + }, + }; + }, + }, + modelNames: { default: modelOf(defaults) }, + placeholders: { + PORT: { target: "command", label: "Server port", default: "30000" }, + CURL_HOST: { target: "curl", label: "Server host", default: "127.0.0.1" }, + CURL_PORT: { target: "curl", label: "Request port", default: "30000" }, + }, + curl: (s) => + [ + "curl -sS http://{{CURL_HOST}}:{{CURL_PORT}}/v1/videos", + "-H 'Content-Type: application/json'", + "-d '" + JSON.stringify({ model: modelOf(s), prompt: "A quiet street at dusk", ...{} }, null, 2) + "'", + ].join(" \\\n "), + runModes: ["python"], + showPlaygroundLink: false, + github: { cookbookModel: modelOf(defaults) }, + }; + return config; +})(); diff --git a/docs/src/snippets/configs/Lightricks/ltx25.jsx b/docs/src/snippets/configs/Lightricks/ltx25.jsx new file mode 100644 index 0000000000..4338e1259f --- /dev/null +++ b/docs/src/snippets/configs/Lightricks/ltx25.jsx @@ -0,0 +1,249 @@ +export const config = (() => { + const modelOf = () => "Lightricks/LTX-2.5-Diffusers"; + const plan = (s) => { + const gpus = Number(s.gpus_per_node); + const flags = [ + "--model-path " + modelOf(s), + "--pipeline-class-name " + (s.pipeline === "two-stage" ? "LTX2TwoStagePipeline" : "LTX2Pipeline"), + ]; + if (s.weights === "dev") flags.push("--model-variant dev"); + if (s.precision === "fp8") flags.push("--quantization fp8"); + if (s.placement === "offload") flags.push("--dit-layerwise-offload"); + if (s.decoder_weights === "loaded") flags.push("--load-diffusion-decoder"); + if (gpus === 2) + flags.push( + "--num-gpus 2", + s.parallel === "tp" ? "--tp-size 2" : s.parallel === "cfg" ? "--enable-cfg-parallel" : "--ulysses-degree 2", + ); + flags.push("--port {{PORT}}"); + return { + flags, + gpus, + topology: { + tp_size: gpus === 2 && s.parallel === "tp" ? 2 : 1, + ulysses_degree: gpus === 2 && s.parallel === "sp" ? 2 : 1, + ring_degree: 1, + }, + warnings: [ + ...(s.parallel === "cfg" && gpus === 2 && s.weights !== "dev" + ? ["Distilled weights run unguided; CFG parallelism does not accelerate them."] + : []), + ...(s.precision === "fp8" ? ["FP8 is approximate; evaluate output quality against BF16."] : []), + ], + errors: + s.decoder === "diffusion" && s.decoder_weights !== "loaded" + ? ["Load diffusion decoder weights in Server before requesting diffusion decode."] + : [], + }; + }; + const defaults = { + hw: "h200", + nodes: 1, + gpus_per_node: 1, + topology_mode: "auto", + tp_size: 1, + ulysses_degree: 1, + ring_degree: 1, + weights: "distilled", + pipeline: "one-stage", + precision: "bf16", + placement: "auto", + parallel: "sp", + decoder_weights: "off", + decoder: "vae", + duration: "fixed", + }; + const config = { + modelName: "LTX-2.5", + supportedHardware: ["h200", "cuda"], + hardware: [{ id: "cuda", label: "NVIDIA CUDA", vram: "", vendor: "nvidia" }], + groupHardware: false, + matchDims: [], + overlayDims: [ + { + id: "weights", + title: "Weights", + scope: "base", + default: "distilled", + options: [ + { id: "distilled", label: "Distilled" }, + { id: "dev", label: "Dev / SFT" }, + ], + }, + { + id: "pipeline", + title: "Pipeline", + scope: "serve", + default: "one-stage", + options: [ + { id: "one-stage", label: "One stage" }, + { id: "two-stage", label: "Two stage" }, + ], + }, + { + id: "precision", + title: "Precision", + scope: "serve", + default: "bf16", + options: [ + { id: "bf16", label: "BF16" }, + { id: "fp8", label: "FP8" }, + ], + }, + { + id: "placement", + title: "Memory policy", + scope: "serve", + default: "auto", + options: [ + { id: "auto", label: "Auto" }, + { id: "offload", label: "DiT layerwise offload" }, + ], + }, + { + id: "parallel", + title: "Parallelism", + scope: "serve", + default: "sp", + options: [ + { id: "sp", label: "Ulysses" }, + { id: "tp", label: "Tensor parallel" }, + { id: "cfg", label: "CFG parallel" }, + ], + }, + { + id: "decoder_weights", + title: "Diffusion decoder weights", + scope: "serve", + default: "off", + options: [ + { id: "off", label: "Not loaded" }, + { id: "loaded", label: "Loaded" }, + ], + }, + { + id: "decoder", + title: "Decoder", + scope: "request", + default: "vae", + options: [ + { id: "vae", label: "VAE" }, + { id: "diffusion", label: "Diffusion", showWhen: (s) => s.decoder_weights === "loaded" }, + ], + }, + { + id: "duration", + title: "Duration", + scope: "request", + default: "fixed", + options: [ + { id: "fixed", label: "Fixed" }, + { id: "auto", label: "Auto" }, + ], + }, + ], + commandBuilder: { + defaultSelection: defaults, + resource: { + limits: { nodes: { min: 1, max: 1 }, gpus_per_node: { min: 1, max: 2 } }, + verifiedRecipes: ["h200", "cuda"].map((hw) => { + const s = { ...defaults, hw }; + const p = plan(s); + return { + ...s, + id: hw + "-documented", + gpus_per_node: p.gpus, + ...p.topology, + default: true, + unverified: true, + }; + }), + autoTopology: (s) => plan(s).topology, + validateTopology: (s, t) => { + const p = plan(s); + const errors = [...(p.errors || [])]; + if (!config.supportedHardware.includes(s.hw)) errors.push("Choose a listed hardware platform."); + if (Number(s.nodes) !== 1) errors.push("This recipe covers one node."); + const count = Number(s.gpus_per_node); + if (!Number.isInteger(count) || count < 1 || count > 2) + errors.push("Choose an integer GPU count within the documented limits."); + if (Number(s.gpus_per_node) !== p.gpus) errors.push("This recipe requires " + p.gpus + " GPUs / node."); + if (["tp_size", "ulysses_degree", "ring_degree"].some((key) => Number(t[key]) !== p.topology[key])) + errors.push("This topology is not a documented recipe for the selected model and hardware."); + return errors; + }, + }, + resolveDeployment: (s) => { + const p = plan(s); + const topology = + s.topology_mode === "manual" + ? { + tp_size: Number(s.tp_size), + ulysses_degree: Number(s.ulysses_degree), + ring_degree: Number(s.ring_degree), + } + : p.topology; + const errors = config.commandBuilder.resource.validateTopology(s, topology); + const status = errors.length ? "error" : "unverified"; + const flags = [...p.flags]; + if (!flags.some((flag) => flag.startsWith("--port "))) flags.push("--port {{PORT}}"); + const automaticSP = + flags.find((flag) => flag.startsWith("--sp-degree ")) && + !flags.some((flag) => flag.startsWith("--ulysses-degree")); + const summary = automaticSP + ? ["TP " + topology.tp_size, "SP " + topology.ulysses_degree + " (runtime-selected exchange)"] + : ["TP " + topology.tp_size, "Ulysses " + topology.ulysses_degree, "Ring " + topology.ring_degree]; + if (flags.includes("--enable-cfg-parallel")) summary.push("CFG 2"); + return { + match: { hw: s.hw }, + nnodes: 1, + verified: false, + flags, + env: p.env || [], + builder: { + topology, + topologySummary: p.summary || summary.join(" / "), + errors, + warnings: [ + ...(p.warnings || []), + "Documented recipe; this exact server and request combination has not been HTTP-verified.", + ], + verification: { serve: status, request: status }, + }, + }; + }, + }, + modelNames: { default: modelOf(defaults) }, + placeholders: { + PORT: { target: "command", label: "Server port", default: "30000" }, + CURL_HOST: { target: "curl", label: "Server host", default: "127.0.0.1" }, + CURL_PORT: { target: "curl", label: "Request port", default: "30000" }, + }, + curl: (s) => + [ + "curl -sS http://{{CURL_HOST}}:{{CURL_PORT}}/v1/videos", + "-H 'Content-Type: application/json'", + "-d '" + + JSON.stringify( + { + model: modelOf(s), + prompt: "A quiet street at dusk", + ...{ + size: s.pipeline === "two-stage" ? "1920x1088" : "960x544", + fps: 24, + ...(s.weights === "dev" ? { num_inference_steps: 30, guidance_scale: 3.0 } : {}), + ...(s.duration === "auto" ? { auto_duration: true } : { num_frames: 121 }), + ...(s.decoder === "diffusion" ? { use_diffusion_decoder: true } : {}), + }, + }, + null, + 2, + ) + + "'", + ].join(" \\\n "), + runModes: ["python"], + showPlaygroundLink: false, + github: { cookbookModel: modelOf(defaults) }, + }; + return config; +})(); diff --git a/docs/src/snippets/configs/LingBot/lingbot-video.jsx b/docs/src/snippets/configs/LingBot/lingbot-video.jsx new file mode 100644 index 0000000000..53bbf04ccd --- /dev/null +++ b/docs/src/snippets/configs/LingBot/lingbot-video.jsx @@ -0,0 +1,166 @@ +export const config = (() => { + const modelOf = (s) => + ({ + default: "robbyant/lingbot-video-moe-30b-a3b", + })[s.checkpoint || "default"]; + const plan = (s) => { + const flags = ["--model-path " + modelOf(s), ...["--port {{PORT}}"]]; + let gpus = 1; + let t = { tp_size: 1, ulysses_degree: 1, ring_degree: 1 }; + const env = []; + const warnings = []; + const errors = []; + return { flags, gpus, topology: t, env, warnings, errors }; + }; + const defaults = { + hw: "cuda", + nodes: 1, + gpus_per_node: 1, + topology_mode: "auto", + tp_size: 1, + ulysses_degree: 1, + ring_degree: 1, + }; + const config = { + modelName: "LingBot Video MoE", + supportedHardware: ["cuda"], + hardware: [{ id: "cuda", label: "NVIDIA CUDA", vram: "", vendor: "nvidia" }], + groupHardware: false, + matchDims: [], + overlayDims: [], + commandBuilder: { + defaultSelection: defaults, + resource: { + limits: { nodes: { min: 1, max: 1 }, gpus_per_node: { min: 1, max: 1 } }, + verifiedRecipes: ["cuda"].map((hw) => { + const s = { ...defaults, hw }; + const p = plan(s); + return { + ...s, + id: hw + "-documented", + gpus_per_node: p.gpus, + ...p.topology, + default: true, + unverified: true, + }; + }), + autoTopology: (s) => plan(s).topology, + validateTopology: (s, t) => { + const p = plan(s); + const errors = [...(p.errors || [])]; + if (!config.supportedHardware.includes(s.hw)) errors.push("Choose a listed hardware platform."); + if (Number(s.nodes) !== 1) errors.push("This recipe covers one node."); + const count = Number(s.gpus_per_node); + if (!Number.isInteger(count) || count < 1 || count > 1) + errors.push("Choose an integer GPU count within the documented limits."); + if (Number(s.gpus_per_node) !== p.gpus) errors.push("This recipe requires " + p.gpus + " GPUs / node."); + if (["tp_size", "ulysses_degree", "ring_degree"].some((key) => Number(t[key]) !== p.topology[key])) + errors.push("This topology is not a documented recipe for the selected model and hardware."); + return errors; + }, + }, + resolveDeployment: (s) => { + const p = plan(s); + const topology = + s.topology_mode === "manual" + ? { + tp_size: Number(s.tp_size), + ulysses_degree: Number(s.ulysses_degree), + ring_degree: Number(s.ring_degree), + } + : p.topology; + const errors = config.commandBuilder.resource.validateTopology(s, topology); + const status = errors.length ? "error" : "unverified"; + const flags = [...p.flags]; + if (!flags.some((flag) => flag.startsWith("--port "))) flags.push("--port {{PORT}}"); + const automaticSP = + flags.find((flag) => flag.startsWith("--sp-degree ")) && + !flags.some((flag) => flag.startsWith("--ulysses-degree")); + const summary = automaticSP + ? ["TP " + topology.tp_size, "SP " + topology.ulysses_degree + " (runtime-selected exchange)"] + : ["TP " + topology.tp_size, "Ulysses " + topology.ulysses_degree, "Ring " + topology.ring_degree]; + if (flags.includes("--enable-cfg-parallel")) summary.push("CFG 2"); + return { + match: { hw: s.hw }, + nnodes: 1, + verified: false, + flags, + env: p.env || [], + builder: { + topology, + topologySummary: p.summary || summary.join(" / "), + errors, + warnings: [ + ...(p.warnings || []), + "Documented recipe; this exact server and request combination has not been HTTP-verified.", + ], + verification: { serve: status, request: status }, + }, + }; + }, + }, + modelNames: { default: modelOf(defaults) }, + placeholders: { + PORT: { target: "command", label: "Server port", default: "30010" }, + CURL_HOST: { target: "curl", label: "Server host", default: "127.0.0.1" }, + CURL_PORT: { target: "curl", label: "Request port", default: "30010" }, + }, + curl: (s) => + [ + "curl -sS http://{{CURL_HOST}}:{{CURL_PORT}}/v1/videos", + "-H 'Content-Type: application/json'", + "-d '" + + JSON.stringify( + { + model: modelOf(s), + prompt: JSON.stringify({ + comprehensive_description: { + scene_content_description: + "A small silver robot arm on a white table slowly reaches toward a red cube. The background is a softly lit laboratory wall.", + camera_movement_description: "The camera is static at eye level in a medium shot.", + }, + camera_info: { + color: "Neutral", + frame_size: "Medium", + shot_type_angle: "Eye level", + lens_size: "Medium", + composition: "Center", + lighting: "Soft light", + lighting_type: "Artificial light", + }, + world_knowledge: [], + prominent_elements: [ + { + name: "robot arm", + description: "A small silver robot arm with a two-finger gripper.", + actions: [{ timestamp: "[0.0s - 1.0s]", action: "reaches toward the red cube" }], + location: "center of the frame", + relative_size: "dominant", + shape_and_color: "articulated silver metal arm", + texture: "brushed metal", + appearance_details: "two-finger gripper and visible joints", + relationship: "reaching toward the red cube on the table", + orientation: "upright, base on the table", + pose: "reaching", + }, + ], + }), + size: "640x384", + num_frames: 17, + fps: 16, + num_inference_steps: 12, + guidance_scale: 6.0, + flow_shift: 3.0, + seed: 0, + }, + null, + 2, + ) + + "'", + ].join(" \\\n "), + runModes: ["python"], + showPlaygroundLink: false, + github: { cookbookModel: modelOf(defaults) }, + }; + return config; +})(); diff --git a/docs/src/snippets/configs/LingBot/lingbot-world.jsx b/docs/src/snippets/configs/LingBot/lingbot-world.jsx new file mode 100644 index 0000000000..aeded16c72 --- /dev/null +++ b/docs/src/snippets/configs/LingBot/lingbot-world.jsx @@ -0,0 +1,124 @@ +export const config = (() => { + const modelOf = (s) => + ({ + default: "robbyant/lingbot-world-fast-diffusers", + })[s.checkpoint || "default"]; + const plan = (s) => { + const flags = [ + "--model-path " + modelOf(s), + ...[ + "--pipeline-class-name LingBotWorldCausalDMDPipeline", + "--num-gpus 4", + "--ulysses-degree 4", + "--dit-cpu-offload false", + "--text-encoder-cpu-offload false", + ], + ]; + let gpus = 4; + let t = { tp_size: 1, ulysses_degree: 1, ring_degree: 1 }; + const env = []; + const warnings = []; + const errors = []; + t.ulysses_degree = 4; + return { flags, gpus, topology: t, env, warnings, errors }; + }; + const defaults = { + hw: "cuda", + nodes: 1, + gpus_per_node: 4, + topology_mode: "auto", + tp_size: 1, + ulysses_degree: 4, + ring_degree: 1, + }; + const config = { + modelName: "LingBot World", + supportedHardware: ["cuda"], + hardware: [{ id: "cuda", label: "NVIDIA CUDA", vram: "", vendor: "nvidia" }], + groupHardware: false, + matchDims: [], + overlayDims: [], + commandBuilder: { + defaultSelection: defaults, + resource: { + limits: { nodes: { min: 1, max: 1 }, gpus_per_node: { min: 1, max: 4 } }, + verifiedRecipes: ["cuda"].map((hw) => { + const s = { ...defaults, hw }; + const p = plan(s); + return { + ...s, + id: hw + "-documented", + gpus_per_node: p.gpus, + ...p.topology, + default: true, + unverified: true, + }; + }), + autoTopology: (s) => plan(s).topology, + validateTopology: (s, t) => { + const p = plan(s); + const errors = [...(p.errors || [])]; + if (!config.supportedHardware.includes(s.hw)) errors.push("Choose a listed hardware platform."); + if (Number(s.nodes) !== 1) errors.push("This recipe covers one node."); + const count = Number(s.gpus_per_node); + if (!Number.isInteger(count) || count < 1 || count > 4) + errors.push("Choose an integer GPU count within the documented limits."); + if (Number(s.gpus_per_node) !== p.gpus) errors.push("This recipe requires " + p.gpus + " GPUs / node."); + if (["tp_size", "ulysses_degree", "ring_degree"].some((key) => Number(t[key]) !== p.topology[key])) + errors.push("This topology is not a documented recipe for the selected model and hardware."); + return errors; + }, + }, + resolveDeployment: (s) => { + const p = plan(s); + const topology = + s.topology_mode === "manual" + ? { + tp_size: Number(s.tp_size), + ulysses_degree: Number(s.ulysses_degree), + ring_degree: Number(s.ring_degree), + } + : p.topology; + const errors = config.commandBuilder.resource.validateTopology(s, topology); + const status = errors.length ? "error" : "unverified"; + const flags = [...p.flags]; + if (!flags.some((flag) => flag.startsWith("--port "))) flags.push("--port {{PORT}}"); + const automaticSP = + flags.find((flag) => flag.startsWith("--sp-degree ")) && + !flags.some((flag) => flag.startsWith("--ulysses-degree")); + const summary = automaticSP + ? ["TP " + topology.tp_size, "SP " + topology.ulysses_degree + " (runtime-selected exchange)"] + : ["TP " + topology.tp_size, "Ulysses " + topology.ulysses_degree, "Ring " + topology.ring_degree]; + if (flags.includes("--enable-cfg-parallel")) summary.push("CFG 2"); + return { + match: { hw: s.hw }, + nnodes: 1, + verified: false, + flags, + env: p.env || [], + builder: { + topology, + topologySummary: p.summary || summary.join(" / "), + errors, + warnings: [ + ...(p.warnings || []), + "Documented recipe; this exact server and request combination has not been HTTP-verified.", + ], + verification: { serve: status, request: status }, + }, + }; + }, + }, + modelNames: { default: modelOf(defaults) }, + placeholders: { + PORT: { target: "command", label: "Server port", default: "30000" }, + CURL_HOST: { target: "curl", label: "Server host", default: "127.0.0.1" }, + CURL_PORT: { target: "curl", label: "Request port", default: "30000" }, + }, + curl: "curl -sS http://{{CURL_HOST}}:{{CURL_PORT}}/v1/models", + runModes: ["python"], + showPlaygroundLink: false, + github: { cookbookModel: modelOf(defaults) }, + }; + return config; +})(); diff --git a/docs/src/snippets/configs/LingBot/lingbot-world2.jsx b/docs/src/snippets/configs/LingBot/lingbot-world2.jsx new file mode 100644 index 0000000000..e6a07bdd74 --- /dev/null +++ b/docs/src/snippets/configs/LingBot/lingbot-world2.jsx @@ -0,0 +1,128 @@ +export const config = (() => { + const modelOf = (s) => + ({ + default: "robbyant/lingbot-world-v2-14b-causal-fast-diffusers", + })[s.checkpoint || "default"]; + const plan = (s) => { + const flags = [ + "--model-path " + modelOf(s), + ...[ + "--pipeline-class-name LingBotWorldCausalDMDPipeline", + "--num-gpus 8", + "--ulysses-degree 8", + "--dit-cpu-offload false", + "--text-encoder-cpu-offload false", + "--vae-config.use-parallel-decode true", + "--vae-config.parallel-decode-mode spatial", + "--enable-torch-compile false", + ], + ]; + let gpus = 8; + let t = { tp_size: 1, ulysses_degree: 1, ring_degree: 1 }; + const env = []; + const warnings = []; + const errors = []; + t.ulysses_degree = 8; + env.push("SGLANG_LINGBOT_LAZY_VAE_ENCODE_BLACK_FRAMES=60", "SGLANG_LINGBOT_ENABLE_INTERACTIVE_KV_WINDOW=true"); + return { flags, gpus, topology: t, env, warnings, errors }; + }; + const defaults = { + hw: "cuda", + nodes: 1, + gpus_per_node: 8, + topology_mode: "auto", + tp_size: 1, + ulysses_degree: 8, + ring_degree: 1, + }; + const config = { + modelName: "LingBot World 2.0", + supportedHardware: ["cuda"], + hardware: [{ id: "cuda", label: "NVIDIA CUDA", vram: "", vendor: "nvidia" }], + groupHardware: false, + matchDims: [], + overlayDims: [], + commandBuilder: { + defaultSelection: defaults, + resource: { + limits: { nodes: { min: 1, max: 1 }, gpus_per_node: { min: 1, max: 8 } }, + verifiedRecipes: ["cuda"].map((hw) => { + const s = { ...defaults, hw }; + const p = plan(s); + return { + ...s, + id: hw + "-documented", + gpus_per_node: p.gpus, + ...p.topology, + default: true, + unverified: true, + }; + }), + autoTopology: (s) => plan(s).topology, + validateTopology: (s, t) => { + const p = plan(s); + const errors = [...(p.errors || [])]; + if (!config.supportedHardware.includes(s.hw)) errors.push("Choose a listed hardware platform."); + if (Number(s.nodes) !== 1) errors.push("This recipe covers one node."); + const count = Number(s.gpus_per_node); + if (!Number.isInteger(count) || count < 1 || count > 8) + errors.push("Choose an integer GPU count within the documented limits."); + if (Number(s.gpus_per_node) !== p.gpus) errors.push("This recipe requires " + p.gpus + " GPUs / node."); + if (["tp_size", "ulysses_degree", "ring_degree"].some((key) => Number(t[key]) !== p.topology[key])) + errors.push("This topology is not a documented recipe for the selected model and hardware."); + return errors; + }, + }, + resolveDeployment: (s) => { + const p = plan(s); + const topology = + s.topology_mode === "manual" + ? { + tp_size: Number(s.tp_size), + ulysses_degree: Number(s.ulysses_degree), + ring_degree: Number(s.ring_degree), + } + : p.topology; + const errors = config.commandBuilder.resource.validateTopology(s, topology); + const status = errors.length ? "error" : "unverified"; + const flags = [...p.flags]; + if (!flags.some((flag) => flag.startsWith("--port "))) flags.push("--port {{PORT}}"); + const automaticSP = + flags.find((flag) => flag.startsWith("--sp-degree ")) && + !flags.some((flag) => flag.startsWith("--ulysses-degree")); + const summary = automaticSP + ? ["TP " + topology.tp_size, "SP " + topology.ulysses_degree + " (runtime-selected exchange)"] + : ["TP " + topology.tp_size, "Ulysses " + topology.ulysses_degree, "Ring " + topology.ring_degree]; + if (flags.includes("--enable-cfg-parallel")) summary.push("CFG 2"); + return { + match: { hw: s.hw }, + nnodes: 1, + verified: false, + flags, + env: p.env || [], + builder: { + topology, + topologySummary: p.summary || summary.join(" / "), + errors, + warnings: [ + ...(p.warnings || []), + "Documented recipe; this exact server and request combination has not been HTTP-verified.", + ], + verification: { serve: status, request: status }, + }, + }; + }, + }, + modelNames: { default: modelOf(defaults) }, + placeholders: { + PORT: { target: "command", label: "Server port", default: "30000" }, + CURL_HOST: { target: "curl", label: "Server host", default: "127.0.0.1" }, + CURL_PORT: { target: "curl", label: "Request port", default: "30000" }, + }, + curl: "curl -sS http://{{CURL_HOST}}:{{CURL_PORT}}/v1/models", + runModes: ["python"], + showPlaygroundLink: false, + github: { cookbookModel: modelOf(defaults) }, + }; + return config; +})(); diff --git a/docs/src/snippets/configs/LongCat/longcat-image.jsx b/docs/src/snippets/configs/LongCat/longcat-image.jsx new file mode 100644 index 0000000000..c007fa3e6e --- /dev/null +++ b/docs/src/snippets/configs/LongCat/longcat-image.jsx @@ -0,0 +1,143 @@ +export const config = (() => { + const modelOf = (s) => + ({ + default: "meituan-longcat/LongCat-Image", + })[s.checkpoint || "default"]; + const plan = (s) => { + const flags = ["--model-path " + modelOf(s), ...["--performance-mode auto", "--port {{PORT}}"]]; + let gpus = 1; + let t = { tp_size: 1, ulysses_degree: 1, ring_degree: 1 }; + const env = []; + const warnings = []; + const errors = []; + return { flags, gpus, topology: t, env, warnings, errors }; + }; + const defaults = { + hw: "cuda", + nodes: 1, + gpus_per_node: 1, + topology_mode: "auto", + tp_size: 1, + ulysses_degree: 1, + ring_degree: 1, + rewrite: "on", + }; + const config = { + modelName: "LongCat-Image", + supportedHardware: ["cuda"], + hardware: [{ id: "cuda", label: "NVIDIA CUDA", vram: "", vendor: "nvidia" }], + groupHardware: false, + matchDims: [], + overlayDims: [ + { + id: "rewrite", + title: "Prompt rewriting", + scope: "request", + default: "on", + options: [ + { id: "on", label: "Enabled" }, + { id: "off", label: "Disabled" }, + ], + }, + ], + commandBuilder: { + defaultSelection: defaults, + resource: { + limits: { nodes: { min: 1, max: 1 }, gpus_per_node: { min: 1, max: 1 } }, + verifiedRecipes: ["cuda"].map((hw) => { + const s = { ...defaults, hw }; + const p = plan(s); + return { + ...s, + id: hw + "-documented", + gpus_per_node: p.gpus, + ...p.topology, + default: true, + unverified: true, + }; + }), + autoTopology: (s) => plan(s).topology, + validateTopology: (s, t) => { + const p = plan(s); + const errors = [...(p.errors || [])]; + if (!config.supportedHardware.includes(s.hw)) errors.push("Choose a listed hardware platform."); + if (Number(s.nodes) !== 1) errors.push("This recipe covers one node."); + const count = Number(s.gpus_per_node); + if (!Number.isInteger(count) || count < 1 || count > 1) + errors.push("Choose an integer GPU count within the documented limits."); + if (Number(s.gpus_per_node) !== p.gpus) errors.push("This recipe requires " + p.gpus + " GPUs / node."); + if (["tp_size", "ulysses_degree", "ring_degree"].some((key) => Number(t[key]) !== p.topology[key])) + errors.push("This topology is not a documented recipe for the selected model and hardware."); + return errors; + }, + }, + resolveDeployment: (s) => { + const p = plan(s); + const topology = + s.topology_mode === "manual" + ? { + tp_size: Number(s.tp_size), + ulysses_degree: Number(s.ulysses_degree), + ring_degree: Number(s.ring_degree), + } + : p.topology; + const errors = config.commandBuilder.resource.validateTopology(s, topology); + const status = errors.length ? "error" : "unverified"; + const flags = [...p.flags]; + if (!flags.some((flag) => flag.startsWith("--port "))) flags.push("--port {{PORT}}"); + const automaticSP = + flags.find((flag) => flag.startsWith("--sp-degree ")) && + !flags.some((flag) => flag.startsWith("--ulysses-degree")); + const summary = automaticSP + ? ["TP " + topology.tp_size, "SP " + topology.ulysses_degree + " (runtime-selected exchange)"] + : ["TP " + topology.tp_size, "Ulysses " + topology.ulysses_degree, "Ring " + topology.ring_degree]; + if (flags.includes("--enable-cfg-parallel")) summary.push("CFG 2"); + return { + match: { hw: s.hw }, + nnodes: 1, + verified: false, + flags, + env: p.env || [], + builder: { + topology, + topologySummary: p.summary || summary.join(" / "), + errors, + warnings: [ + ...(p.warnings || []), + "Documented recipe; this exact server and request combination has not been HTTP-verified.", + ], + verification: { serve: status, request: status }, + }, + }; + }, + }, + modelNames: { default: modelOf(defaults) }, + placeholders: { + PORT: { target: "command", label: "Server port", default: "30010" }, + CURL_HOST: { target: "curl", label: "Server host", default: "127.0.0.1" }, + CURL_PORT: { target: "curl", label: "Request port", default: "30010" }, + }, + curl: (s) => + [ + "curl -sS http://{{CURL_HOST}}:{{CURL_PORT}}/v1/images/generations", + "-H 'Content-Type: application/json'", + "-d '" + + JSON.stringify( + { + model: modelOf(s), + prompt: "A quiet lakeside cabin at sunrise", + n: 1, + response_format: "b64_json", + ...{ enable_prompt_rewrite: s.rewrite === "on" }, + }, + null, + 2, + ) + + "'", + ].join(" \\\n "), + runModes: ["python"], + showPlaygroundLink: false, + github: { cookbookModel: modelOf(defaults) }, + }; + return config; +})(); diff --git a/docs/src/snippets/configs/OpenMOSS/mova.jsx b/docs/src/snippets/configs/OpenMOSS/mova.jsx new file mode 100644 index 0000000000..a39ed8a28c --- /dev/null +++ b/docs/src/snippets/configs/OpenMOSS/mova.jsx @@ -0,0 +1,155 @@ +export const config = (() => { + const modelOf = (s) => "OpenMOSS-Team/MOVA-" + s.resolution; + const plan = (s) => ({ + flags: [ + "--model-path " + modelOf(s), + "--host 0.0.0.0", + "--port {{PORT}}", + "--adjust-frames false", + "--num-gpus 8", + "--ring-degree 2", + "--ulysses-degree 4", + "--tp 1", + "--enable-torch-compile", + "--save-output", + '--output-dir "$SG_OUTPUT_DIR"', + ], + gpus: 8, + topology: { tp_size: 1, ulysses_degree: 4, ring_degree: 2 }, + }); + const defaults = { + hw: "b200", + nodes: 1, + gpus_per_node: 8, + topology_mode: "auto", + tp_size: 1, + ulysses_degree: 4, + ring_degree: 2, + resolution: "360p", + }; + const config = { + modelName: "MOVA", + supportedHardware: ["b200", "h200", "h100", "a100"], + hardware: [{ id: "a100", label: "A100", vram: "", vendor: "nvidia" }], + groupHardware: false, + matchDims: [], + overlayDims: [ + { + id: "resolution", + title: "Checkpoint", + scope: "base", + default: "360p", + options: [ + { id: "360p", label: "360p" }, + { id: "720p", label: "720p" }, + ], + }, + ], + commandBuilder: { + defaultSelection: defaults, + resource: { + limits: { nodes: { min: 1, max: 1 }, gpus_per_node: { min: 1, max: 8 } }, + verifiedRecipes: ["b200", "h200", "h100", "a100"].map((hw) => { + const s = { ...defaults, hw }; + const p = plan(s); + return { + ...s, + id: hw + "-documented", + gpus_per_node: p.gpus, + ...p.topology, + default: true, + unverified: true, + }; + }), + autoTopology: (s) => plan(s).topology, + validateTopology: (s, t) => { + const p = plan(s); + const errors = [...(p.errors || [])]; + if (!config.supportedHardware.includes(s.hw)) errors.push("Choose a listed hardware platform."); + if (Number(s.nodes) !== 1) errors.push("This recipe covers one node."); + const count = Number(s.gpus_per_node); + if (!Number.isInteger(count) || count < 1 || count > 8) + errors.push("Choose an integer GPU count within the documented limits."); + if (Number(s.gpus_per_node) !== p.gpus) errors.push("This recipe requires " + p.gpus + " GPUs / node."); + if (["tp_size", "ulysses_degree", "ring_degree"].some((key) => Number(t[key]) !== p.topology[key])) + errors.push("This topology is not a documented recipe for the selected model and hardware."); + return errors; + }, + }, + resolveDeployment: (s) => { + const p = plan(s); + const topology = + s.topology_mode === "manual" + ? { + tp_size: Number(s.tp_size), + ulysses_degree: Number(s.ulysses_degree), + ring_degree: Number(s.ring_degree), + } + : p.topology; + const errors = config.commandBuilder.resource.validateTopology(s, topology); + const status = errors.length ? "error" : "unverified"; + const flags = [...p.flags]; + if (!flags.some((flag) => flag.startsWith("--port "))) flags.push("--port {{PORT}}"); + const automaticSP = + flags.find((flag) => flag.startsWith("--sp-degree ")) && + !flags.some((flag) => flag.startsWith("--ulysses-degree")); + const summary = automaticSP + ? ["TP " + topology.tp_size, "SP " + topology.ulysses_degree + " (runtime-selected exchange)"] + : ["TP " + topology.tp_size, "Ulysses " + topology.ulysses_degree, "Ring " + topology.ring_degree]; + if (flags.includes("--enable-cfg-parallel")) summary.push("CFG 2"); + return { + match: { hw: s.hw }, + nnodes: 1, + verified: false, + flags, + env: p.env || [], + builder: { + topology, + topologySummary: p.summary || summary.join(" / "), + errors, + warnings: [ + ...(p.warnings || []), + "Documented recipe; this exact server and request combination has not been HTTP-verified.", + ], + verification: { serve: status, request: status }, + }, + }; + }, + }, + modelNames: { default: modelOf(defaults) }, + placeholders: { + PORT: { target: "command", label: "Server port", default: "30002" }, + CURL_HOST: { target: "curl", label: "Server host", default: "127.0.0.1" }, + CURL_PORT: { target: "curl", label: "Request port", default: "30002" }, + INPUT_IMAGE: { target: "curl", label: "Image path on the server", default: "/path/to/input.png" }, + }, + curl: (s) => + [ + "curl -sS http://{{CURL_HOST}}:{{CURL_PORT}}/v1/videos", + "-H 'Content-Type: application/json'", + "-d '" + + JSON.stringify( + { + model: modelOf(s), + prompt: "A quiet street at dusk", + ...{ + input_reference: "{{INPUT_IMAGE}}", + size: s.resolution === "360p" ? "640x352" : "1280x720", + num_frames: 193, + fps: 24, + seed: 67, + guidance_scale: 5.0, + num_inference_steps: 25, + }, + }, + null, + 2, + ) + + "'", + ].join(" \\\n "), + runModes: ["python"], + showPlaygroundLink: false, + github: { cookbookModel: modelOf(defaults) }, + }; + return config; +})(); diff --git a/docs/src/snippets/configs/Qwen/qwen-image-edit.jsx b/docs/src/snippets/configs/Qwen/qwen-image-edit.jsx new file mode 100644 index 0000000000..d795732279 --- /dev/null +++ b/docs/src/snippets/configs/Qwen/qwen-image-edit.jsx @@ -0,0 +1,114 @@ +export const config = (() => { + const modelOf = () => "Qwen/Qwen-Image-Edit-2511"; + const plan = (s) => ({ + flags: ["--model-path " + modelOf(s), "--ulysses-degree=1", "--ring-degree=1"], + gpus: 1, + topology: { tp_size: 1, ulysses_degree: 1, ring_degree: 1 }, + }); + const defaults = { + hw: "b200", + nodes: 1, + gpus_per_node: 1, + topology_mode: "auto", + tp_size: 1, + ulysses_degree: 1, + ring_degree: 1, + }; + const config = { + modelName: "Qwen-Image-Edit", + supportedHardware: ["b200", "b300", "h200", "h100", "mi300x", "mi325x", "mi355x"], + hardware: [], + groupHardware: false, + matchDims: [], + overlayDims: [], + commandBuilder: { + defaultSelection: defaults, + resource: { + limits: { nodes: { min: 1, max: 1 }, gpus_per_node: { min: 1, max: 1 } }, + verifiedRecipes: ["b200", "b300", "h200", "h100", "mi300x", "mi325x", "mi355x"].map((hw) => { + const s = { ...defaults, hw }; + const p = plan(s); + return { + ...s, + id: hw + "-documented", + gpus_per_node: p.gpus, + ...p.topology, + default: true, + unverified: true, + }; + }), + autoTopology: (s) => plan(s).topology, + validateTopology: (s, t) => { + const p = plan(s); + const errors = [...(p.errors || [])]; + if (!config.supportedHardware.includes(s.hw)) errors.push("Choose a listed hardware platform."); + if (Number(s.nodes) !== 1) errors.push("This recipe covers one node."); + const count = Number(s.gpus_per_node); + if (!Number.isInteger(count) || count < 1 || count > 1) + errors.push("Choose an integer GPU count within the documented limits."); + if (Number(s.gpus_per_node) !== p.gpus) errors.push("This recipe requires " + p.gpus + " GPUs / node."); + if (["tp_size", "ulysses_degree", "ring_degree"].some((key) => Number(t[key]) !== p.topology[key])) + errors.push("This topology is not a documented recipe for the selected model and hardware."); + return errors; + }, + }, + resolveDeployment: (s) => { + const p = plan(s); + const topology = + s.topology_mode === "manual" + ? { + tp_size: Number(s.tp_size), + ulysses_degree: Number(s.ulysses_degree), + ring_degree: Number(s.ring_degree), + } + : p.topology; + const errors = config.commandBuilder.resource.validateTopology(s, topology); + const status = errors.length ? "error" : "unverified"; + const flags = [...p.flags]; + if (!flags.some((flag) => flag.startsWith("--port "))) flags.push("--port {{PORT}}"); + const automaticSP = + flags.find((flag) => flag.startsWith("--sp-degree ")) && + !flags.some((flag) => flag.startsWith("--ulysses-degree")); + const summary = automaticSP + ? ["TP " + topology.tp_size, "SP " + topology.ulysses_degree + " (runtime-selected exchange)"] + : ["TP " + topology.tp_size, "Ulysses " + topology.ulysses_degree, "Ring " + topology.ring_degree]; + if (flags.includes("--enable-cfg-parallel")) summary.push("CFG 2"); + return { + match: { hw: s.hw }, + nnodes: 1, + verified: false, + flags, + env: p.env || [], + builder: { + topology, + topologySummary: p.summary || summary.join(" / "), + errors, + warnings: [ + ...(p.warnings || []), + "Documented recipe; this exact server and request combination has not been HTTP-verified.", + ], + verification: { serve: status, request: status }, + }, + }; + }, + }, + modelNames: { default: modelOf(defaults) }, + placeholders: { + PORT: { target: "command", label: "Server port", default: "30000" }, + CURL_HOST: { target: "curl", label: "Server host", default: "127.0.0.1" }, + CURL_PORT: { target: "curl", label: "Request port", default: "30000" }, + INPUT_IMAGE: { target: "curl", label: "Input image on the client", default: "/path/to/input.png" }, + }, + curl: (s) => + [ + "curl -sS http://{{CURL_HOST}}:{{CURL_PORT}}/v1/images/edits", + '--form-string "model=' + modelOf(s) + '"', + '--form-string "prompt=Change the background to a sunset"', + '--form "image=@{{INPUT_IMAGE}}"', + ].join(" \\\n "), + runModes: ["python"], + showPlaygroundLink: false, + github: { cookbookModel: modelOf(defaults) }, + }; + return config; +})(); diff --git a/docs/src/snippets/configs/Qwen/qwen-image.jsx b/docs/src/snippets/configs/Qwen/qwen-image.jsx new file mode 100644 index 0000000000..7228ebab72 --- /dev/null +++ b/docs/src/snippets/configs/Qwen/qwen-image.jsx @@ -0,0 +1,149 @@ +export const config = (() => { + const modelOf = (s) => + s.precision === "nvfp4" && ["b200", "b300"].includes(s.hw) + ? "lmsys/qwen-image-2512-modelopt-nvfp4-sglang" + : "Qwen/Qwen-Image"; + const plan = (s) => { + const flags = ["--model-path " + modelOf(s)]; + if (s.hw === "a2") flags.push("--num-gpus 1"); + else if (s.hw === "a3") flags.push("--tp-size 1", "--sp-degree 2", "--num-gpus 2"); + else flags.push("--ulysses-degree=1", "--ring-degree=1"); + return { + flags, + gpus: s.hw === "a3" ? 2 : 1, + topology: { tp_size: 1, ulysses_degree: s.hw === "a3" ? 2 : 1, ring_degree: 1 }, + warnings: s.precision === "nvfp4" ? ["NVFP4 is approximate; evaluate image quality against BF16."] : [], + }; + }; + const defaults = { + hw: "b200", + nodes: 1, + gpus_per_node: 1, + topology_mode: "auto", + tp_size: 1, + ulysses_degree: 1, + ring_degree: 1, + precision: "bf16", + }; + const config = { + modelName: "Qwen-Image", + supportedHardware: ["b200", "b300", "h200", "h100", "mi300x", "mi325x", "mi355x", "a2", "a3"], + hardware: [ + { id: "a2", label: "Ascend A2", vram: "", vendor: "npu" }, + { id: "a3", label: "Ascend A3", vram: "2 NPUs / card", vendor: "npu" }, + ], + groupHardware: false, + matchDims: [], + overlayDims: [ + { + id: "precision", + title: "Precision", + scope: "serve", + default: "bf16", + options: [ + { id: "bf16", label: "BF16" }, + { id: "nvfp4", label: "NVFP4", showWhen: (s) => ["b200", "b300"].includes(s.hw) }, + ], + }, + ], + commandBuilder: { + defaultSelection: defaults, + resource: { + limits: { nodes: { min: 1, max: 1 }, gpus_per_node: { min: 1, max: 8 } }, + verifiedRecipes: ["b200", "b300", "h200", "h100", "mi300x", "mi325x", "mi355x", "a2", "a3"].map((hw) => { + const s = { ...defaults, hw }; + const p = plan(s); + return { + ...s, + id: hw + "-documented", + gpus_per_node: p.gpus, + ...p.topology, + default: true, + unverified: true, + }; + }), + autoTopology: (s) => plan(s).topology, + validateTopology: (s, t) => { + const p = plan(s); + const errors = [...(p.errors || [])]; + if (!config.supportedHardware.includes(s.hw)) errors.push("Choose a listed hardware platform."); + if (Number(s.nodes) !== 1) errors.push("This recipe covers one node."); + const count = Number(s.gpus_per_node); + if (!Number.isInteger(count) || count < 1 || count > 8) + errors.push("Choose an integer GPU count within the documented limits."); + if (Number(s.gpus_per_node) !== p.gpus) errors.push("This recipe requires " + p.gpus + " GPUs / node."); + if (["tp_size", "ulysses_degree", "ring_degree"].some((key) => Number(t[key]) !== p.topology[key])) + errors.push("This topology is not a documented recipe for the selected model and hardware."); + return errors; + }, + }, + resolveDeployment: (s) => { + const p = plan(s); + const topology = + s.topology_mode === "manual" + ? { + tp_size: Number(s.tp_size), + ulysses_degree: Number(s.ulysses_degree), + ring_degree: Number(s.ring_degree), + } + : p.topology; + const errors = config.commandBuilder.resource.validateTopology(s, topology); + const status = errors.length ? "error" : "unverified"; + const flags = [...p.flags]; + if (!flags.some((flag) => flag.startsWith("--port "))) flags.push("--port {{PORT}}"); + const automaticSP = + flags.find((flag) => flag.startsWith("--sp-degree ")) && + !flags.some((flag) => flag.startsWith("--ulysses-degree")); + const summary = automaticSP + ? ["TP " + topology.tp_size, "SP " + topology.ulysses_degree + " (runtime-selected exchange)"] + : ["TP " + topology.tp_size, "Ulysses " + topology.ulysses_degree, "Ring " + topology.ring_degree]; + if (flags.includes("--enable-cfg-parallel")) summary.push("CFG 2"); + return { + match: { hw: s.hw }, + nnodes: 1, + verified: false, + flags, + env: p.env || [], + builder: { + topology, + topologySummary: p.summary || summary.join(" / "), + errors, + warnings: [ + ...(p.warnings || []), + "Documented recipe; this exact server and request combination has not been HTTP-verified.", + ], + verification: { serve: status, request: status }, + }, + }; + }, + }, + modelNames: { default: modelOf(defaults) }, + placeholders: { + PORT: { target: "command", label: "Server port", default: "30000" }, + CURL_HOST: { target: "curl", label: "Server host", default: "127.0.0.1" }, + CURL_PORT: { target: "curl", label: "Request port", default: "30000" }, + }, + curl: (s) => + [ + "curl -sS http://{{CURL_HOST}}:{{CURL_PORT}}/v1/images/generations", + "-H 'Content-Type: application/json'", + "-d '" + + JSON.stringify( + { + model: modelOf(s), + prompt: "A quiet lakeside cabin at sunrise", + n: 1, + response_format: "b64_json", + ...{}, + }, + null, + 2, + ) + + "'", + ].join(" \\\n "), + runModes: ["python"], + showPlaygroundLink: false, + github: { cookbookModel: modelOf(defaults) }, + }; + return config; +})(); diff --git a/docs/src/snippets/configs/SANA/sana-video.jsx b/docs/src/snippets/configs/SANA/sana-video.jsx new file mode 100644 index 0000000000..9d01d241a0 --- /dev/null +++ b/docs/src/snippets/configs/SANA/sana-video.jsx @@ -0,0 +1,138 @@ +export const config = (() => { + const modelOf = (s) => + ({ + default: "Efficient-Large-Model/SANA-Video_2B_480p_diffusers", + })[s.checkpoint || "default"]; + const plan = (s) => { + const flags = ["--model-path " + modelOf(s), ...["--port {{PORT}}"]]; + let gpus = 1; + let t = { tp_size: 1, ulysses_degree: 1, ring_degree: 1 }; + const env = []; + const warnings = []; + const errors = []; + return { flags, gpus, topology: t, env, warnings, errors }; + }; + const defaults = { + hw: "cuda", + nodes: 1, + gpus_per_node: 1, + topology_mode: "auto", + tp_size: 1, + ulysses_degree: 1, + ring_degree: 1, + }; + const config = { + modelName: "SANA-Video", + supportedHardware: ["cuda"], + hardware: [{ id: "cuda", label: "NVIDIA CUDA", vram: "", vendor: "nvidia" }], + groupHardware: false, + matchDims: [], + overlayDims: [], + commandBuilder: { + defaultSelection: defaults, + resource: { + limits: { nodes: { min: 1, max: 1 }, gpus_per_node: { min: 1, max: 1 } }, + verifiedRecipes: ["cuda"].map((hw) => { + const s = { ...defaults, hw }; + const p = plan(s); + return { + ...s, + id: hw + "-documented", + gpus_per_node: p.gpus, + ...p.topology, + default: true, + unverified: true, + }; + }), + autoTopology: (s) => plan(s).topology, + validateTopology: (s, t) => { + const p = plan(s); + const errors = [...(p.errors || [])]; + if (!config.supportedHardware.includes(s.hw)) errors.push("Choose a listed hardware platform."); + if (Number(s.nodes) !== 1) errors.push("This recipe covers one node."); + const count = Number(s.gpus_per_node); + if (!Number.isInteger(count) || count < 1 || count > 1) + errors.push("Choose an integer GPU count within the documented limits."); + if (Number(s.gpus_per_node) !== p.gpus) errors.push("This recipe requires " + p.gpus + " GPUs / node."); + if (["tp_size", "ulysses_degree", "ring_degree"].some((key) => Number(t[key]) !== p.topology[key])) + errors.push("This topology is not a documented recipe for the selected model and hardware."); + return errors; + }, + }, + resolveDeployment: (s) => { + const p = plan(s); + const topology = + s.topology_mode === "manual" + ? { + tp_size: Number(s.tp_size), + ulysses_degree: Number(s.ulysses_degree), + ring_degree: Number(s.ring_degree), + } + : p.topology; + const errors = config.commandBuilder.resource.validateTopology(s, topology); + const status = errors.length ? "error" : "unverified"; + const flags = [...p.flags]; + if (!flags.some((flag) => flag.startsWith("--port "))) flags.push("--port {{PORT}}"); + const automaticSP = + flags.find((flag) => flag.startsWith("--sp-degree ")) && + !flags.some((flag) => flag.startsWith("--ulysses-degree")); + const summary = automaticSP + ? ["TP " + topology.tp_size, "SP " + topology.ulysses_degree + " (runtime-selected exchange)"] + : ["TP " + topology.tp_size, "Ulysses " + topology.ulysses_degree, "Ring " + topology.ring_degree]; + if (flags.includes("--enable-cfg-parallel")) summary.push("CFG 2"); + return { + match: { hw: s.hw }, + nnodes: 1, + verified: false, + flags, + env: p.env || [], + builder: { + topology, + topologySummary: p.summary || summary.join(" / "), + errors, + warnings: [ + ...(p.warnings || []), + "Documented recipe; this exact server and request combination has not been HTTP-verified.", + ], + verification: { serve: status, request: status }, + }, + }; + }, + }, + modelNames: { default: modelOf(defaults) }, + placeholders: { + PORT: { target: "command", label: "Server port", default: "30010" }, + CURL_HOST: { target: "curl", label: "Server host", default: "127.0.0.1" }, + CURL_PORT: { target: "curl", label: "Request port", default: "30010" }, + }, + curl: (s) => + [ + "curl -sS http://{{CURL_HOST}}:{{CURL_PORT}}/v1/videos", + "-H 'Content-Type: application/json'", + "-d '" + + JSON.stringify( + { + model: modelOf(s), + prompt: "A quiet street at dusk", + ...{ + prompt: + "A red tram moves slowly through a sunlit city square while pedestrians cross behind it. motion score: 30.", + size: "832x480", + num_frames: 17, + fps: 16, + num_inference_steps: 8, + guidance_scale: 6.0, + seed: 42, + }, + }, + null, + 2, + ) + + "'", + ].join(" \\\n "), + runModes: ["python"], + showPlaygroundLink: false, + github: { cookbookModel: modelOf(defaults) }, + }; + return config; +})(); diff --git a/docs/src/snippets/configs/SANA/sana-wm.jsx b/docs/src/snippets/configs/SANA/sana-wm.jsx new file mode 100644 index 0000000000..fc764e8f72 --- /dev/null +++ b/docs/src/snippets/configs/SANA/sana-wm.jsx @@ -0,0 +1,168 @@ +export const config = (() => { + const modelOf = (s) => + ({ + dense: "Efficient-Large-Model/SANA-WM_bidirectional", + streaming: "Efficient-Large-Model/SANA-WM_streaming", + })[s.checkpoint || "dense"]; + const plan = (s) => { + const flags = ["--model-path " + modelOf(s), ...["--host 127.0.0.1", "--port {{PORT}}"]]; + let gpus = 1; + let t = { tp_size: 1, ulysses_degree: 1, ring_degree: 1 }; + const env = []; + const warnings = []; + const errors = []; + flags.splice( + 1, + 0, + "--pipeline-class-name " + (s.mode === "realtime" ? "SanaWMRealtimePipeline" : "SanaWMTwoStagePipeline"), + ); + if (s.checkpoint === "streaming" && s.mode !== "realtime") flags.push("--streaming", "--refiner-chunked"); + if (s.mode === "realtime" && s.checkpoint !== "streaming") + errors.push("Realtime requires the streaming checkpoint."); + return { flags, gpus, topology: t, env, warnings, errors }; + }; + const defaults = { + hw: "cuda", + nodes: 1, + gpus_per_node: 1, + topology_mode: "auto", + tp_size: 1, + ulysses_degree: 1, + ring_degree: 1, + checkpoint: "dense", + mode: "batch", + }; + const config = { + modelName: "SANA-WM", + supportedHardware: ["cuda"], + hardware: [{ id: "cuda", label: "NVIDIA CUDA", vram: "", vendor: "nvidia" }], + groupHardware: false, + matchDims: [], + overlayDims: [ + { + id: "checkpoint", + title: "Checkpoint", + scope: "base", + default: "dense", + options: [ + { id: "dense", label: "SANA-WM_bidirectional" }, + { id: "streaming", label: "SANA-WM_streaming" }, + ], + }, + { + id: "mode", + title: "Serving mode", + scope: "serve", + default: "batch", + options: [ + { id: "batch", label: "Batch" }, + { id: "realtime", label: "Realtime", showWhen: (s) => s.checkpoint === "streaming" }, + ], + }, + ], + commandBuilder: { + defaultSelection: defaults, + resource: { + limits: { nodes: { min: 1, max: 1 }, gpus_per_node: { min: 1, max: 1 } }, + verifiedRecipes: ["cuda"].map((hw) => { + const s = { ...defaults, hw }; + const p = plan(s); + return { + ...s, + id: hw + "-documented", + gpus_per_node: p.gpus, + ...p.topology, + default: true, + unverified: true, + }; + }), + autoTopology: (s) => plan(s).topology, + validateTopology: (s, t) => { + const p = plan(s); + const errors = [...(p.errors || [])]; + if (!config.supportedHardware.includes(s.hw)) errors.push("Choose a listed hardware platform."); + if (Number(s.nodes) !== 1) errors.push("This recipe covers one node."); + const count = Number(s.gpus_per_node); + if (!Number.isInteger(count) || count < 1 || count > 1) + errors.push("Choose an integer GPU count within the documented limits."); + if (Number(s.gpus_per_node) !== p.gpus) errors.push("This recipe requires " + p.gpus + " GPUs / node."); + if (["tp_size", "ulysses_degree", "ring_degree"].some((key) => Number(t[key]) !== p.topology[key])) + errors.push("This topology is not a documented recipe for the selected model and hardware."); + return errors; + }, + }, + resolveDeployment: (s) => { + const p = plan(s); + const topology = + s.topology_mode === "manual" + ? { + tp_size: Number(s.tp_size), + ulysses_degree: Number(s.ulysses_degree), + ring_degree: Number(s.ring_degree), + } + : p.topology; + const errors = config.commandBuilder.resource.validateTopology(s, topology); + const status = errors.length ? "error" : "unverified"; + const flags = [...p.flags]; + if (!flags.some((flag) => flag.startsWith("--port "))) flags.push("--port {{PORT}}"); + const automaticSP = + flags.find((flag) => flag.startsWith("--sp-degree ")) && + !flags.some((flag) => flag.startsWith("--ulysses-degree")); + const summary = automaticSP + ? ["TP " + topology.tp_size, "SP " + topology.ulysses_degree + " (runtime-selected exchange)"] + : ["TP " + topology.tp_size, "Ulysses " + topology.ulysses_degree, "Ring " + topology.ring_degree]; + if (flags.includes("--enable-cfg-parallel")) summary.push("CFG 2"); + return { + match: { hw: s.hw }, + nnodes: 1, + verified: false, + flags, + env: p.env || [], + builder: { + topology, + topologySummary: p.summary || summary.join(" / "), + errors, + warnings: [ + ...(p.warnings || []), + "Documented recipe; this exact server and request combination has not been HTTP-verified.", + ], + verification: { serve: status, request: status }, + }, + }; + }, + }, + modelNames: { default: modelOf(defaults) }, + placeholders: { + PORT: { target: "command", label: "Server port", default: "30000" }, + CURL_HOST: { target: "curl", label: "Server host", default: "127.0.0.1" }, + CURL_PORT: { target: "curl", label: "Request port", default: "30000" }, + }, + curl: (s) => + s.mode === "realtime" + ? "curl -sS http://{{CURL_HOST}}:{{CURL_PORT}}/v1/models" + : ((s) => + [ + "curl -sS http://{{CURL_HOST}}:{{CURL_PORT}}/v1/videos", + "-H 'Content-Type: application/json'", + "-d '" + + JSON.stringify( + { + prompt: "a camera moving forward and turning left", + input_reference: "/path/to/first_frame.png", + num_frames: 321, + seed: 42, + fps: 16, + ...(s.checkpoint === "dense" ? { num_inference_steps: 60, guidance_scale: 5.0 } : {}), + diffusers_kwargs: { action: "w-80,wl-80,l-80,wj-80", intrinsics: "/path/to/intrinsics.npy" }, + }, + null, + 2, + ) + + "'", + ].join(" \\\n "))(s), + runModes: ["python"], + showPlaygroundLink: false, + github: { cookbookModel: modelOf(defaults) }, + }; + return config; +})(); diff --git a/docs/src/snippets/configs/SenseNova/sensenova-u15.jsx b/docs/src/snippets/configs/SenseNova/sensenova-u15.jsx new file mode 100644 index 0000000000..af69e2a82a --- /dev/null +++ b/docs/src/snippets/configs/SenseNova/sensenova-u15.jsx @@ -0,0 +1,144 @@ +export const config = (() => { + const modelOf = (s) => + ({ + default: "sensenova/SenseNova-U1.5-8B-MoT", + })[s.checkpoint || "default"]; + const plan = (s) => { + const flags = ["--model-path " + modelOf(s), ...["--port {{PORT}}"]]; + let gpus = 1; + let t = { tp_size: 1, ulysses_degree: 1, ring_degree: 1 }; + const env = []; + const warnings = []; + const errors = []; + if (s.batching === "on") flags.push("--batching-max-size 2", "--batching-delay-ms 100"); + return { flags, gpus, topology: t, env, warnings, errors }; + }; + const defaults = { + hw: "cuda", + nodes: 1, + gpus_per_node: 1, + topology_mode: "auto", + tp_size: 1, + ulysses_degree: 1, + ring_degree: 1, + batching: "off", + }; + const config = { + modelName: "SenseNova-U1.5-8B-MoT", + supportedHardware: ["cuda"], + hardware: [{ id: "cuda", label: "NVIDIA CUDA", vram: "", vendor: "nvidia" }], + groupHardware: false, + matchDims: [], + overlayDims: [ + { + id: "batching", + title: "Dynamic batching", + scope: "serve", + default: "off", + options: [ + { id: "off", label: "Default" }, + { id: "on", label: "2 requests / 100 ms" }, + ], + }, + ], + commandBuilder: { + defaultSelection: defaults, + resource: { + limits: { nodes: { min: 1, max: 1 }, gpus_per_node: { min: 1, max: 1 } }, + verifiedRecipes: ["cuda"].map((hw) => { + const s = { ...defaults, hw }; + const p = plan(s); + return { + ...s, + id: hw + "-documented", + gpus_per_node: p.gpus, + ...p.topology, + default: true, + unverified: true, + }; + }), + autoTopology: (s) => plan(s).topology, + validateTopology: (s, t) => { + const p = plan(s); + const errors = [...(p.errors || [])]; + if (!config.supportedHardware.includes(s.hw)) errors.push("Choose a listed hardware platform."); + if (Number(s.nodes) !== 1) errors.push("This recipe covers one node."); + const count = Number(s.gpus_per_node); + if (!Number.isInteger(count) || count < 1 || count > 1) + errors.push("Choose an integer GPU count within the documented limits."); + if (Number(s.gpus_per_node) !== p.gpus) errors.push("This recipe requires " + p.gpus + " GPUs / node."); + if (["tp_size", "ulysses_degree", "ring_degree"].some((key) => Number(t[key]) !== p.topology[key])) + errors.push("This topology is not a documented recipe for the selected model and hardware."); + return errors; + }, + }, + resolveDeployment: (s) => { + const p = plan(s); + const topology = + s.topology_mode === "manual" + ? { + tp_size: Number(s.tp_size), + ulysses_degree: Number(s.ulysses_degree), + ring_degree: Number(s.ring_degree), + } + : p.topology; + const errors = config.commandBuilder.resource.validateTopology(s, topology); + const status = errors.length ? "error" : "unverified"; + const flags = [...p.flags]; + if (!flags.some((flag) => flag.startsWith("--port "))) flags.push("--port {{PORT}}"); + const automaticSP = + flags.find((flag) => flag.startsWith("--sp-degree ")) && + !flags.some((flag) => flag.startsWith("--ulysses-degree")); + const summary = automaticSP + ? ["TP " + topology.tp_size, "SP " + topology.ulysses_degree + " (runtime-selected exchange)"] + : ["TP " + topology.tp_size, "Ulysses " + topology.ulysses_degree, "Ring " + topology.ring_degree]; + if (flags.includes("--enable-cfg-parallel")) summary.push("CFG 2"); + return { + match: { hw: s.hw }, + nnodes: 1, + verified: false, + flags, + env: p.env || [], + builder: { + topology, + topologySummary: p.summary || summary.join(" / "), + errors, + warnings: [ + ...(p.warnings || []), + "Documented recipe; this exact server and request combination has not been HTTP-verified.", + ], + verification: { serve: status, request: status }, + }, + }; + }, + }, + modelNames: { default: modelOf(defaults) }, + placeholders: { + PORT: { target: "command", label: "Server port", default: "30000" }, + CURL_HOST: { target: "curl", label: "Server host", default: "127.0.0.1" }, + CURL_PORT: { target: "curl", label: "Request port", default: "30000" }, + }, + curl: (s) => + [ + "curl -sS http://{{CURL_HOST}}:{{CURL_PORT}}/v1/images/generations", + "-H 'Content-Type: application/json'", + "-d '" + + JSON.stringify( + { + model: modelOf(s), + prompt: "A quiet lakeside cabin at sunrise", + n: 1, + response_format: "b64_json", + ...{ size: "2048x2048", guidance_scale: 4.0, num_inference_steps: 50, seed: 42 }, + }, + null, + 2, + ) + + "'", + ].join(" \\\n "), + runModes: ["python"], + showPlaygroundLink: false, + github: { cookbookModel: modelOf(defaults) }, + }; + return config; +})(); diff --git a/docs/src/snippets/configs/TongyiMAI/z-image-turbo.jsx b/docs/src/snippets/configs/TongyiMAI/z-image-turbo.jsx new file mode 100644 index 0000000000..6c68b494a9 --- /dev/null +++ b/docs/src/snippets/configs/TongyiMAI/z-image-turbo.jsx @@ -0,0 +1,134 @@ +export const config = (() => { + const modelOf = () => "Tongyi-MAI/Z-Image-Turbo"; + const plan = (s) => { + const flags = ["--model-path " + modelOf(s)]; + if (s.hw === "a2") flags.push("--num-gpus 1"); + else if (s.hw === "a3") flags.push("--tp-size 2", "--sp-degree 1", "--num-gpus 2"); + else if (s.hw !== "arc_b") flags.push("--ulysses-degree=1", "--ring-degree=1"); + return { + flags, + gpus: s.hw === "a3" ? 2 : 1, + topology: { tp_size: s.hw === "a3" ? 2 : 1, ulysses_degree: 1, ring_degree: 1 }, + }; + }; + const defaults = { + hw: "mi300x", + nodes: 1, + gpus_per_node: 1, + topology_mode: "auto", + tp_size: 1, + ulysses_degree: 1, + ring_degree: 1, + }; + const config = { + modelName: "Z-Image-Turbo", + supportedHardware: ["mi300x", "mi325x", "mi355x", "b200", "h200", "h100", "a2", "a3", "arc_b"], + hardware: [ + { id: "a2", label: "Ascend A2", vram: "", vendor: "npu" }, + { id: "a3", label: "Ascend A3", vram: "2 NPUs / card", vendor: "npu" }, + { id: "arc_b", label: "Intel BMG", vram: "", vendor: "intel" }, + ], + groupHardware: false, + matchDims: [], + overlayDims: [], + commandBuilder: { + defaultSelection: defaults, + resource: { + limits: { nodes: { min: 1, max: 1 }, gpus_per_node: { min: 1, max: 2 } }, + verifiedRecipes: ["mi300x", "mi325x", "mi355x", "b200", "h200", "h100", "a2", "a3", "arc_b"].map((hw) => { + const s = { ...defaults, hw }; + const p = plan(s); + return { + ...s, + id: hw + "-documented", + gpus_per_node: p.gpus, + ...p.topology, + default: true, + unverified: true, + }; + }), + autoTopology: (s) => plan(s).topology, + validateTopology: (s, t) => { + const p = plan(s); + const errors = [...(p.errors || [])]; + if (!config.supportedHardware.includes(s.hw)) errors.push("Choose a listed hardware platform."); + if (Number(s.nodes) !== 1) errors.push("This recipe covers one node."); + const count = Number(s.gpus_per_node); + if (!Number.isInteger(count) || count < 1 || count > 2) + errors.push("Choose an integer GPU count within the documented limits."); + if (Number(s.gpus_per_node) !== p.gpus) errors.push("This recipe requires " + p.gpus + " GPUs / node."); + if (["tp_size", "ulysses_degree", "ring_degree"].some((key) => Number(t[key]) !== p.topology[key])) + errors.push("This topology is not a documented recipe for the selected model and hardware."); + return errors; + }, + }, + resolveDeployment: (s) => { + const p = plan(s); + const topology = + s.topology_mode === "manual" + ? { + tp_size: Number(s.tp_size), + ulysses_degree: Number(s.ulysses_degree), + ring_degree: Number(s.ring_degree), + } + : p.topology; + const errors = config.commandBuilder.resource.validateTopology(s, topology); + const status = errors.length ? "error" : "unverified"; + const flags = [...p.flags]; + if (!flags.some((flag) => flag.startsWith("--port "))) flags.push("--port {{PORT}}"); + const automaticSP = + flags.find((flag) => flag.startsWith("--sp-degree ")) && + !flags.some((flag) => flag.startsWith("--ulysses-degree")); + const summary = automaticSP + ? ["TP " + topology.tp_size, "SP " + topology.ulysses_degree + " (runtime-selected exchange)"] + : ["TP " + topology.tp_size, "Ulysses " + topology.ulysses_degree, "Ring " + topology.ring_degree]; + if (flags.includes("--enable-cfg-parallel")) summary.push("CFG 2"); + return { + match: { hw: s.hw }, + nnodes: 1, + verified: false, + flags, + env: p.env || [], + builder: { + topology, + topologySummary: p.summary || summary.join(" / "), + errors, + warnings: [ + ...(p.warnings || []), + "Documented recipe; this exact server and request combination has not been HTTP-verified.", + ], + verification: { serve: status, request: status }, + }, + }; + }, + }, + modelNames: { default: modelOf(defaults) }, + placeholders: { + PORT: { target: "command", label: "Server port", default: "30000" }, + CURL_HOST: { target: "curl", label: "Server host", default: "127.0.0.1" }, + CURL_PORT: { target: "curl", label: "Request port", default: "30000" }, + }, + curl: (s) => + [ + "curl -sS http://{{CURL_HOST}}:{{CURL_PORT}}/v1/images/generations", + "-H 'Content-Type: application/json'", + "-d '" + + JSON.stringify( + { + model: modelOf(s), + prompt: "A quiet lakeside cabin at sunrise", + n: 1, + response_format: "b64_json", + ...{}, + }, + null, + 2, + ) + + "'", + ].join(" \\\n "), + runModes: ["python"], + showPlaygroundLink: false, + github: { cookbookModel: modelOf(defaults) }, + }; + return config; +})(); diff --git a/docs/src/snippets/configs/Wan/wan21.jsx b/docs/src/snippets/configs/Wan/wan21.jsx new file mode 100644 index 0000000000..5e1c14c9f2 --- /dev/null +++ b/docs/src/snippets/configs/Wan/wan21.jsx @@ -0,0 +1,200 @@ +export const config = (() => { + const modelOf = (s) => + ({ + "t2v-14b": "Wan-AI/Wan2.1-T2V-14B-Diffusers", + "t2v-1_3b": "Wan-AI/Wan2.1-T2V-1.3B-Diffusers", + "i2v-14b": "Wan-AI/Wan2.1-I2V-14B-720P-Diffusers", + })[s.variant]; + const plan = (s) => { + const small = !s.variant.endsWith("14b"); + const ascend = ["a2", "a3"].includes(s.hw); + const fast = ascend ? Number(s.gpus_per_node) === 8 : Number(s.gpus_per_node) > 1; + let gpus = 1, + tp = 1, + sp = 1; + const flags = ["--model-path " + modelOf(s)]; + if (ascend) { + if (small && s.hw === "a2" && !fast) flags.push("--num-gpus 1"); + else { + tp = small ? (fast ? 4 : 1) : 2; + sp = !small && fast ? 4 : 1; + gpus = fast ? 8 : s.hw === "a3" ? 2 : 4; + flags.push("--tp-size " + tp, "--sp-degree " + sp, "--num-gpus " + gpus); + } + if (fast) flags.push("--attention-backend laser_attn"); + } else { + flags.push("--dit-layerwise-offload true"); + if (fast) { + gpus = 4; + sp = 2; + flags.push("--num-gpus 4", "--ulysses-degree 2", "--enable-cfg-parallel"); + } + } + const lora = { + "t2v-14b": "NIVEDAN/wan2.1-lora", + "i2v-14b": "valiantcat/Wan2.1-Fight-LoRA", + }[s.variant]; + if (s.lora === s.variant && lora) flags.push("--lora-path " + lora); + return { + flags, + gpus, + topology: { tp_size: tp, ulysses_degree: sp, ring_degree: 1 }, + warnings: ascend ? ["Ascend recipes count NPU chips; one A3 card has two chips."] : [], + }; + }; + const defaults = { + hw: "b200", + nodes: 1, + gpus_per_node: 1, + topology_mode: "auto", + tp_size: 1, + ulysses_degree: 1, + ring_degree: 1, + variant: "t2v-14b", + lora: "t2v-14b", + }; + const config = { + modelName: "Wan2.1", + supportedHardware: ["b200", "b300", "h200", "h100", "mi300x", "mi325x", "mi355x", "a2", "a3"], + hardware: [ + { id: "a2", label: "Ascend A2", vram: "", vendor: "npu" }, + { id: "a3", label: "Ascend A3", vram: "2 NPUs / card", vendor: "npu" }, + ], + groupHardware: false, + matchDims: [], + overlayDims: [ + { + id: "variant", + title: "Checkpoint / task", + scope: "base", + default: "t2v-14b", + options: [ + { id: "t2v-14b", label: "T2V 14B" }, + { id: "t2v-1_3b", label: "T2V 1.3B" }, + { id: "i2v-14b", label: "I2V 14B" }, + ], + }, + { + id: "lora", + title: "LoRA", + scope: "serve", + default: "t2v-14b", + options: [ + { id: "none", label: "None" }, + { + id: "t2v-14b", + label: "NIVEDAN/wan2.1-lora", + showWhen: function anonymous(s) { + return s.variant === "t2v-14b"; + }, + }, + { + id: "i2v-14b", + label: "valiantcat/Wan2.1-Fight-LoRA", + showWhen: function anonymous(s) { + return s.variant === "i2v-14b"; + }, + }, + ], + }, + ], + commandBuilder: { + defaultSelection: defaults, + resource: { + limits: { nodes: { min: 1, max: 1 }, gpus_per_node: { min: 1, max: 8 } }, + verifiedRecipes: ["b200", "b300", "h200", "h100", "mi300x", "mi325x", "mi355x", "a2", "a3"].map((hw) => { + const s = { ...defaults, hw }; + const p = plan(s); + return { + ...s, + id: hw + "-documented", + gpus_per_node: p.gpus, + ...p.topology, + default: true, + unverified: true, + }; + }), + autoTopology: (s) => plan(s).topology, + validateTopology: (s, t) => { + const p = plan(s); + const errors = [...(p.errors || [])]; + if (!config.supportedHardware.includes(s.hw)) errors.push("Choose a listed hardware platform."); + if (Number(s.nodes) !== 1) errors.push("This recipe covers one node."); + const count = Number(s.gpus_per_node); + if (!Number.isInteger(count) || count < 1 || count > 8) + errors.push("Choose an integer GPU count within the documented limits."); + if (Number(s.gpus_per_node) !== p.gpus) errors.push("This recipe requires " + p.gpus + " GPUs / node."); + if (["tp_size", "ulysses_degree", "ring_degree"].some((key) => Number(t[key]) !== p.topology[key])) + errors.push("This topology is not a documented recipe for the selected model and hardware."); + return errors; + }, + }, + resolveDeployment: (s) => { + const p = plan(s); + const topology = + s.topology_mode === "manual" + ? { + tp_size: Number(s.tp_size), + ulysses_degree: Number(s.ulysses_degree), + ring_degree: Number(s.ring_degree), + } + : p.topology; + const errors = config.commandBuilder.resource.validateTopology(s, topology); + const status = errors.length ? "error" : "unverified"; + const flags = [...p.flags]; + if (!flags.some((flag) => flag.startsWith("--port "))) flags.push("--port {{PORT}}"); + const automaticSP = + flags.find((flag) => flag.startsWith("--sp-degree ")) && + !flags.some((flag) => flag.startsWith("--ulysses-degree")); + const summary = automaticSP + ? ["TP " + topology.tp_size, "SP " + topology.ulysses_degree + " (runtime-selected exchange)"] + : ["TP " + topology.tp_size, "Ulysses " + topology.ulysses_degree, "Ring " + topology.ring_degree]; + if (flags.includes("--enable-cfg-parallel")) summary.push("CFG 2"); + return { + match: { hw: s.hw }, + nnodes: 1, + verified: false, + flags, + env: p.env || [], + builder: { + topology, + topologySummary: p.summary || summary.join(" / "), + errors, + warnings: [ + ...(p.warnings || []), + "Documented recipe; this exact server and request combination has not been HTTP-verified.", + ], + verification: { serve: status, request: status }, + }, + }; + }, + }, + modelNames: { default: modelOf(defaults) }, + placeholders: { + PORT: { target: "command", label: "Server port", default: "30000" }, + CURL_HOST: { target: "curl", label: "Server host", default: "127.0.0.1" }, + CURL_PORT: { target: "curl", label: "Request port", default: "30000" }, + INPUT_IMAGE: { target: "curl", label: "Image path on the server", default: "/path/to/input.png" }, + }, + curl: (s) => + [ + "curl -sS http://{{CURL_HOST}}:{{CURL_PORT}}/v1/videos", + "-H 'Content-Type: application/json'", + "-d '" + + JSON.stringify( + { + model: modelOf(s), + prompt: "A quiet street at dusk", + ...(s.variant.startsWith("i2v") ? { input_reference: "{{INPUT_IMAGE}}" } : {}), + }, + null, + 2, + ) + + "'", + ].join(" \\\n "), + runModes: ["python"], + showPlaygroundLink: false, + github: { cookbookModel: modelOf(defaults) }, + }; + return config; +})(); diff --git a/docs/src/snippets/configs/Wan/wan22.jsx b/docs/src/snippets/configs/Wan/wan22.jsx new file mode 100644 index 0000000000..3018d03746 --- /dev/null +++ b/docs/src/snippets/configs/Wan/wan22.jsx @@ -0,0 +1,212 @@ +export const config = (() => { + const modelOf = (s) => + ({ + "t2v-14b": "Wan-AI/Wan2.2-T2V-A14B-Diffusers", + "i2v-14b": "Wan-AI/Wan2.2-I2V-A14B-Diffusers", + "ti2v-5b": "Wan-AI/Wan2.2-TI2V-5B-Diffusers", + })[s.variant]; + const plan = (s) => { + const small = !s.variant.endsWith("14b"); + const ascend = ["a2", "a3"].includes(s.hw); + const fast = ascend ? Number(s.gpus_per_node) === 8 : Number(s.gpus_per_node) > 1; + let gpus = 1, + tp = 1, + sp = 1; + const flags = ["--model-path " + modelOf(s)]; + if (ascend) { + if (small) { + gpus = fast ? 8 : s.hw === "a2" ? 1 : 2; + sp = gpus; + if (fast) flags.push("--sp-degree 8", "--num-gpus 8"); + else if (s.hw === "a2") flags.push("--num-gpus 1"); + else flags.push("--tp-size 1", "--sp-degree 2", "--num-gpus 2"); + } else { + tp = 2; + sp = fast ? 4 : 1; + gpus = fast ? 8 : s.hw === "a3" ? 2 : 4; + flags.push("--tp-size 2", "--sp-degree " + sp, "--num-gpus " + gpus); + } + if (fast) flags.push("--attention-backend laser_attn"); + } else { + flags.push("--dit-layerwise-offload true"); + if (fast) { + if (s.hw === "b300") { + gpus = 8; + tp = 2; + sp = 2; + flags.push("--tp-size 2", "--num-gpus 8", "--sp-degree 2", "--ulysses-degree 2", "--enable-cfg-parallel"); + } else { + gpus = 4; + sp = 2; + flags.push("--num-gpus 4", "--ulysses-degree 2", "--enable-cfg-parallel"); + } + } + } + const lora = { + "t2v-14b": "Cseti/wan2.2-14B-Arcane_Jinx-lora-v1", + "i2v-14b": "lightx2v/Wan2.2-Distill-Loras", + }[s.variant]; + if (s.lora === s.variant && lora) flags.push("--lora-path " + lora); + return { + flags, + gpus, + topology: { tp_size: tp, ulysses_degree: sp, ring_degree: 1 }, + warnings: ascend ? ["Ascend recipes count NPU chips; one A3 card has two chips."] : [], + }; + }; + const defaults = { + hw: "b200", + nodes: 1, + gpus_per_node: 1, + topology_mode: "auto", + tp_size: 1, + ulysses_degree: 1, + ring_degree: 1, + variant: "t2v-14b", + lora: "none", + }; + const config = { + modelName: "Wan2.2", + supportedHardware: ["b200", "b300", "h200", "mi300x", "mi325x", "mi355x", "a2", "a3"], + hardware: [ + { id: "a2", label: "Ascend A2", vram: "", vendor: "npu" }, + { id: "a3", label: "Ascend A3", vram: "2 NPUs / card", vendor: "npu" }, + ], + groupHardware: false, + matchDims: [], + overlayDims: [ + { + id: "variant", + title: "Checkpoint / task", + scope: "base", + default: "t2v-14b", + options: [ + { id: "t2v-14b", label: "T2V A14B" }, + { id: "i2v-14b", label: "I2V A14B" }, + { id: "ti2v-5b", label: "TI2V 5B" }, + ], + }, + { + id: "lora", + title: "LoRA", + scope: "serve", + default: "none", + options: [ + { id: "none", label: "None" }, + { + id: "t2v-14b", + label: "Cseti/wan2.2-14B-Arcane_Jinx-lora-v1", + showWhen: function anonymous(s) { + return s.variant === "t2v-14b"; + }, + }, + { + id: "i2v-14b", + label: "lightx2v/Wan2.2-Distill-Loras", + showWhen: function anonymous(s) { + return s.variant === "i2v-14b"; + }, + }, + ], + }, + ], + commandBuilder: { + defaultSelection: defaults, + resource: { + limits: { nodes: { min: 1, max: 1 }, gpus_per_node: { min: 1, max: 8 } }, + verifiedRecipes: ["b200", "b300", "h200", "mi300x", "mi325x", "mi355x", "a2", "a3"].map((hw) => { + const s = { ...defaults, hw }; + const p = plan(s); + return { + ...s, + id: hw + "-documented", + gpus_per_node: p.gpus, + ...p.topology, + default: true, + unverified: true, + }; + }), + autoTopology: (s) => plan(s).topology, + validateTopology: (s, t) => { + const p = plan(s); + const errors = [...(p.errors || [])]; + if (!config.supportedHardware.includes(s.hw)) errors.push("Choose a listed hardware platform."); + if (Number(s.nodes) !== 1) errors.push("This recipe covers one node."); + const count = Number(s.gpus_per_node); + if (!Number.isInteger(count) || count < 1 || count > 8) + errors.push("Choose an integer GPU count within the documented limits."); + if (Number(s.gpus_per_node) !== p.gpus) errors.push("This recipe requires " + p.gpus + " GPUs / node."); + if (["tp_size", "ulysses_degree", "ring_degree"].some((key) => Number(t[key]) !== p.topology[key])) + errors.push("This topology is not a documented recipe for the selected model and hardware."); + return errors; + }, + }, + resolveDeployment: (s) => { + const p = plan(s); + const topology = + s.topology_mode === "manual" + ? { + tp_size: Number(s.tp_size), + ulysses_degree: Number(s.ulysses_degree), + ring_degree: Number(s.ring_degree), + } + : p.topology; + const errors = config.commandBuilder.resource.validateTopology(s, topology); + const status = errors.length ? "error" : "unverified"; + const flags = [...p.flags]; + if (!flags.some((flag) => flag.startsWith("--port "))) flags.push("--port {{PORT}}"); + const automaticSP = + flags.find((flag) => flag.startsWith("--sp-degree ")) && + !flags.some((flag) => flag.startsWith("--ulysses-degree")); + const summary = automaticSP + ? ["TP " + topology.tp_size, "SP " + topology.ulysses_degree + " (runtime-selected exchange)"] + : ["TP " + topology.tp_size, "Ulysses " + topology.ulysses_degree, "Ring " + topology.ring_degree]; + if (flags.includes("--enable-cfg-parallel")) summary.push("CFG 2"); + return { + match: { hw: s.hw }, + nnodes: 1, + verified: false, + flags, + env: p.env || [], + builder: { + topology, + topologySummary: p.summary || summary.join(" / "), + errors, + warnings: [ + ...(p.warnings || []), + "Documented recipe; this exact server and request combination has not been HTTP-verified.", + ], + verification: { serve: status, request: status }, + }, + }; + }, + }, + modelNames: { default: modelOf(defaults) }, + placeholders: { + PORT: { target: "command", label: "Server port", default: "30000" }, + CURL_HOST: { target: "curl", label: "Server host", default: "127.0.0.1" }, + CURL_PORT: { target: "curl", label: "Request port", default: "30000" }, + INPUT_IMAGE: { target: "curl", label: "Image path on the server", default: "/path/to/input.png" }, + }, + curl: (s) => + [ + "curl -sS http://{{CURL_HOST}}:{{CURL_PORT}}/v1/videos", + "-H 'Content-Type: application/json'", + "-d '" + + JSON.stringify( + { + model: modelOf(s), + prompt: "A quiet street at dusk", + ...(s.variant.startsWith("i2v") ? { input_reference: "{{INPUT_IMAGE}}" } : {}), + }, + null, + 2, + ) + + "'", + ].join(" \\\n "), + runModes: ["python"], + showPlaygroundLink: false, + github: { cookbookModel: modelOf(defaults) }, + }; + return config; +})(); diff --git a/docs/src/snippets/configs/baidu/ernie-image.jsx b/docs/src/snippets/configs/baidu/ernie-image.jsx new file mode 100644 index 0000000000..4b7780cfa5 --- /dev/null +++ b/docs/src/snippets/configs/baidu/ernie-image.jsx @@ -0,0 +1,147 @@ +export const config = (() => { + const modelOf = (s) => + ({ + standard: "baidu/ERNIE-Image", + turbo: "baidu/ERNIE-Image-Turbo", + })[s.checkpoint || "standard"]; + const plan = (s) => { + const flags = ["--model-path " + modelOf(s), ...["--num-gpus 1", "--performance-mode auto", "--port {{PORT}}"]]; + let gpus = 1; + let t = { tp_size: 1, ulysses_degree: 1, ring_degree: 1 }; + const env = []; + const warnings = []; + const errors = []; + return { flags, gpus, topology: t, env, warnings, errors }; + }; + const defaults = { + hw: "cuda", + nodes: 1, + gpus_per_node: 1, + topology_mode: "auto", + tp_size: 1, + ulysses_degree: 1, + ring_degree: 1, + checkpoint: "standard", + }; + const config = { + modelName: "ERNIE-Image", + supportedHardware: ["cuda", "rocm"], + hardware: [ + { id: "cuda", label: "NVIDIA CUDA", vram: "", vendor: "nvidia" }, + { id: "rocm", label: "AMD ROCm", vram: "", vendor: "amd" }, + ], + groupHardware: false, + matchDims: [], + overlayDims: [ + { + id: "checkpoint", + title: "Checkpoint", + scope: "base", + default: "standard", + options: [ + { id: "standard", label: "ERNIE-Image" }, + { id: "turbo", label: "ERNIE-Image-Turbo" }, + ], + }, + ], + commandBuilder: { + defaultSelection: defaults, + resource: { + limits: { nodes: { min: 1, max: 1 }, gpus_per_node: { min: 1, max: 1 } }, + verifiedRecipes: ["cuda", "rocm"].map((hw) => { + const s = { ...defaults, hw }; + const p = plan(s); + return { + ...s, + id: hw + "-documented", + gpus_per_node: p.gpus, + ...p.topology, + default: true, + unverified: true, + }; + }), + autoTopology: (s) => plan(s).topology, + validateTopology: (s, t) => { + const p = plan(s); + const errors = [...(p.errors || [])]; + if (!config.supportedHardware.includes(s.hw)) errors.push("Choose a listed hardware platform."); + if (Number(s.nodes) !== 1) errors.push("This recipe covers one node."); + const count = Number(s.gpus_per_node); + if (!Number.isInteger(count) || count < 1 || count > 1) + errors.push("Choose an integer GPU count within the documented limits."); + if (Number(s.gpus_per_node) !== p.gpus) errors.push("This recipe requires " + p.gpus + " GPUs / node."); + if (["tp_size", "ulysses_degree", "ring_degree"].some((key) => Number(t[key]) !== p.topology[key])) + errors.push("This topology is not a documented recipe for the selected model and hardware."); + return errors; + }, + }, + resolveDeployment: (s) => { + const p = plan(s); + const topology = + s.topology_mode === "manual" + ? { + tp_size: Number(s.tp_size), + ulysses_degree: Number(s.ulysses_degree), + ring_degree: Number(s.ring_degree), + } + : p.topology; + const errors = config.commandBuilder.resource.validateTopology(s, topology); + const status = errors.length ? "error" : "unverified"; + const flags = [...p.flags]; + if (!flags.some((flag) => flag.startsWith("--port "))) flags.push("--port {{PORT}}"); + const automaticSP = + flags.find((flag) => flag.startsWith("--sp-degree ")) && + !flags.some((flag) => flag.startsWith("--ulysses-degree")); + const summary = automaticSP + ? ["TP " + topology.tp_size, "SP " + topology.ulysses_degree + " (runtime-selected exchange)"] + : ["TP " + topology.tp_size, "Ulysses " + topology.ulysses_degree, "Ring " + topology.ring_degree]; + if (flags.includes("--enable-cfg-parallel")) summary.push("CFG 2"); + return { + match: { hw: s.hw }, + nnodes: 1, + verified: false, + flags, + env: p.env || [], + builder: { + topology, + topologySummary: p.summary || summary.join(" / "), + errors, + warnings: [ + ...(p.warnings || []), + "Documented recipe; this exact server and request combination has not been HTTP-verified.", + ], + verification: { serve: status, request: status }, + }, + }; + }, + }, + modelNames: { default: modelOf(defaults) }, + placeholders: { + PORT: { target: "command", label: "Server port", default: "30010" }, + CURL_HOST: { target: "curl", label: "Server host", default: "127.0.0.1" }, + CURL_PORT: { target: "curl", label: "Request port", default: "30010" }, + }, + curl: (s) => + [ + "curl -sS http://{{CURL_HOST}}:{{CURL_PORT}}/v1/images/generations", + "-H 'Content-Type: application/json'", + "-d '" + + JSON.stringify( + { + model: modelOf(s), + prompt: "A quiet lakeside cabin at sunrise", + n: 1, + response_format: "b64_json", + ...{}, + }, + null, + 2, + ) + + "'", + ].join(" \\\n "), + runModes: ["python"], + showPlaygroundLink: false, + github: { cookbookModel: modelOf(defaults) }, + }; + return config; +})(); diff --git a/docs/src/snippets/configs/nvidia/cosmos3.jsx b/docs/src/snippets/configs/nvidia/cosmos3.jsx new file mode 100644 index 0000000000..0915e3595c --- /dev/null +++ b/docs/src/snippets/configs/nvidia/cosmos3.jsx @@ -0,0 +1,144 @@ +export const config = (() => { + const modelOf = (s) => + ({ + nano: "nvidia/Cosmos3-Nano", + super: "nvidia/Cosmos3-Super", + t2i: "nvidia/Cosmos3-Super-Text2Image", + i2v: "nvidia/Cosmos3-Super-Image2Video", + droid: "nvidia/Cosmos3-Nano-Policy-DROID", + edge: "nvidia/Cosmos3-Edge", + edge_droid: "nvidia/Cosmos3-Edge-Policy-DROID", + t2i4: "nvidia/Cosmos3-Super-Text2Image-4Step", + i2v4: "nvidia/Cosmos3-Super-Image2Video-4Step", + })[s.checkpoint || "nano"]; + const plan = (s) => { + const flags = ["--model-path " + modelOf(s), ...[]]; + let gpus = 1; + let t = { tp_size: 1, ulysses_degree: 1, ring_degree: 1 }; + const env = []; + const warnings = []; + const errors = []; + gpus = s.checkpoint.startsWith("super") || ["t2i", "i2v", "t2i4", "i2v4"].includes(s.checkpoint) ? 4 : 1; + t.ulysses_degree = gpus; + flags.push("--num-gpus " + gpus); + return { flags, gpus, topology: t, env, warnings, errors, summary: gpus + " GPUs / runtime auto parallelism" }; + }; + const defaults = { + hw: "cuda", + nodes: 1, + gpus_per_node: 1, + topology_mode: "auto", + tp_size: 1, + ulysses_degree: 1, + ring_degree: 1, + checkpoint: "nano", + }; + const config = { + modelName: "Cosmos3", + supportedHardware: ["cuda"], + hardware: [{ id: "cuda", label: "NVIDIA CUDA", vram: "", vendor: "nvidia" }], + groupHardware: false, + matchDims: [], + overlayDims: [ + { + id: "checkpoint", + title: "Checkpoint", + scope: "base", + default: "nano", + options: [ + { id: "nano", label: "Cosmos3-Nano" }, + { id: "super", label: "Cosmos3-Super" }, + { id: "t2i", label: "Cosmos3-Super-Text2Image" }, + { id: "i2v", label: "Cosmos3-Super-Image2Video" }, + { id: "droid", label: "Cosmos3-Nano-Policy-DROID" }, + { id: "edge", label: "Cosmos3-Edge" }, + { id: "edge_droid", label: "Cosmos3-Edge-Policy-DROID" }, + { id: "t2i4", label: "Cosmos3-Super-Text2Image-4Step" }, + { id: "i2v4", label: "Cosmos3-Super-Image2Video-4Step" }, + ], + }, + ], + commandBuilder: { + defaultSelection: defaults, + resource: { + limits: { nodes: { min: 1, max: 1 }, gpus_per_node: { min: 1, max: 4 } }, + verifiedRecipes: ["cuda"].map((hw) => { + const s = { ...defaults, hw }; + const p = plan(s); + return { + ...s, + id: hw + "-documented", + gpus_per_node: p.gpus, + ...p.topology, + default: true, + unverified: true, + }; + }), + autoTopology: (s) => plan(s).topology, + validateTopology: (s, t) => { + const p = plan(s); + const errors = [...(p.errors || [])]; + if (!config.supportedHardware.includes(s.hw)) errors.push("Choose a listed hardware platform."); + if (Number(s.nodes) !== 1) errors.push("This recipe covers one node."); + const count = Number(s.gpus_per_node); + if (!Number.isInteger(count) || count < 1 || count > 4) + errors.push("Choose an integer GPU count within the documented limits."); + if (Number(s.gpus_per_node) !== p.gpus) errors.push("This recipe requires " + p.gpus + " GPUs / node."); + if (["tp_size", "ulysses_degree", "ring_degree"].some((key) => Number(t[key]) !== p.topology[key])) + errors.push("This topology is not a documented recipe for the selected model and hardware."); + return errors; + }, + }, + resolveDeployment: (s) => { + const p = plan(s); + const topology = + s.topology_mode === "manual" + ? { + tp_size: Number(s.tp_size), + ulysses_degree: Number(s.ulysses_degree), + ring_degree: Number(s.ring_degree), + } + : p.topology; + const errors = config.commandBuilder.resource.validateTopology(s, topology); + const status = errors.length ? "error" : "unverified"; + const flags = [...p.flags]; + if (!flags.some((flag) => flag.startsWith("--port "))) flags.push("--port {{PORT}}"); + const automaticSP = + flags.find((flag) => flag.startsWith("--sp-degree ")) && + !flags.some((flag) => flag.startsWith("--ulysses-degree")); + const summary = automaticSP + ? ["TP " + topology.tp_size, "SP " + topology.ulysses_degree + " (runtime-selected exchange)"] + : ["TP " + topology.tp_size, "Ulysses " + topology.ulysses_degree, "Ring " + topology.ring_degree]; + if (flags.includes("--enable-cfg-parallel")) summary.push("CFG 2"); + return { + match: { hw: s.hw }, + nnodes: 1, + verified: false, + flags, + env: p.env || [], + builder: { + topology, + topologySummary: p.summary || summary.join(" / "), + errors, + warnings: [ + ...(p.warnings || []), + "Documented recipe; this exact server and request combination has not been HTTP-verified.", + ], + verification: { serve: status, request: status }, + }, + }; + }, + }, + modelNames: { default: modelOf(defaults) }, + placeholders: { + PORT: { target: "command", label: "Server port", default: "30000" }, + CURL_HOST: { target: "curl", label: "Server host", default: "127.0.0.1" }, + CURL_PORT: { target: "curl", label: "Request port", default: "30000" }, + }, + curl: "curl -sS http://{{CURL_HOST}}:{{CURL_PORT}}/v1/models", + runModes: ["python"], + showPlaygroundLink: false, + github: { cookbookModel: modelOf(defaults) }, + }; + return config; +})(); diff --git a/docs/src/snippets/configs/nvidia/longlive2.jsx b/docs/src/snippets/configs/nvidia/longlive2.jsx new file mode 100644 index 0000000000..3c488d05d4 --- /dev/null +++ b/docs/src/snippets/configs/nvidia/longlive2.jsx @@ -0,0 +1,134 @@ +export const config = (() => { + const modelOf = (s) => + ({ + default: "Rabinovich/LongLive-2.0-5B-Diffusers", + })[s.checkpoint || "default"]; + const plan = (s) => { + const flags = ["--model-path " + modelOf(s), ...[]]; + let gpus = 1; + let t = { tp_size: 1, ulysses_degree: 1, ring_degree: 1 }; + const env = []; + const warnings = []; + const errors = []; + if (s.placement === "offload") flags.push("--dit-cpu-offload", "--text-encoder-cpu-offload", "--vae-cpu-offload"); + return { flags, gpus, topology: t, env, warnings, errors }; + }; + const defaults = { + hw: "cuda", + nodes: 1, + gpus_per_node: 1, + topology_mode: "auto", + tp_size: 1, + ulysses_degree: 1, + ring_degree: 1, + placement: "auto", + }; + const config = { + modelName: "LongLive 2.0", + supportedHardware: ["cuda"], + hardware: [{ id: "cuda", label: "NVIDIA CUDA", vram: "", vendor: "nvidia" }], + groupHardware: false, + matchDims: [], + overlayDims: [ + { + id: "placement", + title: "Memory policy", + scope: "serve", + default: "auto", + options: [ + { id: "auto", label: "Auto" }, + { id: "offload", label: "Component offload" }, + ], + }, + ], + commandBuilder: { + defaultSelection: defaults, + resource: { + limits: { nodes: { min: 1, max: 1 }, gpus_per_node: { min: 1, max: 1 } }, + verifiedRecipes: ["cuda"].map((hw) => { + const s = { ...defaults, hw }; + const p = plan(s); + return { + ...s, + id: hw + "-documented", + gpus_per_node: p.gpus, + ...p.topology, + default: true, + unverified: true, + }; + }), + autoTopology: (s) => plan(s).topology, + validateTopology: (s, t) => { + const p = plan(s); + const errors = [...(p.errors || [])]; + if (!config.supportedHardware.includes(s.hw)) errors.push("Choose a listed hardware platform."); + if (Number(s.nodes) !== 1) errors.push("This recipe covers one node."); + const count = Number(s.gpus_per_node); + if (!Number.isInteger(count) || count < 1 || count > 1) + errors.push("Choose an integer GPU count within the documented limits."); + if (Number(s.gpus_per_node) !== p.gpus) errors.push("This recipe requires " + p.gpus + " GPUs / node."); + if (["tp_size", "ulysses_degree", "ring_degree"].some((key) => Number(t[key]) !== p.topology[key])) + errors.push("This topology is not a documented recipe for the selected model and hardware."); + return errors; + }, + }, + resolveDeployment: (s) => { + const p = plan(s); + const topology = + s.topology_mode === "manual" + ? { + tp_size: Number(s.tp_size), + ulysses_degree: Number(s.ulysses_degree), + ring_degree: Number(s.ring_degree), + } + : p.topology; + const errors = config.commandBuilder.resource.validateTopology(s, topology); + const status = errors.length ? "error" : "unverified"; + const flags = [...p.flags]; + if (!flags.some((flag) => flag.startsWith("--port "))) flags.push("--port {{PORT}}"); + const automaticSP = + flags.find((flag) => flag.startsWith("--sp-degree ")) && + !flags.some((flag) => flag.startsWith("--ulysses-degree")); + const summary = automaticSP + ? ["TP " + topology.tp_size, "SP " + topology.ulysses_degree + " (runtime-selected exchange)"] + : ["TP " + topology.tp_size, "Ulysses " + topology.ulysses_degree, "Ring " + topology.ring_degree]; + if (flags.includes("--enable-cfg-parallel")) summary.push("CFG 2"); + return { + match: { hw: s.hw }, + nnodes: 1, + verified: false, + flags, + env: p.env || [], + builder: { + topology, + topologySummary: p.summary || summary.join(" / "), + errors, + warnings: [ + ...(p.warnings || []), + "Documented recipe; this exact server and request combination has not been HTTP-verified.", + ], + verification: { serve: status, request: status }, + }, + }; + }, + }, + modelNames: { default: modelOf(defaults) }, + placeholders: { + PORT: { target: "command", label: "Server port", default: "30000" }, + CURL_HOST: { target: "curl", label: "Server host", default: "127.0.0.1" }, + CURL_PORT: { target: "curl", label: "Request port", default: "30000" }, + }, + curl: (s) => + [ + "curl -sS http://{{CURL_HOST}}:{{CURL_PORT}}/v1/videos", + "-H 'Content-Type: application/json'", + "-d '" + + JSON.stringify({ model: modelOf(s), prompt: "A quiet street at dusk", ...{ num_frames: 61 } }, null, 2) + + "'", + ].join(" \\\n "), + runModes: ["python"], + showPlaygroundLink: false, + github: { cookbookModel: modelOf(defaults) }, + }; + return config; +})(); diff --git a/docs/src/snippets/diffusion/flux-deployment.jsx b/docs/src/snippets/diffusion/flux-deployment.jsx deleted file mode 100644 index 2dac7cd370..0000000000 --- a/docs/src/snippets/diffusion/flux-deployment.jsx +++ /dev/null @@ -1,396 +0,0 @@ -export const FluxDeployment = () => { - const config = { - modelFamily: 'FLUX', - - options: { - hardware: { - name: 'hardware', - title: 'Hardware Platform', - items: [ - { id: 'b200', label: 'B200', default: true }, - { id: 'b300', label: 'B300', default: false }, - { id: 'h200', label: 'H200', default: false }, - { id: 'h100', label: 'H100', default: false }, - { id: 'mi355x', label: 'MI355X', default: false }, - { id: 'mi325x', label: 'MI325X', default: false }, - { id: 'mi300x', label: 'MI300X', default: false }, - { id: 'a2', label: 'A2 Series', default: false }, - { id: 'a3', label: 'A3 Series', default: false }, - { id: 'arc_b', label: 'BMG', default: false }, - ] - }, - version: { - name: 'version', - title: 'Model Version', - items: [ - { id: 'flux1-dev', label: 'FLUX.1-dev', subtitle: '12B', default: true }, - { id: 'flux2-dev', label: 'FLUX.2-dev', subtitle: '32B', default: false } - ] - } - }, - - modelConfigs: { - 'flux1-dev': { repoId: 'black-forest-labs/FLUX.1-dev' }, - 'flux2-dev': { repoId: 'black-forest-labs/FLUX.2-dev' } - }, - - generateCommand: function(values) { - const { hardware, version } = values; - const config = this.modelConfigs[version]; - - if (hardware === 'a2') { - if (version === 'flux1-dev') { - return `sglang serve \\ - --model-path ${config.repoId} \\ - --num-gpus 1`; - } - - return `sglang serve \\ - --model-path ${config.repoId} \\ - --tp-size 2 \\ - --num-gpus 2`; - } - - if (hardware === 'a3') { - return `#One A3 Series card has 2 npu chips -sglang serve \\ - --tp-size 2 \\ - --model-path ${config.repoId} \\ - --num-gpus 2`; - } - - if (hardware === 'arc_b') { - return `sglang serve \\ - --model-path ${config.repoId} \\ - --num-gpus 4 \\ - --tp-size 4 \\ - --component-residency dit=resident,text_encoder=layerwise-offload \\ - --dit-cpu-offload False`; - } - - return `sglang serve \\ - --model-path ${config.repoId} \\ - --ulysses-degree=1 \\ - --ring-degree=1`; - } - }; - - if (!config || !config.options) { - return
Error: Invalid configuration provided
; - } - - const getInitialState = () => { - const initialState = {}; - Object.entries(config.options).forEach(([key, option]) => { - if (option.type === 'checkbox') { - initialState[key] = (option.items || []) - .filter((item) => item.default) - .map((item) => item.id); - return; - } - - if (option.type === 'text') { - initialState[key] = option.default || ''; - return; - } - - let items = option.items || []; - if (option.getDynamicItems) { - const defaultValues = {}; - Object.entries(config.options).forEach(([innerKey, innerOption]) => { - if (innerOption.type === 'checkbox') { - defaultValues[innerKey] = (innerOption.items || []) - .filter((item) => item.default) - .map((item) => item.id); - } else if (innerOption.type === 'text') { - defaultValues[innerKey] = innerOption.default || ''; - } else if (innerOption.items && innerOption.items.length > 0) { - const defaultItem = innerOption.items.find((item) => item.default); - defaultValues[innerKey] = defaultItem ? defaultItem.id : innerOption.items[0].id; - } - }); - items = option.getDynamicItems(defaultValues); - } - - const defaultItem = items && items.find((item) => item.default); - initialState[key] = defaultItem ? defaultItem.id : items && items[0] ? items[0].id : ''; - }); - return initialState; - }; - - const [values, setValues] = useState(getInitialState); - const [isDark, setIsDark] = useState(false); - - useEffect(() => { - const checkDarkMode = () => { - const html = document.documentElement; - const isDarkMode = - html.classList.contains('dark') || - html.getAttribute('data-theme') === 'dark' || - html.style.colorScheme === 'dark'; - setIsDark(isDarkMode); - }; - - checkDarkMode(); - const observer = new MutationObserver(checkDarkMode); - observer.observe(document.documentElement, { - attributes: true, - attributeFilter: ['class', 'data-theme', 'style'], - }); - - return () => observer.disconnect(); - }, []); - - useEffect(() => { - const isAscend = values.hardware === 'a2' || values.hardware === 'a3'; - const targetTabName = isAscend ? 'Ascend A3 Series' : 'NVIDIA B200'; - - const allTabs = document.querySelectorAll('button, [role="tab"]'); - allTabs.forEach((tab) => { - const text = tab.textContent.trim(); - if (text === targetTabName && tab.getAttribute('aria-selected') !== 'true') { - tab.click(); - } - }); - }, [values.hardware]); - - const handleRadioChange = (optionName, value) => { - setValues((prev) => { - if (prev.hardware === 'arc_b' && optionName === 'version' && value === 'flux1-dev') { - return prev; - } - - const nextValues = { ...prev, [optionName]: value }; - if (optionName === 'hardware' && value === 'arc_b' && nextValues.version === 'flux1-dev') { - nextValues.version = 'flux2-dev'; - } - return nextValues; - }); - }; - - const handleCheckboxChange = (optionName, itemId, isChecked) => { - setValues((prev) => { - const currentValues = prev[optionName] || []; - if (isChecked) { - return { ...prev, [optionName]: [...currentValues, itemId] }; - } - return { - ...prev, - [optionName]: currentValues.filter((id) => id !== itemId), - }; - }); - }; - - const handleTextChange = (optionName, value) => { - setValues((prev) => ({ ...prev, [optionName]: value })); - }; - - const command = config.generateCommand ? config.generateCommand.call(config, values) : ''; - - const containerStyle = { - maxWidth: '900px', - margin: '0 auto', - display: 'flex', - flexDirection: 'column', - gap: '4px', - }; - const cardStyle = { - padding: '8px 12px', - border: `1px solid ${isDark ? '#374151' : '#e5e7eb'}`, - borderLeft: `3px solid ${isDark ? '#E85D4D' : '#D45D44'}`, - borderRadius: '4px', - display: 'flex', - alignItems: 'center', - gap: '12px', - background: isDark ? '#1f2937' : '#fff', - }; - const titleStyle = { - fontSize: '13px', - fontWeight: '600', - minWidth: '140px', - flexShrink: 0, - color: isDark ? '#e5e7eb' : 'inherit', - }; - const itemsStyle = { - display: 'flex', - rowGap: '2px', - columnGap: '6px', - flexWrap: 'wrap', - alignItems: 'center', - flex: 1, - }; - const labelBaseStyle = { - padding: '4px 10px', - border: `1px solid ${isDark ? '#9ca3af' : '#d1d5db'}`, - borderRadius: '3px', - cursor: 'pointer', - display: 'inline-flex', - flexDirection: 'column', - alignItems: 'center', - justifyContent: 'center', - fontWeight: '500', - fontSize: '13px', - transition: 'all 0.2s', - userSelect: 'none', - minWidth: '45px', - textAlign: 'center', - flex: 1, - background: isDark ? '#374151' : '#fff', - color: isDark ? '#e5e7eb' : 'inherit', - }; - const checkedStyle = { - background: '#D45D44', - color: 'white', - borderColor: '#D45D44', - }; - const disabledStyle = { - cursor: 'not-allowed', - opacity: 0.5, - }; - const subtitleStyle = { - display: 'block', - fontSize: '9px', - marginTop: '1px', - lineHeight: '1.1', - opacity: 0.7, - }; - const textInputStyle = { - flex: 1, - padding: '8px 10px', - borderRadius: '4px', - border: `1px solid ${isDark ? '#4b5563' : '#d1d5db'}`, - background: isDark ? '#111827' : '#fff', - color: isDark ? '#e5e7eb' : '#111827', - fontSize: '13px', - }; - const commandDisplayStyle = { - flex: 1, - padding: '12px 16px', - background: isDark ? '#111827' : '#f5f5f5', - borderRadius: '6px', - fontFamily: "'Menlo', 'Monaco', 'Courier New', monospace", - fontSize: '12px', - lineHeight: '1.5', - color: isDark ? '#e5e7eb' : '#374151', - whiteSpace: 'pre-wrap', - overflowX: 'auto', - margin: 0, - border: `1px solid ${isDark ? '#374151' : '#e5e7eb'}`, - }; - - return ( -
- {Object.entries(config.options).map(([key, option]) => { - if (option.condition && !option.condition(values)) { - return null; - } - - const items = option.getDynamicItems ? option.getDynamicItems(values) : option.items || []; - - return ( -
-
{option.title}
-
- {option.type === 'text' ? ( - handleTextChange(option.name, event.target.value)} - style={textInputStyle} - /> - ) : option.type === 'checkbox' ? ( - (option.items || []).map((item) => { - const isChecked = (values[option.name] || []).includes(item.id); - const isDisabled = - item.required || - (typeof item.disabledWhen === 'function' && item.disabledWhen(values)); - - return ( - - ); - }) - ) : ( - items.map((item) => { - const isChecked = values[option.name] === item.id; - const isArcBVersionLocked = - values.hardware === 'arc_b' && - option.name === 'version' && - item.id === 'flux1-dev'; - const isDisabled = Boolean(item.disabled || isArcBVersionLocked); - - return ( - - ); - }) - )} -
-
- ); - })} - -
-
Run this Command:
-
{command}
-
-
- ); -}; diff --git a/docs/src/snippets/diffusion/ltx-deployment.jsx b/docs/src/snippets/diffusion/ltx-deployment.jsx deleted file mode 100644 index 1b6d6ab012..0000000000 --- a/docs/src/snippets/diffusion/ltx-deployment.jsx +++ /dev/null @@ -1,244 +0,0 @@ -export const LTXDeployment = () => { - const options = { - hardware: { - name: 'hardware', - title: 'Deployment Target', - items: [ - { id: 'h200', label: '1x H200', subtitle: 'resident', default: true }, - { id: 'h200-2gpu', label: '2 GPUs', subtitle: 'CFG parallel', default: false }, - { id: 'h200-4gpu', label: '4 GPUs', subtitle: 'TP2 + CFG', default: false }, - { id: 'standard', label: 'Standard CUDA', subtitle: 'Original mode', default: false }, - { id: 'official', label: 'Official Match', subtitle: 'Original switching', default: false }, - ], - }, - model: { - name: 'model', - title: 'Model', - items: [ - { id: 'ltx23', label: 'LTX-2.3', default: true }, - { id: 'ltx2', label: 'LTX-2', default: false }, - ], - }, - pipeline: { - name: 'pipeline', - title: 'Pipeline', - items: [ - { id: 'two-stage', label: 'Two Stage', default: true, validModels: ['ltx2', 'ltx23'] }, - { id: 'two-stage-hq', label: 'Two Stage HQ', subtitle: 'High Quality', default: false, validModels: ['ltx23'] }, - { id: 'one-stage', label: 'One Stage', default: false, validModels: ['ltx2', 'ltx23'] }, - ], - }, - }; - - const modelConfigs = { - ltx2: { - repoId: 'Lightricks/LTX-2', - pipelines: { - 'one-stage': 'LTX2Pipeline', - 'two-stage': 'LTX2TwoStagePipeline', - }, - supportedLoras: [], - }, - ltx23: { - repoId: 'Lightricks/LTX-2.3', - pipelines: { - 'one-stage': 'LTX2Pipeline', - 'two-stage': 'LTX2TwoStagePipeline', - 'two-stage-hq': 'LTX2TwoStageHQPipeline', - }, - supportedLoras: [ - { - id: 'transition', - path: 'valiantcat/LTX-2.3-Transition-LORA', - weightName: 'ltx2.3-transition.safetensors', - validPipelines: ['two-stage', 'two-stage-hq'], - }, - ], - }, - }; - - const getInitialState = () => ({ - hardware: 'h200', - model: 'ltx23', - pipeline: 'two-stage', - selectedLoraPath: 'none', - }); - - const [values, setValues] = useState(getInitialState); - const [isDark, setIsDark] = useState(false); - - useEffect(() => { - const checkDarkMode = () => { - const html = document.documentElement; - const isDarkMode = html.classList.contains('dark') || - html.getAttribute('data-theme') === 'dark' || - html.style.colorScheme === 'dark'; - setIsDark(isDarkMode); - }; - checkDarkMode(); - const observer = new MutationObserver(checkDarkMode); - observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class', 'data-theme', 'style'] }); - return () => observer.disconnect(); - }, []); - - const availableLoras = (() => { - const config = modelConfigs[values.model]; - return (config?.supportedLoras || []).filter((lora) => lora.validPipelines.includes(values.pipeline)); - })(); - - const handleRadioChange = (optionName, itemId) => { - setValues((prev) => { - const next = { ...prev, [optionName]: itemId }; - - const validPipeline = options.pipeline.items.some((item) => ( - item.id === next.pipeline && item.validModels.includes(next.model) - )); - if (!validPipeline) { - next.pipeline = 'two-stage'; - } - - const config = modelConfigs[next.model]; - const nextSupported = (config?.supportedLoras || []).filter((lora) => lora.validPipelines.includes(next.pipeline)); - const isValid = nextSupported.some((lora) => lora.path === prev.selectedLoraPath); - if (!isValid) { - next.selectedLoraPath = 'none'; - } - return next; - }); - }; - - const handleLoraToggle = (path) => { - setValues((prev) => ({ - ...prev, - selectedLoraPath: prev.selectedLoraPath === path ? 'none' : path, - })); - }; - - const getDeviceMode = () => { - if (values.hardware.startsWith('h200')) { - return 'resident'; - } - if (values.hardware === 'official') { - return 'original'; - } - return 'original'; - }; - - const getParallelFlags = () => { - const parallelFlagsMap = { - 'h200-2gpu': ` \\\n --num-gpus 2 \\\n --enable-cfg-parallel`, - 'h200-4gpu': ` \\\n --num-gpus 4 \\\n --tp-size 2 \\\n --enable-cfg-parallel`, - }; - return parallelFlagsMap[values.hardware] || ''; - }; - - const generateCommand = () => { - const config = modelConfigs[values.model]; - const pipelineClass = config.pipelines[values.pipeline]; - if (!pipelineClass) { - return '# Error: Invalid configuration'; - } - - let command = `sglang serve \\\n --model-path ${config.repoId} \\\n --pipeline-class-name ${pipelineClass}`; - command += getParallelFlags(); - if (values.model === 'ltx23' && values.pipeline !== 'one-stage') { - command += ` \\\n --ltx2-two-stage-device-mode ${getDeviceMode()}`; - } - - const selectedLora = availableLoras.find((lora) => lora.path === values.selectedLoraPath); - if (selectedLora) { - command += ` \\\n --lora-path ${selectedLora.path} \\\n --lora-weight-name ${selectedLora.weightName}`; - } - - command += ` \\\n --port 30000`; - return command; - }; - - const containerStyle = { maxWidth: '900px', margin: '0 auto', display: 'flex', flexDirection: 'column', gap: '4px' }; - const cardStyle = { padding: '8px 12px', border: `1px solid ${isDark ? '#374151' : '#e5e7eb'}`, borderLeft: `3px solid ${isDark ? '#E85D4D' : '#D45D44'}`, borderRadius: '4px', display: 'flex', alignItems: 'center', gap: '12px', background: isDark ? '#1f2937' : '#fff' }; - const titleStyle = { fontSize: '13px', fontWeight: '600', minWidth: '140px', flexShrink: 0, color: isDark ? '#e5e7eb' : 'inherit' }; - const itemsStyle = { display: 'flex', rowGap: '2px', columnGap: '6px', flexWrap: 'wrap', alignItems: 'center', flex: 1 }; - const labelBaseStyle = { padding: '4px 10px', border: `1px solid ${isDark ? '#9ca3af' : '#d1d5db'}`, borderRadius: '3px', cursor: 'pointer', display: 'inline-flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', fontWeight: '500', fontSize: '13px', transition: 'all 0.2s', userSelect: 'none', minWidth: '45px', textAlign: 'center', flex: 1, background: isDark ? '#374151' : '#fff', color: isDark ? '#e5e7eb' : 'inherit' }; - const checkedStyle = { background: '#D45D44', color: 'white', borderColor: '#D45D44' }; - const subtitleStyle = { display: 'block', fontSize: '9px', marginTop: '1px', lineHeight: '1.1', opacity: 0.7 }; - const commandDisplayStyle = { flex: 1, padding: '12px 16px', background: isDark ? '#111827' : '#f5f5f5', borderRadius: '6px', fontFamily: "'Menlo', 'Monaco', 'Courier New', monospace", fontSize: '12px', lineHeight: '1.5', color: isDark ? '#e5e7eb' : '#374151', whiteSpace: 'pre-wrap', overflowX: 'auto', margin: 0, border: `1px solid ${isDark ? '#374151' : '#e5e7eb'}` }; - - return ( -
- {Object.entries(options).map(([key, option]) => { - const itemsToDisplay = key === 'pipeline' - ? option.items.filter((item) => item.validModels.includes(values.model)) - : option.items; - - return ( -
-
{option.title}
-
- {itemsToDisplay.map((item) => { - const isChecked = values[option.name] === item.id; - return ( - - ); - })} -
-
- ); - })} - -
-
Select LoRA Model
-
- {availableLoras.length === 0 && ( -
- No LoRA models available for this configuration. -
- )} - {availableLoras.map((lora) => { - const isSelected = values.selectedLoraPath === lora.path; - return ( - - ); - })} -
-
- -
-
Run this Command:
-
{generateCommand()}
-
-
- ); -}; diff --git a/docs/src/snippets/diffusion/ltx25-deployment.jsx b/docs/src/snippets/diffusion/ltx25-deployment.jsx deleted file mode 100644 index 8f182a48d1..0000000000 --- a/docs/src/snippets/diffusion/ltx25-deployment.jsx +++ /dev/null @@ -1,182 +0,0 @@ -export const LTX25Deployment = () => { - const options = { - hardware: { - name: 'hardware', - title: 'Deployment Target', - items: [ - { id: 'h200', label: '1x H200', subtitle: 'no extra flags', default: true }, - { id: 'tight', label: '1 GPU, tight VRAM', subtitle: 'layerwise offload', default: false }, - { id: 'sp2', label: '2 GPUs', subtitle: 'sequence parallel', default: false }, - { id: 'tp2', label: '2 GPUs', subtitle: 'tensor parallel', default: false }, - { id: 'cfg2', label: '2 GPUs', subtitle: 'CFG parallel', default: false }, - ], - }, - precision: { - name: 'precision', - title: 'Precision', - items: [ - { id: 'bf16', label: 'bf16', subtitle: 'default', default: true }, - { id: 'fp8', label: 'fp8', subtitle: 'online, -18 GB', default: false }, - ], - }, - weights: { - name: 'weights', - title: 'Weights', - items: [ - { id: 'distilled', label: 'Distilled', subtitle: '8 steps, unguided', default: true }, - { id: 'dev', label: 'Dev / SFT', subtitle: 'steps + CFG', default: false }, - ], - }, - pipeline: { - name: 'pipeline', - title: 'Pipeline', - items: [ - { id: 'one-stage', label: 'One Stage', subtitle: '960x544', default: true }, - { id: 'two-stage', label: 'Two Stage', subtitle: '1920x1088', default: false }, - ], - }, - decoder: { - name: 'decoder', - title: 'Decoder', - items: [ - { id: 'vae', label: 'VAE', subtitle: 'default, fast', default: true }, - { id: 'diffusion', label: 'Diffusion', subtitle: 'slower, more detail', default: false }, - ], - }, - duration: { - name: 'duration', - title: 'Clip Length', - items: [ - { id: 'fixed', label: 'Fixed', subtitle: '--num-frames', default: true }, - { id: 'auto', label: 'Auto', subtitle: 'duration head', default: false }, - ], - }, - }; - - const REPO_ID = 'Lightricks/LTX-2.5-Diffusers'; - const PIPELINE_CLASSES = { - 'one-stage': 'LTX2Pipeline', - 'two-stage': 'LTX2TwoStagePipeline', - }; - - const [values, setValues] = useState({ - hardware: 'h200', - precision: 'bf16', - weights: 'distilled', - pipeline: 'one-stage', - decoder: 'vae', - duration: 'fixed', - }); - const [isDark, setIsDark] = useState(false); - - useEffect(() => { - const checkDarkMode = () => { - const html = document.documentElement; - const isDarkMode = html.classList.contains('dark') || - html.getAttribute('data-theme') === 'dark' || - html.style.colorScheme === 'dark'; - setIsDark(isDarkMode); - }; - checkDarkMode(); - const observer = new MutationObserver(checkDarkMode); - observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class', 'data-theme', 'style'] }); - return () => observer.disconnect(); - }, []); - - const handleRadioChange = (key, id) => { - setValues((prev) => ({ ...prev, [key]: id })); - }; - - const getParallelFlags = () => { - const map = { - tight: ` \\\n --dit-layerwise-offload`, - sp2: ` \\\n --num-gpus 2 \\\n --ulysses-degree 2`, - tp2: ` \\\n --num-gpus 2 \\\n --tp-size 2`, - cfg2: ` \\\n --num-gpus 2 \\\n --enable-cfg-parallel`, - }; - return map[values.hardware] || ''; - }; - - const generateCommand = () => { - let command = `sglang serve \\\n --model-path ${REPO_ID}`; - command += ` \\\n --pipeline-class-name ${PIPELINE_CLASSES[values.pipeline]}`; - if (values.weights === 'dev') { - command += ` \\\n --model-variant dev`; - } - if (values.precision === 'fp8') { - command += ` \\\n --quantization fp8`; - } - command += getParallelFlags(); - command += ` \\\n --port 30000`; - - // The distilled DiT runs unguided, so there is no negative branch to split. - if (values.hardware === 'cfg2' && values.weights !== 'dev') { - command += `\n\n# Note: CFG parallel does nothing on the distilled weights (they run\n# unguided). Pick "Dev / SFT" above, or use sequence/tensor parallel.`; - } - - // Per-request flags belong on the generate call, not the server. - const requestFlags = []; - if (values.pipeline === 'two-stage') { - requestFlags.push('--height 1088 --width 1920'); - } - if (values.weights === 'dev') { - requestFlags.push('--num-inference-steps 30 --guidance-scale 3.0'); - } - if (values.duration === 'auto') { - requestFlags.push('--auto-duration'); - } - if (values.decoder === 'diffusion') { - requestFlags.push('--use-diffusion-decoder'); - } - if (requestFlags.length > 0) { - command += `\n\n# Per-request flags (pass these to \`sglang generate\`, or as request fields):\n# ${requestFlags.join(' ')}`; - } - return command; - }; - - const containerStyle = { maxWidth: '900px', margin: '0 auto', display: 'flex', flexDirection: 'column', gap: '4px' }; - const cardStyle = { padding: '8px 12px', border: `1px solid ${isDark ? '#374151' : '#e5e7eb'}`, borderLeft: `3px solid ${isDark ? '#E85D4D' : '#D45D44'}`, borderRadius: '4px', display: 'flex', alignItems: 'center', gap: '12px', background: isDark ? '#1f2937' : '#fff' }; - const titleStyle = { fontSize: '13px', fontWeight: '600', minWidth: '140px', flexShrink: 0, color: isDark ? '#e5e7eb' : 'inherit' }; - const itemsStyle = { display: 'flex', rowGap: '2px', columnGap: '6px', flexWrap: 'wrap', alignItems: 'center', flex: 1 }; - const labelBaseStyle = { padding: '4px 10px', border: `1px solid ${isDark ? '#9ca3af' : '#d1d5db'}`, borderRadius: '3px', cursor: 'pointer', display: 'inline-flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', fontWeight: '500', fontSize: '13px', transition: 'all 0.2s', userSelect: 'none', minWidth: '45px', textAlign: 'center', flex: 1, background: isDark ? '#374151' : '#fff', color: isDark ? '#e5e7eb' : 'inherit' }; - const checkedStyle = { background: '#D45D44', color: 'white', borderColor: '#D45D44' }; - const subtitleStyle = { display: 'block', fontSize: '9px', marginTop: '1px', lineHeight: '1.1', opacity: 0.7 }; - const commandDisplayStyle = { flex: 1, padding: '12px 16px', background: isDark ? '#111827' : '#f5f5f5', borderRadius: '6px', fontFamily: "'Menlo', 'Monaco', 'Courier New', monospace", fontSize: '12px', lineHeight: '1.5', color: isDark ? '#e5e7eb' : '#374151', whiteSpace: 'pre-wrap', overflowX: 'auto', margin: 0, border: `1px solid ${isDark ? '#374151' : '#e5e7eb'}` }; - - return ( -
- {Object.entries(options).map(([key, option]) => ( -
-
{option.title}
-
- {option.items.map((item) => { - const isChecked = values[option.name] === item.id; - return ( - - ); - })} -
-
- ))} - -
-
Run this Command:
-
{generateCommand()}
-
-
- ); -}; diff --git a/docs/src/snippets/diffusion/mova-deployment.jsx b/docs/src/snippets/diffusion/mova-deployment.jsx deleted file mode 100644 index aabd6284ea..0000000000 --- a/docs/src/snippets/diffusion/mova-deployment.jsx +++ /dev/null @@ -1,115 +0,0 @@ -export const MOVADeployment = () => { - // Config options - const options = { - hardware: { - name: 'hardware', - title: 'Hardware Platform', - items: [ - { id: 'b200', label: 'B200', default: true }, - { id: 'h200', label: 'H200', default: false }, - { id: 'h100', label: 'H100', default: false }, - { id: 'a100', label: 'A100', default: false } - ] - }, - resolution: { - name: 'resolution', - title: 'Resolution', - items: [ - { id: '360p', label: '360p', subtitle: 'Fast inference, lower VRAM', default: true }, - { id: '720p', label: '720p', subtitle: 'Higher resolution', default: false } - ] - } - }; - - // Initialize state - const getInitialState = () => { - const initialState = {}; - Object.entries(options).forEach(([key, option]) => { - const defaultItem = option.items.find(item => item.default); - initialState[key] = defaultItem ? defaultItem.id : option.items[0].id; - }); - return initialState; - }; - - const [values, setValues] = useState(getInitialState); - const [isDark, setIsDark] = useState(false); - - // Detect dark mode - useEffect(() => { - const checkDarkMode = () => { - const html = document.documentElement; - const isDarkMode = html.classList.contains('dark') || - html.getAttribute('data-theme') === 'dark' || - html.style.colorScheme === 'dark'; - setIsDark(isDarkMode); - }; - checkDarkMode(); - const observer = new MutationObserver(checkDarkMode); - observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class', 'data-theme', 'style'] }); - return () => observer.disconnect(); - }, []); - - const handleRadioChange = (optionName, value) => { - setValues(prev => ({ ...prev, [optionName]: value })); - }; - - // Generate command - const generateCommand = () => { - const { resolution } = values; - const modelPath = resolution === '720p' - ? 'OpenMOSS-Team/MOVA-720p' - : 'OpenMOSS-Team/MOVA-360p'; - - return `export SG_OUTPUT_DIR=/root/output_mova -mkdir -p "$SG_OUTPUT_DIR" - -sglang serve \\ - --model-path ${modelPath} \\ - --host 0.0.0.0 \\ - --port 30002 \\ - --adjust-frames false \\ - --num-gpus 8 \\ - --ring-degree 2 \\ - --ulysses-degree 4 \\ - --tp 1 \\ - --enable-torch-compile \\ - --save-output \\ - --output-dir "$SG_OUTPUT_DIR"`; - }; - - // Styles - with dark mode support - const containerStyle = { maxWidth: '900px', margin: '0 auto', display: 'flex', flexDirection: 'column', gap: '4px' }; - const cardStyle = { padding: '8px 12px', border: `1px solid ${isDark ? '#374151' : '#e5e7eb'}`, borderLeft: `3px solid ${isDark ? '#E85D4D' : '#D45D44'}`, borderRadius: '4px', display: 'flex', alignItems: 'center', gap: '12px', background: isDark ? '#1f2937' : '#fff' }; - const titleStyle = { fontSize: '13px', fontWeight: '600', minWidth: '140px', flexShrink: 0, color: isDark ? '#e5e7eb' : 'inherit' }; - const itemsStyle = { display: 'flex', rowGap: '2px', columnGap: '6px', flexWrap: 'wrap', alignItems: 'center', flex: 1 }; - const labelBaseStyle = { padding: '4px 10px', border: `1px solid ${isDark ? '#9ca3af' : '#d1d5db'}`, borderRadius: '3px', cursor: 'pointer', display: 'inline-flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', fontWeight: '500', fontSize: '13px', transition: 'all 0.2s', userSelect: 'none', minWidth: '45px', textAlign: 'center', flex: 1, background: isDark ? '#374151' : '#fff', color: isDark ? '#e5e7eb' : 'inherit' }; - const checkedStyle = { background: '#D45D44', color: 'white', borderColor: '#D45D44' }; - const subtitleStyle = { display: 'block', fontSize: '9px', marginTop: '1px', lineHeight: '1.1', opacity: 0.7 }; - const commandDisplayStyle = { flex: 1, padding: '12px 16px', background: isDark ? '#111827' : '#f5f5f5', borderRadius: '6px', fontFamily: "'Menlo', 'Monaco', 'Courier New', monospace", fontSize: '12px', lineHeight: '1.5', color: isDark ? '#e5e7eb' : '#374151', whiteSpace: 'pre-wrap', overflowX: 'auto', margin: 0, border: `1px solid ${isDark ? '#374151' : '#e5e7eb'}` }; - - return ( -
- {Object.entries(options).map(([key, option]) => ( -
-
{option.title}
-
- {option.items.map(item => { - const isChecked = values[option.name] === item.id; - return ( - - ); - })} -
-
- ))} -
-
Run this Command:
-
{generateCommand()}
-
-
- ); -}; diff --git a/docs/src/snippets/diffusion/qwen-image-deployment.jsx b/docs/src/snippets/diffusion/qwen-image-deployment.jsx deleted file mode 100644 index 2ced241284..0000000000 --- a/docs/src/snippets/diffusion/qwen-image-deployment.jsx +++ /dev/null @@ -1,385 +0,0 @@ -export const QwenImageDeployment = () => { - const config = { - modelFamily: 'Qwen-Image', - - options: { - hardware: { - name: 'hardware', - title: 'Hardware Platform', - items: [ - { id: 'b200', label: 'B200', default: true }, - { id: 'b300', label: 'B300', default: false }, - { id: 'h200', label: 'H200', default: false }, - { id: 'h100', label: 'H100', default: false }, - { id: 'mi300x', label: 'MI300X', default: false }, - { id: 'mi325x', label: 'MI325X', default: false }, - { id: 'mi355x', label: 'MI355X', default: false }, - { id: 'a2', label: 'A2 Series', default: false }, - { id: 'a3', label: 'A3 Series', default: false } - ] - }, - precision: { - name: 'precision', - title: 'Precision', - items: [ - { id: 'bf16', label: 'BF16', default: true }, - { - id: 'nvfp4', - label: 'NVFP4', - default: false, - disabledWhen: (values) => !['b200', 'b300'].includes(values.hardware), - disabledReason: 'ModelOpt NVFP4 requires Blackwell hardware such as B200 or B300' - } - ] - } - }, - - generateCommand: function(values) { - if (values.hardware === 'a2') { - return `sglang serve \\ - --model-path Qwen/Qwen-Image \\ - --num-gpus 1`; - } - - if (values.hardware === 'a3') { - return `#One A3 Series card has 2 npu chips -sglang serve \\ - --model-path Qwen/Qwen-Image \\ - --tp-size 1 \\ - --sp-degree 2 \\ - --num-gpus 2`; - } - - const isBlackwell = ['b200', 'b300'].includes(values.hardware); - const isNvfp4 = values.precision === 'nvfp4' && isBlackwell; - const modelPath = isNvfp4 - ? 'lmsys/qwen-image-2512-modelopt-nvfp4-sglang' - : 'Qwen/Qwen-Image'; - - return `sglang serve \\ - --model-path ${modelPath} \\ - --ulysses-degree=1 \\ - --ring-degree=1`; - } - }; - - if (!config || !config.options) { - return
Error: Invalid configuration provided
; - } - - const getInitialState = () => { - const initialState = {}; - Object.entries(config.options).forEach(([key, option]) => { - if (option.type === 'checkbox') { - initialState[key] = (option.items || []) - .filter((item) => item.default) - .map((item) => item.id); - return; - } - - if (option.type === 'text') { - initialState[key] = option.default || ''; - return; - } - - let items = option.items || []; - if (option.getDynamicItems) { - const defaultValues = {}; - Object.entries(config.options).forEach(([innerKey, innerOption]) => { - if (innerOption.type === 'checkbox') { - defaultValues[innerKey] = (innerOption.items || []) - .filter((item) => item.default) - .map((item) => item.id); - } else if (innerOption.type === 'text') { - defaultValues[innerKey] = innerOption.default || ''; - } else if (innerOption.items && innerOption.items.length > 0) { - const defaultItem = innerOption.items.find((item) => item.default); - defaultValues[innerKey] = defaultItem ? defaultItem.id : innerOption.items[0].id; - } - }); - items = option.getDynamicItems(defaultValues); - } - - const defaultItem = items && items.find((item) => item.default); - initialState[key] = defaultItem ? defaultItem.id : items && items[0] ? items[0].id : ''; - }); - return initialState; - }; - - const [values, setValues] = useState(getInitialState); - const [isDark, setIsDark] = useState(false); - - useEffect(() => { - const checkDarkMode = () => { - const html = document.documentElement; - const isDarkMode = - html.classList.contains('dark') || - html.getAttribute('data-theme') === 'dark' || - html.style.colorScheme === 'dark'; - setIsDark(isDarkMode); - }; - - checkDarkMode(); - const observer = new MutationObserver(checkDarkMode); - observer.observe(document.documentElement, { - attributes: true, - attributeFilter: ['class', 'data-theme', 'style'], - }); - - return () => observer.disconnect(); - }, []); - - useEffect(() => { - let targetTabName = 'AMD MI300X'; - if (values.hardware === 'a2') targetTabName = 'Ascend A2 Series'; - if (values.hardware === 'a3') targetTabName = 'Ascend A3 Series'; - - const allTabs = document.querySelectorAll('button, [role="tab"]'); - - allTabs.forEach((tab) => { - const text = tab.textContent.trim(); - - if (text === targetTabName && tab.getAttribute('aria-selected') !== 'true') { - tab.click(); - } - }); - }, [values.hardware]); - - const handleRadioChange = (optionName, value) => { - setValues((prev) => { - const next = { ...prev, [optionName]: value }; - if ( - optionName === 'hardware' && - !['b200', 'b300'].includes(value) && - next.precision === 'nvfp4' - ) { - next.precision = 'bf16'; - } - return next; - }); - }; - - const handleCheckboxChange = (optionName, itemId, isChecked) => { - setValues((prev) => { - const currentValues = prev[optionName] || []; - if (isChecked) { - return { ...prev, [optionName]: [...currentValues, itemId] }; - } - return { - ...prev, - [optionName]: currentValues.filter((id) => id !== itemId), - }; - }); - }; - - const handleTextChange = (optionName, value) => { - setValues((prev) => ({ ...prev, [optionName]: value })); - }; - - const command = config.generateCommand ? config.generateCommand.call(config, values) : ''; - - const containerStyle = { - maxWidth: '900px', - margin: '0 auto', - display: 'flex', - flexDirection: 'column', - gap: '4px', - }; - const cardStyle = { - padding: '8px 12px', - border: `1px solid ${isDark ? '#374151' : '#e5e7eb'}`, - borderLeft: `3px solid ${isDark ? '#E85D4D' : '#D45D44'}`, - borderRadius: '4px', - display: 'flex', - alignItems: 'center', - gap: '12px', - background: isDark ? '#1f2937' : '#fff', - }; - const titleStyle = { - fontSize: '13px', - fontWeight: '600', - minWidth: '140px', - flexShrink: 0, - color: isDark ? '#e5e7eb' : 'inherit', - }; - const itemsStyle = { - display: 'flex', - rowGap: '2px', - columnGap: '6px', - flexWrap: 'wrap', - alignItems: 'center', - flex: 1, - }; - const labelBaseStyle = { - padding: '4px 10px', - border: `1px solid ${isDark ? '#9ca3af' : '#d1d5db'}`, - borderRadius: '3px', - cursor: 'pointer', - display: 'inline-flex', - flexDirection: 'column', - alignItems: 'center', - justifyContent: 'center', - fontWeight: '500', - fontSize: '13px', - transition: 'all 0.2s', - userSelect: 'none', - minWidth: '45px', - textAlign: 'center', - flex: 1, - background: isDark ? '#374151' : '#fff', - color: isDark ? '#e5e7eb' : 'inherit', - }; - const checkedStyle = { - background: '#D45D44', - color: 'white', - borderColor: '#D45D44', - }; - const disabledStyle = { - cursor: 'not-allowed', - opacity: 0.5, - }; - const subtitleStyle = { - display: 'block', - fontSize: '9px', - marginTop: '1px', - lineHeight: '1.1', - opacity: 0.7, - }; - const textInputStyle = { - flex: 1, - padding: '8px 10px', - borderRadius: '4px', - border: `1px solid ${isDark ? '#4b5563' : '#d1d5db'}`, - background: isDark ? '#111827' : '#fff', - color: isDark ? '#e5e7eb' : '#111827', - fontSize: '13px', - }; - const commandDisplayStyle = { - flex: 1, - padding: '12px 16px', - background: isDark ? '#111827' : '#f5f5f5', - borderRadius: '6px', - fontFamily: "'Menlo', 'Monaco', 'Courier New', monospace", - fontSize: '12px', - lineHeight: '1.5', - color: isDark ? '#e5e7eb' : '#374151', - whiteSpace: 'pre-wrap', - overflowX: 'auto', - margin: 0, - border: `1px solid ${isDark ? '#374151' : '#e5e7eb'}`, - }; - - return ( -
- {Object.entries(config.options).map(([key, option]) => { - if (option.condition && !option.condition(values)) { - return null; - } - - const items = option.getDynamicItems ? option.getDynamicItems(values) : option.items || []; - - return ( -
-
{option.title}
-
- {option.type === 'text' ? ( - handleTextChange(option.name, event.target.value)} - style={textInputStyle} - /> - ) : option.type === 'checkbox' ? ( - (option.items || []).map((item) => { - const isChecked = (values[option.name] || []).includes(item.id); - const isDisabled = - item.required || - (typeof item.disabledWhen === 'function' && item.disabledWhen(values)); - - return ( - - ); - }) - ) : ( - items.map((item) => { - const isChecked = values[option.name] === item.id; - const isDisabled = - item.disabled || - (typeof item.disabledWhen === 'function' && item.disabledWhen(values)); - - return ( - - ); - }) - )} -
-
- ); - })} - -
-
Run this Command:
-
{command}
-
-
- ); -}; diff --git a/docs/src/snippets/diffusion/qwen-image-edit-deployment.jsx b/docs/src/snippets/diffusion/qwen-image-edit-deployment.jsx deleted file mode 100644 index 460c6e4832..0000000000 --- a/docs/src/snippets/diffusion/qwen-image-edit-deployment.jsx +++ /dev/null @@ -1,320 +0,0 @@ -export const QwenImageEditDeployment = () => { - const config = { - modelFamily: 'Qwen-Image-Edit', - - options: { - hardware: { - name: 'hardware', - title: 'Hardware Platform', - items: [ - { id: 'b200', label: 'B200', default: true }, - { id: 'b300', label: 'B300', default: false }, - { id: 'h200', label: 'H200', default: false }, - { id: 'h100', label: 'H100', default: false }, - { id: 'mi300x', label: 'MI300X', default: false }, - { id: 'mi325x', label: 'MI325X', default: false }, - { id: 'mi355x', label: 'MI355X', default: false } - ] - } - }, - - generateCommand: function(values) { - return `sglang serve \\ - --model-path Qwen/Qwen-Image-Edit-2511 \\ - --ulysses-degree=1 \\ - --ring-degree=1`; - } - }; - - if (!config || !config.options) { - return
Error: Invalid configuration provided
; - } - - const getInitialState = () => { - const initialState = {}; - Object.entries(config.options).forEach(([key, option]) => { - if (option.type === 'checkbox') { - initialState[key] = (option.items || []) - .filter((item) => item.default) - .map((item) => item.id); - return; - } - - if (option.type === 'text') { - initialState[key] = option.default || ''; - return; - } - - let items = option.items || []; - if (option.getDynamicItems) { - const defaultValues = {}; - Object.entries(config.options).forEach(([innerKey, innerOption]) => { - if (innerOption.type === 'checkbox') { - defaultValues[innerKey] = (innerOption.items || []) - .filter((item) => item.default) - .map((item) => item.id); - } else if (innerOption.type === 'text') { - defaultValues[innerKey] = innerOption.default || ''; - } else if (innerOption.items && innerOption.items.length > 0) { - const defaultItem = innerOption.items.find((item) => item.default); - defaultValues[innerKey] = defaultItem ? defaultItem.id : innerOption.items[0].id; - } - }); - items = option.getDynamicItems(defaultValues); - } - - const defaultItem = items && items.find((item) => item.default); - initialState[key] = defaultItem ? defaultItem.id : items && items[0] ? items[0].id : ''; - }); - return initialState; - }; - - const [values, setValues] = useState(getInitialState); - const [isDark, setIsDark] = useState(false); - - useEffect(() => { - const checkDarkMode = () => { - const html = document.documentElement; - const isDarkMode = - html.classList.contains('dark') || - html.getAttribute('data-theme') === 'dark' || - html.style.colorScheme === 'dark'; - setIsDark(isDarkMode); - }; - - checkDarkMode(); - const observer = new MutationObserver(checkDarkMode); - observer.observe(document.documentElement, { - attributes: true, - attributeFilter: ['class', 'data-theme', 'style'], - }); - - return () => observer.disconnect(); - }, []); - - const handleRadioChange = (optionName, value) => { - setValues((prev) => ({ ...prev, [optionName]: value })); - }; - - const handleCheckboxChange = (optionName, itemId, isChecked) => { - setValues((prev) => { - const currentValues = prev[optionName] || []; - if (isChecked) { - return { ...prev, [optionName]: [...currentValues, itemId] }; - } - return { - ...prev, - [optionName]: currentValues.filter((id) => id !== itemId), - }; - }); - }; - - const handleTextChange = (optionName, value) => { - setValues((prev) => ({ ...prev, [optionName]: value })); - }; - - const command = config.generateCommand ? config.generateCommand.call(config, values) : ''; - - const containerStyle = { - maxWidth: '900px', - margin: '0 auto', - display: 'flex', - flexDirection: 'column', - gap: '4px', - }; - const cardStyle = { - padding: '8px 12px', - border: `1px solid ${isDark ? '#374151' : '#e5e7eb'}`, - borderLeft: `3px solid ${isDark ? '#E85D4D' : '#D45D44'}`, - borderRadius: '4px', - display: 'flex', - alignItems: 'center', - gap: '12px', - background: isDark ? '#1f2937' : '#fff', - }; - const titleStyle = { - fontSize: '13px', - fontWeight: '600', - minWidth: '140px', - flexShrink: 0, - color: isDark ? '#e5e7eb' : 'inherit', - }; - const itemsStyle = { - display: 'flex', - rowGap: '2px', - columnGap: '6px', - flexWrap: 'wrap', - alignItems: 'center', - flex: 1, - }; - const labelBaseStyle = { - padding: '4px 10px', - border: `1px solid ${isDark ? '#9ca3af' : '#d1d5db'}`, - borderRadius: '3px', - cursor: 'pointer', - display: 'inline-flex', - flexDirection: 'column', - alignItems: 'center', - justifyContent: 'center', - fontWeight: '500', - fontSize: '13px', - transition: 'all 0.2s', - userSelect: 'none', - minWidth: '45px', - textAlign: 'center', - flex: 1, - background: isDark ? '#374151' : '#fff', - color: isDark ? '#e5e7eb' : 'inherit', - }; - const checkedStyle = { - background: '#D45D44', - color: 'white', - borderColor: '#D45D44', - }; - const disabledStyle = { - cursor: 'not-allowed', - opacity: 0.5, - }; - const subtitleStyle = { - display: 'block', - fontSize: '9px', - marginTop: '1px', - lineHeight: '1.1', - opacity: 0.7, - }; - const textInputStyle = { - flex: 1, - padding: '8px 10px', - borderRadius: '4px', - border: `1px solid ${isDark ? '#4b5563' : '#d1d5db'}`, - background: isDark ? '#111827' : '#fff', - color: isDark ? '#e5e7eb' : '#111827', - fontSize: '13px', - }; - const commandDisplayStyle = { - flex: 1, - padding: '12px 16px', - background: isDark ? '#111827' : '#f5f5f5', - borderRadius: '6px', - fontFamily: "'Menlo', 'Monaco', 'Courier New', monospace", - fontSize: '12px', - lineHeight: '1.5', - color: isDark ? '#e5e7eb' : '#374151', - whiteSpace: 'pre-wrap', - overflowX: 'auto', - margin: 0, - border: `1px solid ${isDark ? '#374151' : '#e5e7eb'}`, - }; - - return ( -
- {Object.entries(config.options).map(([key, option]) => { - if (option.condition && !option.condition(values)) { - return null; - } - - const items = option.getDynamicItems ? option.getDynamicItems(values) : option.items || []; - - return ( -
-
{option.title}
-
- {option.type === 'text' ? ( - handleTextChange(option.name, event.target.value)} - style={textInputStyle} - /> - ) : option.type === 'checkbox' ? ( - (option.items || []).map((item) => { - const isChecked = (values[option.name] || []).includes(item.id); - const isDisabled = - item.required || - (typeof item.disabledWhen === 'function' && item.disabledWhen(values)); - - return ( - - ); - }) - ) : ( - items.map((item) => { - const isChecked = values[option.name] === item.id; - const isDisabled = Boolean(item.disabled); - - return ( - - ); - }) - )} -
-
- ); - })} - -
-
Run this Command:
-
{command}
-
-
- ); -}; diff --git a/docs/src/snippets/diffusion/wan21-deployment.jsx b/docs/src/snippets/diffusion/wan21-deployment.jsx deleted file mode 100644 index f7e2f6e818..0000000000 --- a/docs/src/snippets/diffusion/wan21-deployment.jsx +++ /dev/null @@ -1,400 +0,0 @@ -export const Wan21Deployment = () => { - const MODELSIZE_DEFS = [ - { - id: '14b', - label: '14B', - subtitle: 'High-quality, 480P/720P', - default: true, - validTasks: ['t2v', 'i2v'], - }, - { - id: '1_3b', - label: '1.3B', - subtitle: 'Lightweight, 480P', - default: false, - validTasks: ['t2v'], - }, - ]; - - const modelConfigs = { - 't2v-14b': { - repoId: 'Wan-AI/Wan2.1-T2V-14B-Diffusers', - supportedLoras: [ - { id: 'general', label: 'General Wan2.1 LoRA', path: 'NIVEDAN/wan2.1-lora' }, - ], - }, - 't2v-1_3b': { - repoId: 'Wan-AI/Wan2.1-T2V-1.3B-Diffusers', - supportedLoras: [], - }, - 'i2v-14b': { - repoId: 'Wan-AI/Wan2.1-I2V-14B-720P-Diffusers', - supportedLoras: [ - { id: 'fight', label: 'Fight Style LoRA', path: 'valiantcat/Wan2.1-Fight-LoRA' }, - ], - }, - }; - - const options = { - hardware: { - name: 'hardware', - title: 'Hardware Platform', - items: [ - { id: 'b200', label: 'B200', default: true }, - { id: 'b300', label: 'B300', default: false }, - { id: 'h200', label: 'H200', default: false }, - { id: 'h100', label: 'H100', default: false }, - { id: 'mi300x', label: 'MI300X', default: false }, - { id: 'mi325x', label: 'MI325X', default: false }, - { id: 'mi355x', label: 'MI355X', default: false }, - { id: 'a2', label: 'A2 Series', default: false }, - { id: 'a3', label: 'A3 Series', default: false } - ], - }, - task: { - name: 'task', - title: 'Task Type', - items: [ - { id: 't2v', label: 'Text-to-Video (T2V)', default: true }, - { id: 'i2v', label: 'Image-to-Video (I2V)', default: false }, - ], - }, - modelsize: { - name: 'modelsize', - title: 'Model Variant', - items: MODELSIZE_DEFS.map(({ validTasks, ...rest }) => rest), - }, - bestPractice: { - name: 'bestPractice', - title: 'Optimization', - items: [ - { id: 'off', label: 'Standard', default: true }, - { id: 'on', label: 'Best Practice', default: false }, - ], - }, - }; - - function modelSizeItemsForTask(task) { - return MODELSIZE_DEFS.filter((item) => item.validTasks.includes(task)).map( - ({ validTasks, ...rest }) => rest - ); - } - - const getInitialState = () => { - const task = 't2v'; - const sizes = modelSizeItemsForTask(task); - const modelsize = sizes.find((size) => size.default)?.id || sizes[0].id; - const configKey = `${task}-${modelsize}`; - const supported = modelConfigs[configKey]?.supportedLoras || []; - return { - hardware: 'b200', - task, - modelsize, - bestPractice: 'off', - selectedLoraPath: supported[0]?.path ?? '', - }; - }; - - const [values, setValues] = useState(getInitialState); - const [isDark, setIsDark] = useState(false); - - useEffect(() => { - const checkDarkMode = () => { - const html = document.documentElement; - const isDarkMode = - html.classList.contains('dark') || - html.getAttribute('data-theme') === 'dark' || - html.style.colorScheme === 'dark'; - setIsDark(isDarkMode); - }; - checkDarkMode(); - const observer = new MutationObserver(checkDarkMode); - observer.observe(document.documentElement, { - attributes: true, - attributeFilter: ['class', 'data-theme', 'style'], - }); - return () => observer.disconnect(); - }, []); - - useEffect(() => { - const isAscend = values.hardware === 'a2' || values.hardware === 'a3'; - - const targetTabName = isAscend ? 'Ascend A3 Series' : 'NVIDIA B200'; - - const allTabs = document.querySelectorAll('button, [role="tab"]'); - - allTabs.forEach((tab) => { - const text = tab.textContent.trim(); - - if (text === targetTabName && tab.getAttribute('aria-selected') !== 'true') { - tab.click(); - } - }); - }, [values.hardware]); - - const handleRadioChange = (optionName, itemId) => { - setValues((prev) => { - let next = { ...prev, [optionName]: itemId }; - - if (optionName === 'task') { - const sizes = modelSizeItemsForTask(itemId); - if (!sizes.some((size) => size.id === next.modelsize)) { - next.modelsize = sizes.find((size) => size.default)?.id || sizes[0].id; - } - } - - if (optionName === 'task' || optionName === 'modelsize') { - const configKey = `${next.task}-${next.modelsize}`; - const supported = modelConfigs[configKey]?.supportedLoras || []; - if (supported.length === 0) { - next.selectedLoraPath = ''; - } else if ( - next.selectedLoraPath && - !supported.some((lora) => lora.path === next.selectedLoraPath) - ) { - next.selectedLoraPath = supported[0].path; - } - } - - return next; - }); - }; - - const handleLoraToggle = (path) => { - setValues((prev) => ({ - ...prev, - selectedLoraPath: prev.selectedLoraPath === path ? '' : path, - })); - }; - - const handleTextChange = (optionName, value) => { - setValues((prev) => ({ ...prev, [optionName]: value })); - }; - - const generateCommand = () => { - const { hardware, task, modelsize, selectedLoraPath, bestPractice } = values; - const configKey = `${task}-${modelsize}`; - const config = modelConfigs[configKey]; - - if (!config) { - return '# Error: Invalid configuration'; - } - - if (hardware === 'a2' || hardware === 'a3') { - const comment = hardware === 'a3' - ? '#One A3 Series card has 2 npu chips\n' - : ''; - const isBestPractice = bestPractice === 'on'; - let command; - - if (task === 't2v' && modelsize === '1_3b' && hardware === 'a2' && !isBestPractice) { - command = `${comment}sglang serve \\ - --model-path ${config.repoId} \\ - --num-gpus 1`; - } else { - const tpSize = modelsize === '1_3b' ? (isBestPractice ? 4 : 1) : 2; - const spDegree = modelsize === '14b' && isBestPractice ? 4 : 1; - const numGpus = isBestPractice ? 8 : (hardware === 'a3' ? 2 : 4); - - command = `${comment}sglang serve \\ - --model-path ${config.repoId} \\ - --tp-size ${tpSize} \\ - --sp-degree ${spDegree} \\ - --num-gpus ${numGpus}`; - } - - if (isBestPractice) { - command += ` \\\n --attention-backend laser_attn`; - } - - if ( - selectedLoraPath === 'NIVEDAN/wan2.1-lora' || - selectedLoraPath === 'valiantcat/Wan2.1-Fight-LoRA' - ) { - command += ` \\\n --lora-path ${selectedLoraPath}`; - } - - return command; - } - - let command = `sglang serve \\\n --model-path ${config.repoId} \\\n --dit-layerwise-offload true`; - - if (bestPractice === 'on') { - command += ` \\\n --num-gpus 4 \\\n --ulysses-degree 2 \\\n --enable-cfg-parallel`; - } - - if (selectedLoraPath) { - command += ` \\\n --lora-path ${selectedLoraPath}`; - } - - return command; - }; - - const modelSizeItems = modelSizeItemsForTask(values.task); - const loraConfigKey = `${values.task}-${values.modelsize}`; - const availableLoras = modelConfigs[loraConfigKey]?.supportedLoras || []; - const command = generateCommand(); - - const containerStyle = { - maxWidth: '900px', - margin: '0 auto', - display: 'flex', - flexDirection: 'column', - gap: '4px', - }; - const cardStyle = { - padding: '8px 12px', - border: `1px solid ${isDark ? '#374151' : '#e5e7eb'}`, - borderLeft: `3px solid ${isDark ? '#E85D4D' : '#D45D44'}`, - borderRadius: '4px', - display: 'flex', - alignItems: 'center', - gap: '12px', - background: isDark ? '#1f2937' : '#fff', - }; - const titleStyle = { - fontSize: '13px', - fontWeight: '600', - minWidth: '140px', - flexShrink: 0, - color: isDark ? '#e5e7eb' : 'inherit', - }; - const itemsStyle = { - display: 'flex', - rowGap: '2px', - columnGap: '6px', - flexWrap: 'wrap', - alignItems: 'center', - flex: 1, - }; - const labelBaseStyle = { - padding: '4px 10px', - border: `1px solid ${isDark ? '#9ca3af' : '#d1d5db'}`, - borderRadius: '3px', - cursor: 'pointer', - display: 'inline-flex', - flexDirection: 'column', - alignItems: 'center', - justifyContent: 'center', - fontWeight: '500', - fontSize: '13px', - transition: 'all 0.2s', - userSelect: 'none', - minWidth: '45px', - textAlign: 'center', - flex: 1, - background: isDark ? '#374151' : '#fff', - color: isDark ? '#e5e7eb' : 'inherit', - }; - const checkedStyle = { - background: '#D45D44', - color: 'white', - borderColor: '#D45D44', - }; - const disabledStyle = { - cursor: 'not-allowed', - opacity: 0.5, - }; - const subtitleStyle = { - display: 'block', - fontSize: '9px', - marginTop: '1px', - lineHeight: '1.1', - opacity: 0.7, - }; - const textInputStyle = { - flex: 1, - padding: '8px 10px', - borderRadius: '4px', - border: `1px solid ${isDark ? '#4b5563' : '#d1d5db'}`, - background: isDark ? '#111827' : '#fff', - color: isDark ? '#e5e7eb' : '#111827', - fontSize: '13px', - }; - const commandDisplayStyle = { - flex: 1, - padding: '12px 16px', - background: isDark ? '#111827' : '#f5f5f5', - borderRadius: '6px', - fontFamily: "'Menlo', 'Monaco', 'Courier New', monospace", - fontSize: '12px', - lineHeight: '1.5', - color: isDark ? '#e5e7eb' : '#374151', - whiteSpace: 'pre-wrap', - overflowX: 'auto', - margin: 0, - border: `1px solid ${isDark ? '#374151' : '#e5e7eb'}`, - }; - - return ( -
- {Object.entries(options).map(([key, option]) => ( -
-
{option.title}
-
- {(key === 'modelsize' ? modelSizeItems : option.items).map((item) => { - const isChecked = values[option.name] === item.id; - return ( - - ); - })} -
-
- ))} - - {availableLoras.length > 0 && ( -
-
Select LoRA Model (Only some of the supported LoRAs are listed here)
-
- {availableLoras.map((lora) => { - const isChecked = values.selectedLoraPath === lora.path; - return ( - - ); - })} -
-
- )} - -
-
Run this Command:
-
{command}
-
-
- ); -}; diff --git a/docs/src/snippets/diffusion/wan22-deployment.jsx b/docs/src/snippets/diffusion/wan22-deployment.jsx deleted file mode 100644 index 4eefd681bd..0000000000 --- a/docs/src/snippets/diffusion/wan22-deployment.jsx +++ /dev/null @@ -1,289 +0,0 @@ - - export const Wan22Deployment = () => { - const options = { - hardware: { - name: 'hardware', - title: 'Hardware Platform', - items: [ - { id: 'b200', label: 'B200', default: true }, - { id: 'b300', label: 'B300', default: false }, - { id: 'h200', label: 'H200', default: false }, - { id: 'mi300x', label: 'MI300X', default: false }, - { id: 'mi325x', label: 'MI325X', default: false }, - { id: 'mi355x', label: 'MI355X', default: false }, - { id: 'a2', label: 'A2 Series', default: false }, - { id: 'a3', label: 'A3 Series', default: false } - ], - }, - task: { - name: 'task', - title: 'Task Type', - items: [ - { id: 'i2v', label: 'Image-to-Video (I2V)', default: false }, - { id: 't2v', label: 'Text-to-Video (T2V)', default: true }, - { id: 'ti2v', label: 'Text/Image-to-Video (TI2V)', default: false }, - ], - }, - modelsize: { - name: 'modelsize', - title: 'Model Size', - items: [ - { id: '14b', label: 'A14B', subtitle: 'Diffusers (A14B)', default: true, validTasks: ['i2v', 't2v'] }, - { id: '5b', label: '5B', subtitle: 'Diffusers', default: false, validTasks: ['ti2v'] }, - ], - }, - bestPractice: { - name: 'bestPractice', - title: 'Optimization', - items: [ - { id: 'off', label: 'Standard', default: true }, - { id: 'on', label: 'Best Practice', default: false }, - ], - }, - }; - - const modelConfigs = { - 'i2v-14b': { - repoId: 'Wan-AI/Wan2.2-I2V-A14B-Diffusers', - supportedLoras: [{ id: 'distill', path: 'lightx2v/Wan2.2-Distill-Loras' }], - }, - 't2v-14b': { - repoId: 'Wan-AI/Wan2.2-T2V-A14B-Diffusers', - supportedLoras: [{ id: 'arcane', path: 'Cseti/wan2.2-14B-Arcane_Jinx-lora-v1' }], - }, - 'ti2v-5b': { - repoId: 'Wan-AI/Wan2.2-TI2V-5B-Diffusers', - supportedLoras: [], - }, - }; - - const getInitialState = () => ({ - hardware: 'b200', - task: 't2v', - modelsize: '14b', - bestPractice: 'off', - selectedLoraPath: 'none', - }); - - const [values, setValues] = useState(getInitialState); - const [isDark, setIsDark] = useState(false); - - useEffect(() => { - const checkDarkMode = () => { - const html = document.documentElement; - const isDarkMode = html.classList.contains('dark') || - html.getAttribute('data-theme') === 'dark' || - html.style.colorScheme === 'dark'; - setIsDark(isDarkMode); - }; - checkDarkMode(); - const observer = new MutationObserver(checkDarkMode); - observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class', 'data-theme', 'style'] }); - return () => observer.disconnect(); - }, []); - - const availableLoras = (() => { - const configKey = `${values.task}-${values.modelsize}`; - return modelConfigs[configKey]?.supportedLoras || []; - })(); - - useEffect(() => { - const isAscend = values.hardware === 'a2' || values.hardware === 'a3'; - - const targetTabName = isAscend ? 'Ascend A3 Series' : 'NVIDIA B200'; - - const allTabs = document.querySelectorAll('button, [role="tab"]'); - - allTabs.forEach((tab) => { - const text = tab.textContent.trim(); - - if (text === targetTabName && tab.getAttribute('aria-selected') !== 'true') { - tab.click(); - } - }); - }, [values.hardware]); - - const handleRadioChange = (optionName, itemId) => { - setValues((prev) => { - const next = { ...prev, [optionName]: itemId }; - if (optionName === 'task') { - next.modelsize = itemId === 'ti2v' ? '5b' : '14b'; - } - - const configKey = `${next.task}-${next.modelsize}`; - const nextSupported = modelConfigs[configKey]?.supportedLoras || []; - const isValid = nextSupported.some((lora) => lora.path === prev.selectedLoraPath); - if (!isValid) { - next.selectedLoraPath = 'none'; - } - return next; - }); - }; - - const handleLoraToggle = (path) => { - setValues((prev) => ({ - ...prev, - selectedLoraPath: prev.selectedLoraPath === path ? 'none' : path, - })); - }; - - const generateCommand = () => { - const { hardware, task, modelsize, selectedLoraPath, bestPractice } = values; - const configKey = `${task}-${modelsize}`; - const config = modelConfigs[configKey]; - if (!config) { - return '# Error: Invalid configuration'; - } - - - if (hardware === 'a2' || hardware === 'a3') { - const comment = hardware === 'a3' - ? '#One A3 Series card has 2 npu chips\n' - : ''; - const isBestPractice = bestPractice === 'on'; - let command; - - if (task === 'ti2v') { - if (isBestPractice) { - command = `${comment}sglang serve \\ - --model-path ${config.repoId} \\ - --sp-degree 8 \\ - --num-gpus 8`; - } else if (hardware === 'a2') { - command = `${comment}sglang serve \\ - --model-path ${config.repoId} \\ - --num-gpus 1`; - } else { - command = `${comment}sglang serve \\ - --model-path ${config.repoId} \\ - --tp-size 1 \\ - --sp-degree 2 \\ - --num-gpus 2`; - } - } else { - const spDegree = isBestPractice ? 4 : 1; - const numGpus = isBestPractice ? 8 : (hardware === 'a3' ? 2 : 4); - - command = `${comment}sglang serve \\ - --model-path ${config.repoId} \\ - --tp-size 2 \\ - --sp-degree ${spDegree} \\ - --num-gpus ${numGpus}`; - } - - if (isBestPractice) { - command += ` \\\n --attention-backend laser_attn`; - } - - if ( - selectedLoraPath === 'lightx2v/Wan2.2-Distill-Loras' || - selectedLoraPath === 'Cseti/wan2.2-14B-Arcane_Jinx-lora-v1' - ) { - command += ` \\\n --lora-path ${selectedLoraPath}`; - } - - return command; - } - - let command = `sglang serve \\\n --model-path ${config.repoId} \\\n --dit-layerwise-offload true`; - if (bestPractice === 'on') { - if (hardware === 'b300') { - command += ` \\\n --tp-size 2 \\\n --num-gpus 8 \\\n --sp-degree 2 \\\n --ulysses-degree 2 \\\n --enable-cfg-parallel`; - } else { - command += ` \\\n --num-gpus 4 \\\n --ulysses-degree 2 \\\n --enable-cfg-parallel`; - } - } - if (selectedLoraPath && selectedLoraPath !== 'none') { - command += ` \\\n --lora-path ${selectedLoraPath}`; - } - return command; - }; - -const containerStyle = { maxWidth: '900px', margin: '0 auto', display: 'flex', flexDirection: 'column', gap: '4px' }; -const cardStyle = { padding: '8px 12px', border: `1px solid ${isDark ? '#374151' : '#e5e7eb'}`, borderLeft: `3px solid ${isDark ? '#E85D4D' : '#D45D44'}`, borderRadius: '4px', display: 'flex', alignItems: 'center', gap: '12px', background: isDark ? '#1f2937' : '#fff' }; -const titleStyle = { fontSize: '13px', fontWeight: '600', minWidth: '140px', flexShrink: 0, color: isDark ? '#e5e7eb' : 'inherit' }; -const itemsStyle = { display: 'flex', rowGap: '2px', columnGap: '6px', flexWrap: 'wrap', alignItems: 'center', flex: 1 }; -const labelBaseStyle = { padding: '4px 10px', border: `1px solid ${isDark ? '#9ca3af' : '#d1d5db'}`, borderRadius: '3px', cursor: 'pointer', display: 'inline-flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', fontWeight: '500', fontSize: '13px', transition: 'all 0.2s', userSelect: 'none', minWidth: '45px', textAlign: 'center', flex: 1, background: isDark ? '#374151' : '#fff', color: isDark ? '#e5e7eb' : 'inherit' }; -const checkedStyle = { background: '#D45D44', color: 'white', borderColor: '#D45D44' }; -const subtitleStyle = { display: 'block', fontSize: '9px', marginTop: '1px', lineHeight: '1.1', opacity: 0.7 }; -const commandDisplayStyle = { flex: 1, padding: '12px 16px', background: isDark ? '#111827' : '#f5f5f5', borderRadius: '6px', fontFamily: "'Menlo', 'Monaco', 'Courier New', monospace", fontSize: '12px', lineHeight: '1.5', color: isDark ? '#e5e7eb' : '#374151', whiteSpace: 'pre-wrap', overflowX: 'auto', margin: 0, border: `1px solid ${isDark ? '#374151' : '#e5e7eb'}` }; - - return ( -
- {Object.entries(options).map(([key, option]) => { - const itemsToDisplay = key === 'modelsize' - ? option.items.filter((item) => item.validTasks.includes(values.task)) - : option.items; - - return ( -
-
{option.title}
-
- {itemsToDisplay.map((item) => { - const isChecked = values[option.name] === item.id; - return ( - - ); - })} -
-
- ); - })} - -
-
Select LoRA Model (Only some of the supported LoRAs are listed here)
-
- {availableLoras.length === 0 && ( -
- No LoRA models available for this model. -
- )} - {availableLoras.map((lora) => { - const isSelected = values.selectedLoraPath === lora.path; - return ( - - ); - })} -
-
- -
-
Run this Command:
-
{generateCommand()}
-
-
- ); - }; diff --git a/docs/src/snippets/diffusion/zimage-turbo-deployment.jsx b/docs/src/snippets/diffusion/zimage-turbo-deployment.jsx deleted file mode 100644 index f1b09ea57f..0000000000 --- a/docs/src/snippets/diffusion/zimage-turbo-deployment.jsx +++ /dev/null @@ -1,357 +0,0 @@ -export const ZImageTurboDeployment = () => { - const config = { - modelFamily: 'Z-Image-Turbo', - - options: { - hardware: { - name: 'hardware', - title: 'Hardware Platform', - items: [ - { id: 'mi300x', label: 'MI300X', default: true }, - { id: 'mi325x', label: 'MI325X', default: false }, - { id: 'mi355x', label: 'MI355X', default: false }, - { id: 'b200', label: 'B200', default: true }, - { id: 'h200', label: 'H200', default: false }, - { id: 'h100', label: 'H100', default: false }, - { id: 'a2', label: 'A2 Series', default: false }, - { id: 'a3', label: 'A3 Series', default: false }, - { id: 'arc_b', label: 'BMG', default: false } - ] - } - }, - - generateCommand: function(values) { - const { hardware } = values; - - if (hardware === 'a2') { - return `sglang serve \\ - --model-path Tongyi-MAI/Z-Image-Turbo \\ - --num-gpus 1`; - } - - if (hardware === 'a3') { - return `#One A3 Series card has 2 npu chips -sglang serve \\ - --model-path Tongyi-MAI/Z-Image-Turbo \\ - --tp-size 2 \\ - --sp-degree 1 \\ - --num-gpus 2`; - } - - if (hardware === 'arc_b') { - return `sglang serve \\ - --model-path Tongyi-MAI/Z-Image-Turbo`; - } - - return `sglang serve \\ - --model-path Tongyi-MAI/Z-Image-Turbo \\ - --ulysses-degree=1 \\ - --ring-degree=1`; - } - }; - - if (!config || !config.options) { - return
Error: Invalid configuration provided
; - } - - const getInitialState = () => { - const initialState = {}; - Object.entries(config.options).forEach(([key, option]) => { - if (option.type === 'checkbox') { - initialState[key] = (option.items || []) - .filter((item) => item.default) - .map((item) => item.id); - return; - } - - if (option.type === 'text') { - initialState[key] = option.default || ''; - return; - } - - let items = option.items || []; - if (option.getDynamicItems) { - const defaultValues = {}; - Object.entries(config.options).forEach(([innerKey, innerOption]) => { - if (innerOption.type === 'checkbox') { - defaultValues[innerKey] = (innerOption.items || []) - .filter((item) => item.default) - .map((item) => item.id); - } else if (innerOption.type === 'text') { - defaultValues[innerKey] = innerOption.default || ''; - } else if (innerOption.items && innerOption.items.length > 0) { - const defaultItem = innerOption.items.find((item) => item.default); - defaultValues[innerKey] = defaultItem ? defaultItem.id : innerOption.items[0].id; - } - }); - items = option.getDynamicItems(defaultValues); - } - - const defaultItem = items && items.find((item) => item.default); - initialState[key] = defaultItem ? defaultItem.id : items && items[0] ? items[0].id : ''; - }); - return initialState; - }; - - const [values, setValues] = useState(getInitialState); - const [isDark, setIsDark] = useState(false); - - useEffect(() => { - const checkDarkMode = () => { - const html = document.documentElement; - const isDarkMode = - html.classList.contains('dark') || - html.getAttribute('data-theme') === 'dark' || - html.style.colorScheme === 'dark'; - setIsDark(isDarkMode); - }; - - checkDarkMode(); - const observer = new MutationObserver(checkDarkMode); - observer.observe(document.documentElement, { - attributes: true, - attributeFilter: ['class', 'data-theme', 'style'], - }); - - return () => observer.disconnect(); - }, []); - - useEffect(() => { - const isAscend = values.hardware === 'a2' || values.hardware === 'a3'; - const targetTabName = isAscend ? 'Ascend A2/A3 Series' : 'AMD MI300X'; - - const allTabs = document.querySelectorAll('button, [role="tab"]'); - allTabs.forEach((tab) => { - const text = tab.textContent.trim(); - if (text === targetTabName && tab.getAttribute('aria-selected') !== 'true') { - tab.click(); - } - }); - }, [values.hardware]); - - const handleRadioChange = (optionName, value) => { - setValues((prev) => ({ ...prev, [optionName]: value })); - }; - - const handleCheckboxChange = (optionName, itemId, isChecked) => { - setValues((prev) => { - const currentValues = prev[optionName] || []; - if (isChecked) { - return { ...prev, [optionName]: [...currentValues, itemId] }; - } - return { - ...prev, - [optionName]: currentValues.filter((id) => id !== itemId), - }; - }); - }; - - const handleTextChange = (optionName, value) => { - setValues((prev) => ({ ...prev, [optionName]: value })); - }; - - const command = config.generateCommand ? config.generateCommand.call(config, values) : ''; - - const containerStyle = { - maxWidth: '900px', - margin: '0 auto', - display: 'flex', - flexDirection: 'column', - gap: '4px', - }; - const cardStyle = { - padding: '8px 12px', - border: `1px solid ${isDark ? '#374151' : '#e5e7eb'}`, - borderLeft: `3px solid ${isDark ? '#E85D4D' : '#D45D44'}`, - borderRadius: '4px', - display: 'flex', - alignItems: 'center', - gap: '12px', - background: isDark ? '#1f2937' : '#fff', - }; - const titleStyle = { - fontSize: '13px', - fontWeight: '600', - minWidth: '140px', - flexShrink: 0, - color: isDark ? '#e5e7eb' : 'inherit', - }; - const itemsStyle = { - display: 'flex', - rowGap: '2px', - columnGap: '6px', - flexWrap: 'wrap', - alignItems: 'center', - flex: 1, - }; - const labelBaseStyle = { - padding: '4px 10px', - border: `1px solid ${isDark ? '#9ca3af' : '#d1d5db'}`, - borderRadius: '3px', - cursor: 'pointer', - display: 'inline-flex', - flexDirection: 'column', - alignItems: 'center', - justifyContent: 'center', - fontWeight: '500', - fontSize: '13px', - transition: 'all 0.2s', - userSelect: 'none', - minWidth: '45px', - textAlign: 'center', - flex: 1, - background: isDark ? '#374151' : '#fff', - color: isDark ? '#e5e7eb' : 'inherit', - }; - const checkedStyle = { - background: '#D45D44', - color: 'white', - borderColor: '#D45D44', - }; - const disabledStyle = { - cursor: 'not-allowed', - opacity: 0.5, - }; - const subtitleStyle = { - display: 'block', - fontSize: '9px', - marginTop: '1px', - lineHeight: '1.1', - opacity: 0.7, - }; - const textInputStyle = { - flex: 1, - padding: '8px 10px', - borderRadius: '4px', - border: `1px solid ${isDark ? '#4b5563' : '#d1d5db'}`, - background: isDark ? '#111827' : '#fff', - color: isDark ? '#e5e7eb' : '#111827', - fontSize: '13px', - }; - const commandDisplayStyle = { - flex: 1, - padding: '12px 16px', - background: isDark ? '#111827' : '#f5f5f5', - borderRadius: '6px', - fontFamily: "'Menlo', 'Monaco', 'Courier New', monospace", - fontSize: '12px', - lineHeight: '1.5', - color: isDark ? '#e5e7eb' : '#374151', - whiteSpace: 'pre-wrap', - overflowX: 'auto', - margin: 0, - border: `1px solid ${isDark ? '#374151' : '#e5e7eb'}`, - }; - - return ( -
- {Object.entries(config.options).map(([key, option]) => { - if (option.condition && !option.condition(values)) { - return null; - } - - const items = option.getDynamicItems ? option.getDynamicItems(values) : option.items || []; - - return ( -
-
{option.title}
-
- {option.type === 'text' ? ( - handleTextChange(option.name, event.target.value)} - style={textInputStyle} - /> - ) : option.type === 'checkbox' ? ( - (option.items || []).map((item) => { - const isChecked = (values[option.name] || []).includes(item.id); - const isDisabled = - item.required || - (typeof item.disabledWhen === 'function' && item.disabledWhen(values)); - - return ( - - ); - }) - ) : ( - items.map((item) => { - const isChecked = values[option.name] === item.id; - const isDisabled = Boolean(item.disabled); - - return ( - - ); - }) - )} -
-
- ); - })} - -
-
Run this Command:
-
{command}
-
-
- ); -};