Text-to-Image
Cosmos
Diffusers
Safetensors
cosmos3_omni
nvidia
cosmos3
vllm-omni
sglang
sglang-diffusion
image-generation
Instructions to use nvidia/Cosmos3-Super-Text2Image with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Cosmos
How to use nvidia/Cosmos3-Super-Text2Image with Cosmos:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Diffusers
How to use nvidia/Cosmos3-Super-Text2Image with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("nvidia/Cosmos3-Super-Text2Image", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Add SGLang serving instructions
#11
by MickJ - opened
README.md
CHANGED
|
@@ -9,54 +9,11 @@ tags:
|
|
| 9 |
- cosmos
|
| 10 |
- cosmos3
|
| 11 |
- vllm-omni
|
|
|
|
|
|
|
| 12 |
- diffusers
|
| 13 |
- text-to-image
|
| 14 |
- image-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 |
|
|
@@ -426,6 +384,45 @@ print("Saved image to /tmp/cosmos3_t2i.png")
|
|
| 426 |
|
| 427 |

|
| 428 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 429 |
### Diffusers
|
| 430 |
|
| 431 |
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).
|
|
@@ -493,7 +490,7 @@ Cosmos3 outputs should not be treated as physically accurate simulation, reliabl
|
|
| 493 |
|
| 494 |
## Inference
|
| 495 |
|
| 496 |
-
**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)
|
| 497 |
|
| 498 |
**Test Hardware:** GB200 and H100
|
| 499 |
|
|
|
|
| 9 |
- cosmos
|
| 10 |
- cosmos3
|
| 11 |
- vllm-omni
|
| 12 |
+
- sglang
|
| 13 |
+
- sglang-diffusion
|
| 14 |
- diffusers
|
| 15 |
- text-to-image
|
| 16 |
- image-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 |
|
|
|
|
| 384 |
|
| 385 |

|
| 386 |
|
| 387 |
+
### SGLang
|
| 388 |
+
|
| 389 |
+
[SGLang Diffusion](https://docs.sglang.io/docs/sglang-diffusion/index) can serve `nvidia/Cosmos3-Super-Text2Image` through OpenAI-compatible image generation endpoints. Install SGLang from the main branch with diffusion dependencies, then start the server:
|
| 390 |
+
|
| 391 |
+
```bash
|
| 392 |
+
git clone --branch main https://github.com/sgl-project/sglang.git
|
| 393 |
+
cd sglang
|
| 394 |
+
pip install -e "python[diffusion]"
|
| 395 |
+
pip install "cosmos-guardrail==0.3.1"
|
| 396 |
+
|
| 397 |
+
sglang serve \
|
| 398 |
+
--model-path nvidia/Cosmos3-Super-Text2Image \
|
| 399 |
+
--num-gpus 4
|
| 400 |
+
```
|
| 401 |
+
|
| 402 |
+
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.
|
| 403 |
+
|
| 404 |
+
Example text-to-image request:
|
| 405 |
+
|
| 406 |
+
```bash
|
| 407 |
+
curl -sS -X POST http://localhost:30000/v1/images/generations \
|
| 408 |
+
-H "Content-Type: application/json" \
|
| 409 |
+
-d '{
|
| 410 |
+
"prompt": "A warehouse robot folds a blue cloth on a clean workbench.",
|
| 411 |
+
"size": "1280x720",
|
| 412 |
+
"n": 1,
|
| 413 |
+
"num_inference_steps": 35,
|
| 414 |
+
"guidance_scale": 6.0,
|
| 415 |
+
"flow_shift": 10.0,
|
| 416 |
+
"seed": 0,
|
| 417 |
+
"extra_args": {
|
| 418 |
+
"use_resolution_template": false,
|
| 419 |
+
"guardrails": true
|
| 420 |
+
}
|
| 421 |
+
}'
|
| 422 |
+
```
|
| 423 |
+
|
| 424 |
+
For complete serving instructions and request examples, see the [Cosmos3 SGLang cookbook](https://docs.sglang.io/cookbook/diffusion/Cosmos/Cosmos3).
|
| 425 |
+
|
| 426 |
### Diffusers
|
| 427 |
|
| 428 |
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).
|
|
|
|
| 490 |
|
| 491 |
## Inference
|
| 492 |
|
| 493 |
+
**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)
|
| 494 |
|
| 495 |
**Test Hardware:** GB200 and H100
|
| 496 |
|