huggingface / huggingface/diffusers
loading Cosmos2 pipeline also disabled gradient tracking globally
- Dominant language
- Python
- Stars
- 34.5k
- Forks
- 7.3k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 91
Description
### Describe the bug
I'm using Diffusers version 0.35.2
After loading Cosmos2VideoToWorldPipeline pipeline from "nvidia/Cosmos-Predict2-2B-Video2World", gradient tracking is disabled globally. Have to manually re-enable with torch.set_grad_enabled(True)
### Reproduction
* Bug reproduction
```
import torch
from torch import nn
from diffusers import Cosmos2VideoToWorldPipeline
model_id = "nvidia/Cosmos-Predict2-2B-Video2World"
pipe = Cosmos2VideoToWorldPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16)
print(torch.is_grad_enabled())
```
output:
```
False
```
* Note: loading each component (VAE, transformer) does not disable gradient tracking.
### Logs
```shell
```
### System Info
diffusers: 0.35.2
transformers: 5.3.0
### Who can help?
_No response_
Contributor guide
Research direction
Start with the Cosmos2VideoToWorldPipeline.from_pretrained entry point and run the reproduction using nvidia/Cosmos-Predict2-2B-Video2World. Compare pipeline loading with loading the VAE and transformer components separately; done means torch.is_grad_enabled() remains True after loading the pipeline.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100