(page_installation_reason2)

Installation#

Follow these steps to clone the Cosmos-Reason2 repository from GitHub and install system dependencies via either a virtual environment or a Docker container.

Clone the Cosmos-Reason2 repository:

git clone https://github.com/nvidia-cosmos/cosmos-reason2.git
cd cosmos-reason2

Once you have cloned the repository, you can set up either a virtual environment or a Docker container to run inference.

Virtual Environment#

Install system dependencies:

sudo apt-get install curl ffmpeg git git-lfs
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.local/bin/env
uv tool install -U huggingface_hub
hf auth login

Install the repository:

uv sync

Docker Container#

Ensure you have access to Docker on your machine and the NVIDIA Container Toolkit is installed.

Build the container:

image_tag=$(docker build -f Dockerfile -q .)

Run the container:

docker run -it --gpus all --ipc=host --rm -v .:/workspace -v /workspace/.venv -v /workspace/examples/cosmos_rl/.venv -v /root/.cache:/root/.cache $image_tag

Optional arguments:

  • --ipc=host: Use host system’s shared memory, as parallel torchrun consumes a large amount of shared memory. If not allowed by security policy, increase --shm-size (documentation).

  • -v /root/.cache:/root/.cache: Mount the host cache to avoid re-downloading cache entries.