|
| 1 | +<!-- Copyright 2025 The HuggingFace Team. All rights reserved. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. --> |
| 14 | + |
| 15 | +# Cosmos |
| 16 | + |
| 17 | +[Cosmos World Foundation Model Platform for Physical AI](https://huggingface.co/papers/2501.03575) by NVIDIA. |
| 18 | + |
| 19 | +*Physical AI needs to be trained digitally first. It needs a digital twin of itself, the policy model, and a digital twin of the world, the world model. In this paper, we present the Cosmos World Foundation Model Platform to help developers build customized world models for their Physical AI setups. We position a world foundation model as a general-purpose world model that can be fine-tuned into customized world models for downstream applications. Our platform covers a video curation pipeline, pre-trained world foundation models, examples of post-training of pre-trained world foundation models, and video tokenizers. To help Physical AI builders solve the most critical problems of our society, we make our platform open-source and our models open-weight with permissive licenses available via https://github.com/NVIDIA/Cosmos.* |
| 20 | + |
| 21 | +<Tip> |
| 22 | + |
| 23 | +Make sure to check out the Schedulers [guide](../../using-diffusers/schedulers) to learn how to explore the tradeoff between scheduler speed and quality, and see the [reuse components across pipelines](../../using-diffusers/loading#reuse-a-pipeline) section to learn how to efficiently load the same components into multiple pipelines. |
| 24 | + |
| 25 | + |
| 26 | +```python |
| 27 | +import mindspore |
| 28 | +from mindone.diffusers import Cosmos2TextToImagePipeline, CosmosTransformer3DModel |
| 29 | + |
| 30 | +model_id = "nvidia/Cosmos-Predict2-2B-Text2Image" |
| 31 | +pipe = Cosmos2TextToImagePipeline.from_pretrained(model_id, mindspore_dtype=mindspore.bfloat16) |
| 32 | + |
| 33 | +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." |
| 34 | +negative_prompt = "The video captures a series of frames showing ugly scenes, static with no motion, motion blur, over-saturation, shaky footage, low resolution, grainy texture, pixelated images, poorly lit areas, underexposed and overexposed scenes, poor color balance, washed out colors, choppy sequences, jerky movements, low frame rate, artifacting, color banding, unnatural transitions, outdated special effects, fake elements, unconvincing visuals, poorly edited content, jump cuts, visual noise, and flickering. Overall, the video is of poor quality." |
| 35 | + |
| 36 | +output = pipe( |
| 37 | + prompt=prompt, negative_prompt=negative_prompt |
| 38 | +)[0][0] |
| 39 | +output.save("output.png") |
| 40 | +``` |
| 41 | + |
| 42 | +::: mindone.diffusers.CosmosTextToWorldPipeline |
| 43 | + |
| 44 | +::: mindone.diffusers.CosmosVideoToWorldPipeline |
| 45 | + |
| 46 | +::: mindone.diffusers.Cosmos2TextToImagePipeline |
| 47 | + |
| 48 | +::: mindone.diffusers.Cosmos2VideoToWorldPipeline |
| 49 | + |
| 50 | +::: mindone.diffusers.pipelines.cosmos.pipeline_output.CosmosPipelineOutput |
| 51 | + |
| 52 | +::: mindone.diffusers.pipelines.cosmos.pipeline_output.CosmosImagePipelineOutput |
0 commit comments