Skip to content

Enable Intel XPU support for Cosmos3-Edge - #352

Open
padatta wants to merge 4 commits into
NVIDIA:mainfrom
padatta:padatta/cosmos3-edge-xpu
Open

padatta wants to merge 4 commits into
NVIDIA:mainfrom
padatta:padatta/cosmos3-edge-xpu

Conversation

@padatta

@padatta padatta commented Nov 2, 2026

Copy link
Copy Markdown

Summary

  • Document the PyTorch XPU install path for Cosmos3-Edge with Diffusers.
  • Update the Edge quickstart and skill runner to select XPU when available while keeping CUDA as the fallback/default.
  • Keep XPU support scoped to Cosmos3-Edge generation through Diffusers.

Validation

Previously validated on Intel Arc Graphics with PyTorch 2.13.0.dev20260530+xpu and Diffusers 0.35.2. Documentation diff passes git show --check.

Related

Resubmits NVIDIA/cosmos#368, which was closed after the cookbook content moved to this repository.

@padatta
padatta force-pushed the padatta/cosmos3-edge-xpu branch from 204f121 to 0da4595 Compare November 2, 2026 04:49

@pengcuo pengcuo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review notes (docs/skill only; I did not run on XPU).

  1. The validation claim cannot be right. The PR says it was validated with "Diffusers 0.35.2" (README, SKILL.md, and references/diffusers.md, three places). Cosmos3OmniPipeline (src/diffusers/pipelines/cosmos/pipeline_cosmos3_omni.py) does not exist at v0.35.2 (404 on the tag). The first release that has it is later; current is v0.42.1. The install command also uses diffusers @ git+https://github.com/huggingface/diffusers.git, not 0.35.2. Please correct the version (and the PyTorch nightly one if it is also from a different environment) to the actual combination you ran, or drop the version claim.

  2. The Diffusers quickstart now defaults to Edge. references/diffusers.md Quickstart used Nano at 720p with the Super variation. It now loads nvidia/Cosmos3-Edge and the "To run Super / To run Edge instead" lines are deleted. That regresses the default NVIDIA-GPU example to support one device. Keep the Nano example and add a separate short Edge/XPU block.

  3. Safety checker on XPU is unaddressed. get_pipe() loads with enable_safety_checker=True (guardrails), and the skill installs cosmos_guardrail. The XPU snippet at the end of the file passes safety_checker=None, enable_safety_checker=False, so what was validated skipped the guardrail. If the guardrail models are CUDA-only, the notebook's XPU path fails or silently stays on CPU. Please state what was run (guardrail on or off) and, if it is off, say so in the XPU section.

  4. Hard-coded CUDA remains in the same file. pipe.to("cuda") / Generator(device="cuda") at the Nano snippet around line 474 and the torch.cuda.* device-check cell around line 175 are untouched, and release_pipe() only calls torch.cuda.empty_cache(). If XPU is Edge-only, say so at those snippets. Otherwise anyone following the notebook on XPU hits them.

  5. Low: inference_device() in the notebook is Edge-only on purpose, but the README snippet picks xpu for any model. Pick one rule.

@padatta
padatta force-pushed the padatta/cosmos3-edge-xpu branch from ec15ca6 to a658b3f Compare November 3, 2026 07:40
Signed-off-by: padatta <103029195+padatta@users.noreply.github.com>
…XPU to Edge

- Replace the incorrect Diffusers 0.35.2 / torch nightly claim with the stack
  actually validated from a fresh install (torch 2.15.0+xpu, Diffusers
  0.42.0.dev0 @ 86ef420), stated once in the setup guide.
- Restore the Nano quickstart and add a separate Cosmos3-Edge XPU block.
- State guardrail status: XPU block validated with the guardrail off.
- Revert the notebook-verbatim runner to CUDA and mark CUDA-only cells.
- Use one rule: XPU applies to Cosmos3-Edge only.
- Document the 480p VAE decode limit (>=33 frames) on the Arc iGPU.

Signed-off-by: padatta <103029195+padatta@users.noreply.github.com>
Enabling the guardrail fails on hosts without CUDA because cosmos_guardrail
0.3.2 loads the CUDA-saved face-blur checkpoint with torch.load and no
map_location. With that load mapped to CPU, the guardrail ran on XPU (text and
video checks on xpu:0), so state that in place of 'not run on XPU yet'.

Signed-off-by: padatta <103029195+padatta@users.noreply.github.com>
@padatta

padatta commented Nov 3, 2026

Copy link
Copy Markdown
Author

Review notes (docs/skill only; I did not run on XPU).

  1. The validation claim cannot be right. The PR says it was validated with "Diffusers 0.35.2" (README, SKILL.md, and references/diffusers.md, three places). Cosmos3OmniPipeline (src/diffusers/pipelines/cosmos/pipeline_cosmos3_omni.py) does not exist at v0.35.2 (404 on the tag). The first release that has it is later; current is v0.42.1. The install command also uses diffusers @ git+https://github.com/huggingface/diffusers.git, not 0.35.2. Please correct the version (and the PyTorch nightly one if it is also from a different environment) to the actual combination you ran, or drop the version claim.
  2. The Diffusers quickstart now defaults to Edge. references/diffusers.md Quickstart used Nano at 720p with the Super variation. It now loads nvidia/Cosmos3-Edge and the "To run Super / To run Edge instead" lines are deleted. That regresses the default NVIDIA-GPU example to support one device. Keep the Nano example and add a separate short Edge/XPU block.
  3. Safety checker on XPU is unaddressed. get_pipe() loads with enable_safety_checker=True (guardrails), and the skill installs cosmos_guardrail. The XPU snippet at the end of the file passes safety_checker=None, enable_safety_checker=False, so what was validated skipped the guardrail. If the guardrail models are CUDA-only, the notebook's XPU path fails or silently stays on CPU. Please state what was run (guardrail on or off) and, if it is off, say so in the XPU section.
  4. Hard-coded CUDA remains in the same file. pipe.to("cuda") / Generator(device="cuda") at the Nano snippet around line 474 and the torch.cuda.* device-check cell around line 175 are untouched, and release_pipe() only calls torch.cuda.empty_cache(). If XPU is Edge-only, say so at those snippets. Otherwise anyone following the notebook on XPU hits them.
  5. Low: inference_device() in the notebook is Edge-only on purpose, but the README snippet picks xpu for any model. Pick one rule.

Thanks for the thorough review. All points are addressed in the follow-up commits.

  1. Versions. You're right: 0.35.2 came from a different venv and predates Cosmos3OmniPipeline. I reran from a fresh install with the documented uv pip install --torch-backend=xpu command. Validated stack: Python 3.13.18, PyTorch 2.15.0+xpu, torchvision 0.29.2+xpu, Diffusers 0.42.0.dev0 (git 86ef420), and Transformers 5.22.1. It is stated once, in the setup guide; SKILL.md and diffusers.md link to it. I also added a note: a system oneAPI on LD_LIBRARY_PATH breaks import torch with undefined symbol: urGraphGetIdExp.

  2. Quickstart. The Nano 720p quickstart and the Super/Edge lines are restored unchanged from main. Edge on XPU is now a separate block.

  3. Guardrail. The XPU example runs with the guardrail off, and the docs say so. The Edge checkpoint's model_index.json already sets enable_safety_checker: false, and the block passes it explicitly so the setting is visible.

I then tested it on. It fails on XPU, and on any host without CUDA, inside cosmos_guardrail 0.3.2: cosmos_utils.load_model calls torch.load(path, weights_only=True) without map_location, and the RetinaFace face-blur checkpoint was saved with CUDA tensors. So CosmosSafetyChecker() raises Attempting to deserialize object on a CUDA device.

With only that load mapped to CPU (map_location="cpu"), the guardrail works on XPU: CosmosSafetyChecker loaded, and both check_text_safety and check_video_safety ran on xpu:0 and passed. The docs describe this and point to enable_safety_checker=True once cosmos_guardrail is fixed. The older cosmos-predict1 guardrail already handles this through load_to_cpu; the pip package seems to have dropped it. Could you route this to whoever maintains cosmos_guardrail? I couldn't find a public repo for it.

  1. Hard-coded CUDA. The notebook runner (get_pipe, run_diffusers_payload, release_pipe) is back to verbatim CUDA. It, the § 5 verify cell, and the § 8.2 Nano snippet are marked CUDA-only, with a pointer to the Edge XPU path.

  2. One rule. XPU applies to Cosmos3-Edge only. Only the Edge blocks (the Quickstart XPU block and § 8.4) use xpu. The inference_device() helper is removed.

Also found during validation: on the Arc iGPU, VAE decode at 480p with 33 or more frames, including Edge's default 121, never finishes, with or without vae.enable_tiling(). This happened on both torch 2.13 and 2.15. 17 frames decodes in about 14 s, so the XPU block uses num_frames=17 and the limit is documented.

@padatta
padatta requested a review from pengcuo November 3, 2026 08:07

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants