kediwu0331 mingyuliutw MickJ commited on
Commit
b779108
·
1 Parent(s): 8ec97da

Add SGLang serving instructions (#5)

Browse files

- Super-squash branch 'main' using huggingface_hub (dc5add32d76dae7fee5195e00ebce074e7a29d8d)
- Add SGLang serving instructions (58971751d573634ec7ff4eabb61205cdfb2bf85e)
- Use SGLang main branch for Cosmos3 install (b2a1b0d0003f8b8cbc320d234efb61f69b1b4567)
- add sglang to more sections (18c74dfa1039c408cc9f158c7d0da9938508da77)
- Fix SGLang documentation links (e95b1303613e55058ad42096164878b5a88b4dac)


Co-authored-by: Ming-Yu Liu <mingyuliutw@users.noreply.huggingface.co>
Co-authored-by: mickqian <MickJ@users.noreply.huggingface.co>

Files changed (1) hide show
  1. README.md +52 -46
README.md CHANGED
@@ -9,54 +9,11 @@ tags:
9
  - cosmos
10
  - cosmos3
11
  - vllm-omni
 
 
12
  - diffusers
13
  - image-to-video
14
  - video-generation
15
- countDownloads:
16
- - checkpoint.json
17
- - config.json
18
- - generation_config.json
19
- - model.safetensors.index.json
20
- - model_index.json
21
- - tokenizer.json
22
- - tokenizer_config.json
23
- - sound_tokenizer/config.json
24
- - sound_tokenizer/diffusion_pytorch_model.safetensors
25
- - text_tokenizer/tokenizer.json
26
- - text_tokenizer/tokenizer_config.json
27
- - transformer/config.json
28
- - transformer/diffusion_pytorch_model-00001-of-00027.safetensors
29
- - transformer/diffusion_pytorch_model-00002-of-00027.safetensors
30
- - transformer/diffusion_pytorch_model-00003-of-00027.safetensors
31
- - transformer/diffusion_pytorch_model-00004-of-00027.safetensors
32
- - transformer/diffusion_pytorch_model-00005-of-00027.safetensors
33
- - transformer/diffusion_pytorch_model-00006-of-00027.safetensors
34
- - transformer/diffusion_pytorch_model-00007-of-00027.safetensors
35
- - transformer/diffusion_pytorch_model-00008-of-00027.safetensors
36
- - transformer/diffusion_pytorch_model-00009-of-00027.safetensors
37
- - transformer/diffusion_pytorch_model-00010-of-00027.safetensors
38
- - transformer/diffusion_pytorch_model-00011-of-00027.safetensors
39
- - transformer/diffusion_pytorch_model-00012-of-00027.safetensors
40
- - transformer/diffusion_pytorch_model-00013-of-00027.safetensors
41
- - transformer/diffusion_pytorch_model-00014-of-00027.safetensors
42
- - transformer/diffusion_pytorch_model-00015-of-00027.safetensors
43
- - transformer/diffusion_pytorch_model-00016-of-00027.safetensors
44
- - transformer/diffusion_pytorch_model-00017-of-00027.safetensors
45
- - transformer/diffusion_pytorch_model-00018-of-00027.safetensors
46
- - transformer/diffusion_pytorch_model-00019-of-00027.safetensors
47
- - transformer/diffusion_pytorch_model-00020-of-00027.safetensors
48
- - transformer/diffusion_pytorch_model-00021-of-00027.safetensors
49
- - transformer/diffusion_pytorch_model-00022-of-00027.safetensors
50
- - transformer/diffusion_pytorch_model-00023-of-00027.safetensors
51
- - transformer/diffusion_pytorch_model-00024-of-00027.safetensors
52
- - transformer/diffusion_pytorch_model-00025-of-00027.safetensors
53
- - transformer/diffusion_pytorch_model-00026-of-00027.safetensors
54
- - transformer/diffusion_pytorch_model-00027-of-00027.safetensors
55
- - transformer/diffusion_pytorch_model.safetensors.index.json
56
- - vae/config.json
57
- - vae/diffusion_pytorch_model.safetensors
58
- - vision_encoder/config.json
59
- - vision_encoder/model.safetensors
60
  ---
61
 
62
  # **Cosmos 3: Omnimodal World Models for Physical AI**
@@ -211,6 +168,7 @@ Our AI models are designed and/or optimized to run on NVIDIA GPU-accelerated sys
211
  - [PyTorch](https://github.com/nvidia/cosmos3)
212
  - [vLLM-Omni](https://github.com/vllm-project/vllm-omni)
213
  - [Hugging Face Diffusers](https://huggingface.co/docs/diffusers/en/index)
 
214
 
215
  **Supported Hardware Microarchitecture Compatibility:**
216
 
@@ -457,6 +415,54 @@ python scripts/upsample_prompt.py \
457
  --output-path scripts/upsampled.json
458
  ```
459
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
460
  ### Diffusers
461
 
462
  Cosmos3 is fully supported within the popular HuggingFace Diffusers package. This integration makes it a supported inference backend, allowing developers to easily incorporate Cosmos3's capabilities - such as text-to-image generation - into their pipelines using the Cosmos3OmniPipeline class, as demonstrated by the provided code examples (see examples for other modalities on the HuggingFace Cosmos3 page).
@@ -535,7 +541,7 @@ Cosmos3 outputs should not be treated as physically accurate simulation, reliabl
535
 
536
  ## Inference
537
 
538
- **Acceleration Engine:** [PyTorch](https://pytorch.org/), [vLLM](https://github.com/vllm-project/vllm), [vLLM-Omni](https://github.com/vllm-project/vllm-omni), [Hugging Face Diffusers](https://github.com/huggingface/diffusers)
539
 
540
  **Test Hardware:** GB200 and H100
541
 
 
9
  - cosmos
10
  - cosmos3
11
  - vllm-omni
12
+ - sglang
13
+ - sglang-diffusion
14
  - diffusers
15
  - image-to-video
16
  - video-generation
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  ---
18
 
19
  # **Cosmos 3: Omnimodal World Models for Physical AI**
 
168
  - [PyTorch](https://github.com/nvidia/cosmos3)
169
  - [vLLM-Omni](https://github.com/vllm-project/vllm-omni)
170
  - [Hugging Face Diffusers](https://huggingface.co/docs/diffusers/en/index)
171
+ - [SGLang](https://github.com/sgl-project/sglang)
172
 
173
  **Supported Hardware Microarchitecture Compatibility:**
174
 
 
415
  --output-path scripts/upsampled.json
416
  ```
417
 
418
+ ### SGLang
419
+
420
+ [SGLang Diffusion](https://docs.sglang.io/docs/sglang-diffusion/index) can serve `nvidia/Cosmos3-Super-Image2Video` through OpenAI-compatible video generation endpoints. Install SGLang from the main branch with diffusion dependencies, then start the server:
421
+
422
+ ```bash
423
+ git clone --branch main https://github.com/sgl-project/sglang.git
424
+ cd sglang
425
+ pip install -e "python[diffusion]"
426
+ pip install "cosmos-guardrail==0.3.1"
427
+
428
+ sglang serve \
429
+ --model-path nvidia/Cosmos3-Super-Image2Video \
430
+ --num-gpus 4
431
+ ```
432
+
433
+ Cosmos 3 support in SGLang Diffusion currently requires the SGLang main branch. Switch to a stable SGLang release once Cosmos 3 support is included there.
434
+
435
+ Example image-to-video request:
436
+
437
+ ```bash
438
+ job_id=$(curl -sS -X POST http://localhost:30000/v1/videos \
439
+ --form-string "prompt=A small warehouse robot moves a blue box across a clean floor." \
440
+ --form-string "negative_prompt=blurry, distorted, low quality" \
441
+ --form-string "size=1280x720" \
442
+ --form-string "num_frames=81" \
443
+ --form-string "fps=24" \
444
+ --form-string "num_inference_steps=35" \
445
+ --form-string "guidance_scale=4.0" \
446
+ --form-string "flow_shift=10.0" \
447
+ --form-string "seed=42" \
448
+ --form-string 'extra_params={"guardrails":true,"use_resolution_template":false,"use_duration_template":false}' \
449
+ -F "input_reference=@input.png" \
450
+ | python -c 'import json, sys; print(json.load(sys.stdin)["id"])')
451
+
452
+ while true; do
453
+ status=$(curl -sS "http://localhost:30000/v1/videos/${job_id}" \
454
+ | python -c 'import json, sys; print(json.load(sys.stdin)["status"])')
455
+ [ "$status" = "completed" ] && break
456
+ [ "$status" = "failed" ] && exit 1
457
+ sleep 1
458
+ done
459
+
460
+ curl -sS -L "http://localhost:30000/v1/videos/${job_id}/content" \
461
+ -o cosmos3_super_i2v_output.mp4
462
+ ```
463
+
464
+ For complete serving instructions and request examples, see the [Cosmos3 SGLang cookbook](https://docs.sglang.io/cookbook/diffusion/Cosmos/Cosmos3).
465
+
466
  ### Diffusers
467
 
468
  Cosmos3 is fully supported within the popular HuggingFace Diffusers package. This integration makes it a supported inference backend, allowing developers to easily incorporate Cosmos3's capabilities - such as text-to-image generation - into their pipelines using the Cosmos3OmniPipeline class, as demonstrated by the provided code examples (see examples for other modalities on the HuggingFace Cosmos3 page).
 
541
 
542
  ## Inference
543
 
544
+ **Acceleration Engine:** [PyTorch](https://pytorch.org/), [vLLM](https://github.com/vllm-project/vllm), [vLLM-Omni](https://github.com/vllm-project/vllm-omni), [Hugging Face Diffusers](https://github.com/huggingface/diffusers), [SGLang](https://github.com/sgl-project/sglang), [SGLang Diffusion](https://docs.sglang.io/docs/sglang-diffusion/index)
545
 
546
  **Test Hardware:** GB200 and H100
547