Wrong revision?
What’s happening
DiffusionPipeline.from_pretrained(...) is designed to load Diffusers-formatted “pipeline repos”. It does that by downloading model_index.json and reading it to determine the correct pipeline class and component layout. (Hugging Face)
Your error is:
- 404 for
.../resolve/main/model_index.json
That means: on the main revision, the Hub could not serve model_index.json at the repo root.
Root causes in your Cosmos 2.5 case
Cause 1 — You’re loading the wrong revision (most likely)
The official Diffusers docs for Cosmos 2.5 do not load from main. They explicitly load:
model_id = "nvidia/Cosmos-Predict2.5-2B"
revision="diffusers/base/post-trained"
and use a Cosmos-specific pipeline class. (Hugging Face)
So if you omit revision=..., Diffusers defaults to main, looks for model_index.json there, and gets a 404.
Cause 2 — The repo is gated; lack of auth can surface as “not found”
The model page indicates you must be logged in and accept conditions to access the content. (Hugging Face)
The NVIDIA Cosmos installation docs also instruct logging into Hugging Face via hf auth login and accepting the NVIDIA license before checkpoints can be downloaded. (NVIDIA Docs)
Even if the “real” issue is the wrong revision, gating can independently block downloads (and depending on circumstances, you may see errors that look like missing files).
Cause 3 — Version mismatch risk (after you fix the 404)
Cosmos support in Diffusers has been evolving; newer Diffusers releases explicitly mention Cosmos pipelines being added. (GitHub)
If you fix the 404 and then hit errors like “unknown pipeline class” or missing modules, it’s usually because the installed Diffusers version doesn’t include the required Cosmos pipeline implementation.
Concrete fixes (apply in this order)
1) Use the correct pipeline + revision (canonical)
This matches the official Cosmos 2.5 Diffusers example. (Hugging Face)
import torch
from diffusers import Cosmos2_5_PredictBasePipeline
model_id = "nvidia/Cosmos-Predict2.5-2B"
pipe = Cosmos2_5_PredictBasePipeline.from_pretrained(
model_id,
revision="diffusers/base/post-trained",
torch_dtype=torch.bfloat16,
token=True, # uses your cached HF token (see next step)
).to("cuda")
Why this works:
revision="diffusers/base/post-trained" points to where the Diffusers-formatted artifacts are expected to live for this model. (Hugging Face)
- The pipeline class is Cosmos-specific; it avoids relying on generic auto-detection when repos have multiple layouts. (Hugging Face)
2) Authenticate + accept access (required for gated downloads)
Follow NVIDIA’s instructions:
- get a HF token (read access)
hf auth login
- accept the NVIDIA Open Model License Agreement (NVIDIA Docs)
If you use a fine-grained token, make sure it is allowed to access public gated repositories; otherwise you can get permission failures even when you “have access” on the website. (Zenn)
3) Update your call signature (your snippet has non-fatal issues)
- Use
torch_dtype=... (that’s what the Cosmos docs use). (Hugging Face)
- Replace smart quotes
“ ” with normal quotes " ".
device_map="cuda" can work for some pipelines (Diffusers docs show it for other models) (Hugging Face), but the Cosmos docs use .to("cuda") after loading. (Hugging Face)
For Cosmos, prefer following the Cosmos example first.
4) If you still fail after the above: upgrade Diffusers + dependencies
If you resolve gating/revision but hit pipeline/import errors, upgrade Diffusers. New releases have explicitly shipped Cosmos-related pipelines. (GitHub)
Typical upgrade set:
diffusers, huggingface_hub, accelerate, transformers, safetensors
How to verify which cause you’re hitting
Check A — Does model_index.json exist on main?
If it truly isn’t present on main, the 404 is expected; the fix is revision="diffusers/base/post-trained". (Hugging Face)
Check B — Are you authenticated for gated files?
If you aren’t logged in / haven’t accepted the model’s terms, downloads will fail for gated repos. (Hugging Face)
Summary for your exact traceback
- The URL in your error includes
/resolve/main/…, so you are definitely loading the default main revision.
- Cosmos 2.5 Diffusers docs explicitly require
revision="diffusers/base/post-trained". (Hugging Face)
- The model is gated and requires authentication + license acceptance. (NVIDIA Docs)
Apply: (1) revision + Cosmos pipeline class + (2) HF auth & license acceptance. If you then hit class/import issues, upgrade Diffusers (Cosmos pipelines have been added in newer releases). (GitHub)