Cosmos
Diffusers
Safetensors
cosmos3_omni
nvidia
cosmos3
vllm
vllm-omni
sglang
sglang-diffusion
text, image, video, audio, and action generation
omnimodel
Instructions to use nvidia/Cosmos3-Nano with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Cosmos
How to use nvidia/Cosmos3-Nano 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-Nano 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-Nano", 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
MickJ commited on
Commit ·
47a072e
1
Parent(s): 59e6e50
Use async SGLang video API
Browse files927 unmodified lines92892993093193293311 unmodified lines9459469479489499509519529539549559569579584 unmodified lines963964965966967968927 unmodified lines[SGLang Diffusion](https://github.com/sgl-project/sglang) can serve Cosmos3-Nano through OpenAI-compatible image and video endpoints. Install SGLang from source with diffusion dependencies, then start a server:```shellpip install -e "python[diffusion]"pip install "cosmos-guardrail==0.3.1"11 unmodified lines| Mode | Endpoint | Notes || --- | --- | --- || Text to image | `POST /v1/images/generations` | Returns base64 image data by default || Text to video | `POST /v1/videos/sync` or `POST /v1/videos` | `/sync` blocks and returns MP4 bytes with `Accept: video/mp4` || Image to video | `POST /v1/videos/sync` or `POST /v1/videos` | Upload the conditioning image with `input_reference` |Example text-to-video request:```shellcurl -sS -X POST http://localhost:8000/v1/videos/sync \-H "Accept: video/mp4" \--form-string "prompt=A small warehouse robot moves a blue box across a clean floor." \--form-string "negative_prompt=blurry, distorted, low quality" \--form-string "size=1280x720" \4 unmodified lines--form-string "flow_shift=10.0" \--form-string "seed=42" \--form-string 'extra_params={"guardrails":true,"use_resolution_template":false,"use_duration_template":false}' \-o cosmos3_t2v_output.mp4```927 unmodified lines92892993093193293393493511 unmodified lines9479489499509519529539549559569579589594 unmodified lines964965966967968969970971972973974975976977978979980927 unmodified lines[SGLang Diffusion](https://github.com/sgl-project/sglang) can serve Cosmos3-Nano through OpenAI-compatible image and video endpoints. Install SGLang from source with diffusion dependencies, then start a server:```shellgit clone https://github.com/sgl-project/sglang.gitcd sglangpip install -e "python[diffusion]"pip install "cosmos-guardrail==0.3.1"11 unmodified lines| Mode | Endpoint | Notes || --- | --- | --- || Text to image | `POST /v1/images/generations` | Returns base64 image data by default || Text to video | `POST /v1/videos` | Creates an async job; poll `GET /v1/videos/{id}` and download `/content` || Image to video | `POST /v1/videos` | Upload the conditioning image with `input_reference` |Example text-to-video request:```shelljob_id=$(curl -sS -X POST http://localhost:8000/v1/videos \--form-string "prompt=A small warehouse robot moves a blue box across a clean floor." \--form-string "negative_prompt=blurry, distorted, low quality" \--form-string "size=1280x720" \4 unmodified lines--form-string "flow_shift=10.0" \--form-string "seed=42" \--form-string 'extra_params={"guardrails":true,"use_resolution_template":false,"use_duration_template":false}' \| python -c 'import json, sys; print(json.load(sys.stdin)["id"])')while true; dostatus=$(curl -sS "http://localhost:8000/v1/videos/${job_id}" \| python -c 'import json, sys; print(json.load(sys.stdin)["status"])')[ "$status" = "completed" ] && break[ "$status" = "failed" ] && exit 1sleep 1donecurl -sS -L "http://localhost:8000/v1/videos/${job_id}/content" \-o cosmos3_t2v_output.mp4```
README.md+16-4