Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion cookbooks/cosmos3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ backend you want to run and follow that one section.

## Prerequisites

- Linux with NVIDIA GPU access.
- Linux with NVIDIA GPU access, or an Intel GPU supported by PyTorch XPU for
the Diffusers backend.
- [`uv`](https://docs.astral.sh/uv/getting-started/installation/), `git`, and `git-lfs` installed.
- Hugging Face access to the gated Cosmos3 model repos. Generator also requires
access to the gated
Expand Down Expand Up @@ -165,6 +166,28 @@ uv pip install --torch-backend=cu130 \
transformers
```

For Intel GPUs supported by PyTorch XPU, use the `xpu` Torch backend instead:

```bash
uv venv --python 3.13 --seed --managed-python
source .venv/bin/activate

uv pip install --torch-backend=xpu \
"diffusers @ git+https://github.com/huggingface/diffusers.git" \
accelerate \
av \
cosmos_guardrail \
huggingface_hub \
imageio \
imageio-ffmpeg \
torch \
torchvision \
transformers
```

The Intel XPU path is supported by the Diffusers Cosmos3-Edge generator. The
other backends in this guide retain their documented NVIDIA GPU requirements.

## TensorRT-LLM Generator

OpenAI-compatible **VisualGen** server for Generator audiovisual text-to-image,
Expand Down
7 changes: 5 additions & 2 deletions cookbooks/cosmos3/generator/audiovisual/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,12 @@ from diffusers.utils import export_to_video

prompt = json.load(open("assets/prompts/text2video/robot_kitchen.json"))
negative = json.load(open("assets/negative_prompts/text2video/neg_prompt.json"))
device = "xpu" if torch.xpu.is_available() else "cuda"

pipe = Cosmos3OmniPipeline.from_pretrained(
"nvidia/Cosmos3-Nano", torch_dtype=torch.bfloat16, device_map="cuda"
"nvidia/Cosmos3-Nano", torch_dtype=torch.bfloat16
)
pipe.to(device)
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config, flow_shift=10.0)

result = pipe(
Expand All @@ -137,7 +139,7 @@ result = pipe(
enable_sound=False,
add_resolution_template=False,
add_duration_template=False,
generator=torch.Generator(device="cuda").manual_seed(1234),
generator=torch.Generator(device=device).manual_seed(1234),
)
export_to_video(result.video, "/tmp/cosmos3_t2v_diffusers.mp4", fps=24)
```
Expand All @@ -148,6 +150,7 @@ To run **Cosmos3-Super** instead, load the larger checkpoint:
To run **Cosmos3-Edge** instead, load `nvidia/Cosmos3-Edge` and use its
single-GPU, no-audio settings: `height=480`, `width=832`, `num_frames=121`,
`num_inference_steps=20`, `guidance_scale=5.0`, and `flow_shift=8.0`.
The Diffusers device selection above supports both CUDA and Intel XPU devices.

### Notebook walkthrough

Expand Down