Skip to content

Commit bd8d6f2

Browse files
Rename everything
1 parent 032a56b commit bd8d6f2

File tree

7 files changed

+264
-10
lines changed

7 files changed

+264
-10
lines changed

scripts/convert_cosmos_to_diffusers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
EDMEulerScheduler,
6363
FlowMatchEulerDiscreteScheduler,
6464
)
65-
from diffusers.pipelines.cosmos.pipeline_cosmos25_predict import Cosmos25PredictBase
65+
from diffusers.pipelines.cosmos.pipeline_cosmos2_5_predict import Cosmos_2_5_PredictBase
6666

6767

6868
def remove_keys_(key: str, state_dict: Dict[str, Any]):
@@ -538,7 +538,7 @@ def save_pipeline_cosmos_2_5(args, transformer, vae):
538538

539539
scheduler = FlowMatchEulerDiscreteScheduler(use_karras_sigmas=True)
540540

541-
pipe = Cosmos25PredictBase(
541+
pipe = Cosmos_2_5_PredictBase(
542542
text_encoder=text_encoder,
543543
tokenizer=tokenizer,
544544
transformer=transformer,

scripts/plot_flow_unipc_sigmas.ipynb

Lines changed: 248 additions & 0 deletions
Large diffs are not rendered by default.

src/diffusers/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@
463463
"CogView4ControlPipeline",
464464
"CogView4Pipeline",
465465
"ConsisIDPipeline",
466+
"Cosmos_2_5_PredictBase",
466467
"Cosmos2TextToImagePipeline",
467468
"Cosmos2VideoToWorldPipeline",
468469
"CosmosTextToWorldPipeline",
@@ -1172,6 +1173,7 @@
11721173
CogView4ControlPipeline,
11731174
CogView4Pipeline,
11741175
ConsisIDPipeline,
1176+
Cosmos_2_5_PredictBase,
11751177
Cosmos2TextToImagePipeline,
11761178
Cosmos2VideoToWorldPipeline,
11771179
CosmosTextToWorldPipeline,

src/diffusers/pipelines/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@
165165
_import_structure["cogview4"] = ["CogView4Pipeline", "CogView4ControlPipeline"]
166166
_import_structure["consisid"] = ["ConsisIDPipeline"]
167167
_import_structure["cosmos"] = [
168+
"Cosmos_2_5_PredictBase",
168169
"Cosmos2TextToImagePipeline",
169170
"CosmosTextToWorldPipeline",
170171
"CosmosVideoToWorldPipeline",
@@ -616,6 +617,7 @@
616617
StableDiffusionXLControlNetXSPipeline,
617618
)
618619
from .cosmos import (
620+
Cosmos_2_5_PredictBase,
619621
Cosmos2TextToImagePipeline,
620622
Cosmos2VideoToWorldPipeline,
621623
CosmosTextToWorldPipeline,

src/diffusers/pipelines/cosmos/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
_dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
2424
else:
25+
_import_structure["pipeline_cosmos2_5_predict"] = ["Cosmos_2_5_PredictBase", "retrieve_latents"]
2526
_import_structure["pipeline_cosmos2_text2image"] = ["Cosmos2TextToImagePipeline"]
2627
_import_structure["pipeline_cosmos2_video2world"] = ["Cosmos2VideoToWorldPipeline"]
2728
_import_structure["pipeline_cosmos_text2world"] = ["CosmosTextToWorldPipeline"]
@@ -35,6 +36,7 @@
3536
except OptionalDependencyNotAvailable:
3637
from ...utils.dummy_torch_and_transformers_objects import *
3738
else:
39+
from .pipeline_cosmos2_5_predict import Cosmos_2_5_PredictBase, retrieve_latents
3840
from .pipeline_cosmos2_text2image import Cosmos2TextToImagePipeline
3941
from .pipeline_cosmos2_video2world import Cosmos2VideoToWorldPipeline
4042
from .pipeline_cosmos_text2world import CosmosTextToWorldPipeline

src/diffusers/pipelines/cosmos/pipeline_cosmos25_predict.py renamed to src/diffusers/pipelines/cosmos/pipeline_cosmos2_5_predict.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ def retrieve_latents(
7171
Examples:
7272
```python
7373
>>> import torch
74-
>>> from diffusers import Cosmos25PredictBase
74+
>>> from diffusers import Cosmos_2_5_PredictBase
7575
>>> from diffusers.utils import export_to_video, load_image, load_video
7676
7777
>>> model_id = "nvidia/Cosmos-Predict2.5-Base-2B"
78-
>>> pipe = Cosmos25PredictBase.from_pretrained(model_id, torch_dtype=torch.bfloat16)
78+
>>> pipe = Cosmos_2_5_PredictBase.from_pretrained(model_id, torch_dtype=torch.bfloat16)
7979
>>> pipe.to("cuda")
8080
8181
>>> prompt = "A close-up shot captures a vibrant yellow scrubber vigorously working on a grimy plate, its bristles moving in circular motions to lift stubborn grease and food residue. The dish, once covered in remnants of a hearty meal, gradually reveals its original glossy surface. Suds form and bubble around the scrubber, creating a satisfying visual of cleanliness in progress. The sound of scrubbing fills the air, accompanied by the gentle clinking of the dish against the sink. As the scrubber continues its task, the dish transforms, gleaming under the bright kitchen lights, symbolizing the triumph of cleanliness over mess."
@@ -124,7 +124,7 @@ def retrieve_latents(
124124
"""
125125

126126

127-
class Cosmos25PredictBase(DiffusionPipeline):
127+
class Cosmos_2_5_PredictBase(DiffusionPipeline):
128128
r"""
129129
Pipeline for [Cosmos Predict2.5](https://github.com/nvidia-cosmos/cosmos-predict2.5) base model.
130130

tests/pipelines/cosmos/test_cosmos25_predict.py renamed to tests/pipelines/cosmos/test_cosmos2_5_predict.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import numpy as np
2424
import torch
2525

26-
from diffusers import AutoencoderKLWan, Cosmos25PredictBase, CosmosTransformer3DModel, FlowUniPCMultistepScheduler
26+
from diffusers import AutoencoderKLWan, Cosmos_2_5_PredictBase, CosmosTransformer3DModel, FlowUniPCMultistepScheduler
2727

2828
from ...testing_utils import enable_full_determinism, torch_device
2929
from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_IMAGE_PARAMS, TEXT_TO_IMAGE_PARAMS
@@ -96,15 +96,15 @@ def forward(self, input_ids: torch.LongTensor, output_hidden_states: bool = Fals
9696
return SimpleNamespace(hidden_states=hidden_states)
9797

9898

99-
class Cosmos25PredictBaseWrapper(Cosmos25PredictBase):
99+
class Cosmos_2_5_PredictBaseWrapper(Cosmos_2_5_PredictBase):
100100
@staticmethod
101101
def from_pretrained(*args, **kwargs):
102102
kwargs["safety_checker"] = DummyCosmosSafetyChecker()
103-
return Cosmos25PredictBase.from_pretrained(*args, **kwargs)
103+
return Cosmos_2_5_PredictBase.from_pretrained(*args, **kwargs)
104104

105105

106-
class Cosmos25PredictPipelineFastTests(PipelineTesterMixin, unittest.TestCase):
107-
pipeline_class = Cosmos25PredictBaseWrapper
106+
class Cosmos_2_5_PredictPipelineFastTests(PipelineTesterMixin, unittest.TestCase):
107+
pipeline_class = Cosmos_2_5_PredictBaseWrapper
108108
params = TEXT_TO_IMAGE_PARAMS - {"cross_attention_kwargs"}
109109
batch_params = TEXT_TO_IMAGE_BATCH_PARAMS
110110
image_params = TEXT_TO_IMAGE_IMAGE_PARAMS

0 commit comments

Comments
 (0)