Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,21 @@ cd cosmos-predict1
Cosmos runs only on Linux systems. We have tested the installation with Ubuntu 24.04, 22.04, and 20.04.
Cosmos requires the Python version to be `3.10.x`. Please also make sure you have `conda` installed ([instructions](https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html)).

### Inference
### Dependency Management

This project defines its dependencies in two files to support different use cases:

- **`requirements.txt`**: This file contains pinned dependencies with exact versions. Use this to create a reproducible environment that mirrors the setup used for the original research. This is the recommended approach for running the provided examples or for post-training to ensure compatibility.

- **`pyproject.toml`**: This file specifies flexible dependency version ranges. This is for users who want to integrate `cosmos-predict1` as a library into a larger Python project. This approach minimizes the chance of conflicts with other packages in your environment.

Choose the installation method below that best suits your needs.

### For Reproducing the Research Environment

These instructions are for setting up a development environment that matches the one used for the research paper.

#### Inference

The below commands creates the `cosmos-predict1` conda environment and installs the dependencies for inference:
```bash
Expand Down Expand Up @@ -44,7 +58,7 @@ You can test the environment setup for inference with
CUDA_HOME=$CONDA_PREFIX PYTHONPATH=$(pwd) python scripts/test_environment.py
```

### Post-training
#### Post-training

The below commands creates the `cosmos-predict1` conda environment and installs the dependencies for post-training. This is the same as required for inference but with an additional package `apex` for training with bfloat16.
```bash
Expand All @@ -68,3 +82,14 @@ You can test the environment setup for post-training with
```bash
CUDA_HOME=$CONDA_PREFIX PYTHONPATH=$(pwd) python scripts/test_environment.py --training
```

### For Using as a Library

If you want to use `cosmos-predict1` in your own project, you can install it from the cloned repository. This will use the flexible dependencies from `pyproject.toml`.

```bash
# From the root of the cosmos-predict1 repository
pip install .
```

This will install `cosmos-predict1` and its dependencies. Note that this method may pull different dependency versions than what is in `requirements.txt`, which may be necessary for compatibility with your other project dependencies.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ We provide a comphrehensive set of examples to illustrate how to perform inferen

### Installation

Please refer to [INSTALL.md](INSTALL.md) for general instructions on environment setup.
Please refer to [INSTALL.md](INSTALL.md) for detailed instructions on environment setup and dependency management. This document explains how to install for both reproducibility and for use as a library.

### Inference with pre-trained Cosmos-Predict1 models
* [Inference with diffusion-based Text2World models](/examples/inference_diffusion_text2world.md) **[with multi-GPU support]**
Expand Down
40 changes: 36 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,47 @@ description = "Cosmos World Foundation Model"
readme = "README.md"
requires-python = ">=3.10"
license = {text = "Apache-2.0"}
dynamic = ["dependencies"]
dependencies = [
"attrs>=25.1.0",
"better-profanity>=0.7.0",
"boto3>=1.35.99,<2.0",
"decord>=0.6.0",
"diffusers>=0.32.2",
"einops>=0.8.1",
"huggingface-hub>=0.29.2",
"hydra-core>=1.3.2,<2.0",
"imageio[pyav,ffmpeg]>=2.37.0",
"iopath>=0.1.10",
"ipdb>=0.13.13",
"loguru>=0.7.2",
"mediapy>=1.2.2,<2.0",
"megatron-core>=0.10.0",
"nltk>=3.9.1,<4.0",
"numpy>=1.26.4,<2.0",
"nvidia-ml-py>=12.535.133,<13.0",
"omegaconf>=2.3.0",
"opencv-python>=4.10.0.84,<5.0",
"pandas>=2.2.3,<3.0",
"peft>=0.14.0",
"pillow>=11.1.0",
"protobuf>=4.25.3,<5.0",
"pynvml>=12.0.0",
"pyyaml>=6.0.2,<7.0",
"retinaface-py>=0.0.2",
"safetensors==0.5.3",
"scikit-image>=0.25.2",
"sentencepiece>=0.2.0",
"termcolor>=2.5.0,<3.0",
"torch>=2.6.0,<3.0",
"torchvision>=0.21.0",
"tqdm>=4.66.5,<5.0",
"transformers>=4.49.0,<5.0",
]

[project.urls]
homepage = "https://github.com/nvidia-cosmos/cosmos-predict1/"
issues = "https://github.com/nvidia-cosmos/cosmos-predict1/issues"

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}

[tool.setuptools]
packages = ["cosmos_predict1"]

Expand Down