From bf3d85a85fc8af04ee4c821589baf3bcc8e37d34 Mon Sep 17 00:00:00 2001 From: johnnynunez Date: Fri, 10 Jan 2025 14:58:12 +0100 Subject: [PATCH 01/23] transformer engine --- packages/ml/transformer_engine/Dockerfile | 21 +++++++++ packages/ml/transformer_engine/README.md | 55 +++++++++++++++++++++++ packages/ml/transformer_engine/build.sh | 26 +++++++++++ packages/ml/transformer_engine/config.py | 30 +++++++++++++ packages/ml/transformer_engine/install.sh | 9 ++++ packages/ml/transformer_engine/test.py | 14 ++++++ 6 files changed, 155 insertions(+) create mode 100644 packages/ml/transformer_engine/Dockerfile create mode 100644 packages/ml/transformer_engine/README.md create mode 100755 packages/ml/transformer_engine/build.sh create mode 100644 packages/ml/transformer_engine/config.py create mode 100755 packages/ml/transformer_engine/install.sh create mode 100644 packages/ml/transformer_engine/test.py diff --git a/packages/ml/transformer_engine/Dockerfile b/packages/ml/transformer_engine/Dockerfile new file mode 100644 index 000000000..d0582a463 --- /dev/null +++ b/packages/ml/transformer_engine/Dockerfile @@ -0,0 +1,21 @@ +#--- +# name: causalconv1d +# group: mamba +# config: config.py +# depends: [ninja, pytorch, torchvision, torchaudio] +# requires: '>=34.1.0' +# test: test.py +# notes: https://github.com/state-spaces/mamba +#--- +ARG BASE_IMAGE +FROM ${BASE_IMAGE} + +ARG CASUALCONV1D_VERSION \ + CUDAARCHS + +COPY build.sh install.sh /tmp/CASUALCONV1D/ + +COPY patches/${CASUALCONV1D_VERSION}.diff /tmp/CASUALCONV1D/patch.diff + + +RUN /tmp/CASUALCONV1D/install.sh || /tmp/CASUALCONV1D/build.sh diff --git a/packages/ml/transformer_engine/README.md b/packages/ml/transformer_engine/README.md new file mode 100644 index 000000000..f602ab067 --- /dev/null +++ b/packages/ml/transformer_engine/README.md @@ -0,0 +1,55 @@ +# causalconv1d + +> [`CONTAINERS`](#user-content-containers) [`IMAGES`](#user-content-images) [`RUN`](#user-content-run) [`BUILD`](#user-content-build) + +
+CONTAINERS +
+ +| **`causalconv1d:1.4.0`** | | +| :-- | :-- | +|    Aliases | `causalconv1d` | +|    Requires | `L4T ['>=34.1.0']` | +|    Dependencies | [`build-essential`](/packages/build/build-essential) [`pip_cache:cu122`](/packages/cuda/cuda) [`python`](/packages/build/python) [`ninja`](/packages/build/ninja) [`cuda:12.2`](/packages/cuda/cuda) [`cudnn`](/packages/cuda/cudnn) [`numpy`](/packages/numeric/numpy) [`cmake`](/packages/build/cmake/cmake_pip) [`onnx`](/packages/ml/onnx) [`pytorch:2.2`](/packages/pytorch) [`torchvision`](/packages/pytorch/torchvision) [`torchaudio`](/packages/pytorch/torchaudio) | +|    Dependants | [`cobra:0.0.1`](/packages/mamba/cobra) [`dimba:1.0`](/packages/mamba/dimba) [`mamba:2.2.2`](/packages/mamba/mamba) [`mambavision:1.0`](/packages/mamba/mambavision) [`videomambasuite:1.0`](/packages/mamba/videomambasuite) | +|    Dockerfile | [`Dockerfile`](Dockerfile) | +|    Notes | https://github.com/state-spaces/mamba | + +
+ +
+RUN CONTAINER +
+ +To start the container, you can use [`jetson-containers run`](/docs/run.md) and [`autotag`](/docs/run.md#autotag), or manually put together a [`docker run`](https://docs.docker.com/engine/reference/commandline/run/) command: +```bash +# automatically pull or build a compatible container image +jetson-containers run $(autotag causalconv1d) + +# or if using 'docker run' (specify image and mounts/ect) +sudo docker run --runtime nvidia -it --rm --network=host causalconv1d:36.3.0 + +``` +> [`jetson-containers run`](/docs/run.md) forwards arguments to [`docker run`](https://docs.docker.com/engine/reference/commandline/run/) with some defaults added (like `--runtime nvidia`, mounts a `/data` cache, and detects devices)
+> [`autotag`](/docs/run.md#autotag) finds a container image that's compatible with your version of JetPack/L4T - either locally, pulled from a registry, or by building it. + +To mount your own directories into the container, use the [`-v`](https://docs.docker.com/engine/reference/commandline/run/#volume) or [`--volume`](https://docs.docker.com/engine/reference/commandline/run/#volume) flags: +```bash +jetson-containers run -v /path/on/host:/path/in/container $(autotag causalconv1d) +``` +To launch the container running a command, as opposed to an interactive shell: +```bash +jetson-containers run $(autotag causalconv1d) my_app --abc xyz +``` +You can pass any options to it that you would to [`docker run`](https://docs.docker.com/engine/reference/commandline/run/), and it'll print out the full command that it constructs before executing it. +
+
+BUILD CONTAINER +
+ +If you use [`autotag`](/docs/run.md#autotag) as shown above, it'll ask to build the container for you if needed. To manually build it, first do the [system setup](/docs/setup.md), then run: +```bash +jetson-containers build causalconv1d +``` +The dependencies from above will be built into the container, and it'll be tested during. Run it with [`--help`](/jetson_containers/build.py) for build options. +
diff --git a/packages/ml/transformer_engine/build.sh b/packages/ml/transformer_engine/build.sh new file mode 100755 index 000000000..de8456b41 --- /dev/null +++ b/packages/ml/transformer_engine/build.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +set -ex + +# Clone the repository if it doesn't exist +git clone --branch=v${TRANSFORMER_ENGINE_VERSION} --depth=1 --recursive https://github.com/Dao-AILab/causal-conv1d /opt/transformer_engine || \ +git clone --depth=1 --recursive https://github.com/Dao-AILab/causal-conv1d /opt/transformer_engine + +# Navigate to the directory containing mamba's setup.py +cd /opt/transformer_engine + +git apply /tmp/CASUALCONV1D/patch.diff +git diff +git status + +MAX_JOBS=$(nproc) \ +CAUSAL_CONV1D_FORCE_BUILD="TRUE" \ +CAUSAL_CONV1D_SKIP_CUDA_BUILD="FALSE" \ +python3 setup.py bdist_wheel --dist-dir=/opt/transformer_engine/wheels +pip3 install --no-cache-dir --verbose /opt/transformer_engine/wheels/causal_conv1d*.whl + +cd /opt/transformer_engine + +pip3 install 'numpy<2' + +# Optionally upload to a repository using Twine +twine upload --verbose /opt/transformer_engine/wheels/causal_conv1d*.whl || echo "Failed to upload wheel to ${TWINE_REPOSITORY_URL}" diff --git a/packages/ml/transformer_engine/config.py b/packages/ml/transformer_engine/config.py new file mode 100644 index 000000000..67eec1b1c --- /dev/null +++ b/packages/ml/transformer_engine/config.py @@ -0,0 +1,30 @@ +from jetson_containers import CUDA_ARCHITECTURES + +def causalconv1d(version, requires=None, default=False): + pkg = package.copy() + + if requires: + pkg['requires'] = requires + + pkg['name'] = f'causalconv1d:{version}' + + pkg['build_args'] = { + 'CUDAARCHS': ';'.join([str(x) for x in CUDA_ARCHITECTURES]), + 'CASUALCONV1D_VERSION': version, + } + + builder = pkg.copy() + + builder['name'] = f'causalconv1d:{version}-builder' + builder['build_args'] = {**pkg['build_args'], **{'FORCE_BUILD': 'on'}} + + if default: + pkg['alias'] = 'causalconv1d' + builder['alias'] = 'causalconv1d:builder' + + return pkg, builder + +package = [ + causalconv1d('1.4.0'), + causalconv1d('1.6.0', default=True) +] diff --git a/packages/ml/transformer_engine/install.sh b/packages/ml/transformer_engine/install.sh new file mode 100755 index 000000000..6e765448d --- /dev/null +++ b/packages/ml/transformer_engine/install.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -ex + +if [ "$FORCE_BUILD" == "on" ]; then + echo "Forcing build of causal-conv1d ${CAUSALCONV1D}" + exit 1 +fi + +pip3 install --no-cache-dir --verbose causal_conv1d==${CASUALCONV1D_VERSION} \ No newline at end of file diff --git a/packages/ml/transformer_engine/test.py b/packages/ml/transformer_engine/test.py new file mode 100644 index 000000000..21eef8830 --- /dev/null +++ b/packages/ml/transformer_engine/test.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +import torch +from causal_conv1d import causal_conv1d_fn +import causal_conv1d_cuda + +batch, dim, seq, width = 10, 5, 17, 4 +x = torch.zeros((batch, dim, seq)).to('cuda') +weight = torch.zeros((dim, width)).to('cuda') +bias = torch.zeros((dim, )).to('cuda') + +causal_conv1d_fn(x, weight, bias, None) +conv1d_out = causal_conv1d_cuda.causal_conv1d_fwd(x, weight, bias, None, None, None, True) + +print('causal_conv1d OK\n') \ No newline at end of file From 582c32e61daae7522211206323c76e3b181250bd Mon Sep 17 00:00:00 2001 From: Johnny Date: Fri, 10 Jan 2025 15:09:45 +0100 Subject: [PATCH 02/23] transformer-engine --- packages/ml/transformer_engine/Dockerfile | 16 +++---- packages/ml/transformer_engine/README.md | 55 ----------------------- packages/ml/transformer_engine/build.sh | 17 ++++--- packages/ml/transformer_engine/config.py | 15 +++---- packages/ml/transformer_engine/install.sh | 4 +- packages/ml/transformer_engine/test.py | 30 +++++++++---- 6 files changed, 46 insertions(+), 91 deletions(-) delete mode 100644 packages/ml/transformer_engine/README.md diff --git a/packages/ml/transformer_engine/Dockerfile b/packages/ml/transformer_engine/Dockerfile index d0582a463..382b88579 100644 --- a/packages/ml/transformer_engine/Dockerfile +++ b/packages/ml/transformer_engine/Dockerfile @@ -1,21 +1,21 @@ #--- -# name: causalconv1d -# group: mamba +# name: transformer-engine +# group: ml # config: config.py -# depends: [ninja, pytorch, torchvision, torchaudio] +# depends: [pytorch, flash-attention] # requires: '>=34.1.0' # test: test.py -# notes: https://github.com/state-spaces/mamba +# notes: https://docs.nvidia.com/deeplearning/transformer-engine/user-guide/index.html #--- ARG BASE_IMAGE FROM ${BASE_IMAGE} -ARG CASUALCONV1D_VERSION \ +ARG TRANSFORMER_ENGINE_VERSION \ CUDAARCHS -COPY build.sh install.sh /tmp/CASUALCONV1D/ +# COPY build.sh install.sh /tmp/TRANSFORMER_ENGINE/ -COPY patches/${CASUALCONV1D_VERSION}.diff /tmp/CASUALCONV1D/patch.diff +# COPY patches/${TRANSFORMER_ENGINE_VERSION}.diff /tmp/TRANSFORMER_ENGINE/patch.diff -RUN /tmp/CASUALCONV1D/install.sh || /tmp/CASUALCONV1D/build.sh +RUN /tmp/TRANSFORMER_ENGINE/install.sh || /tmp/TRANSFORMER_ENGINE/build.sh diff --git a/packages/ml/transformer_engine/README.md b/packages/ml/transformer_engine/README.md deleted file mode 100644 index f602ab067..000000000 --- a/packages/ml/transformer_engine/README.md +++ /dev/null @@ -1,55 +0,0 @@ -# causalconv1d - -> [`CONTAINERS`](#user-content-containers) [`IMAGES`](#user-content-images) [`RUN`](#user-content-run) [`BUILD`](#user-content-build) - -
-CONTAINERS -
- -| **`causalconv1d:1.4.0`** | | -| :-- | :-- | -|    Aliases | `causalconv1d` | -|    Requires | `L4T ['>=34.1.0']` | -|    Dependencies | [`build-essential`](/packages/build/build-essential) [`pip_cache:cu122`](/packages/cuda/cuda) [`python`](/packages/build/python) [`ninja`](/packages/build/ninja) [`cuda:12.2`](/packages/cuda/cuda) [`cudnn`](/packages/cuda/cudnn) [`numpy`](/packages/numeric/numpy) [`cmake`](/packages/build/cmake/cmake_pip) [`onnx`](/packages/ml/onnx) [`pytorch:2.2`](/packages/pytorch) [`torchvision`](/packages/pytorch/torchvision) [`torchaudio`](/packages/pytorch/torchaudio) | -|    Dependants | [`cobra:0.0.1`](/packages/mamba/cobra) [`dimba:1.0`](/packages/mamba/dimba) [`mamba:2.2.2`](/packages/mamba/mamba) [`mambavision:1.0`](/packages/mamba/mambavision) [`videomambasuite:1.0`](/packages/mamba/videomambasuite) | -|    Dockerfile | [`Dockerfile`](Dockerfile) | -|    Notes | https://github.com/state-spaces/mamba | - -
- -
-RUN CONTAINER -
- -To start the container, you can use [`jetson-containers run`](/docs/run.md) and [`autotag`](/docs/run.md#autotag), or manually put together a [`docker run`](https://docs.docker.com/engine/reference/commandline/run/) command: -```bash -# automatically pull or build a compatible container image -jetson-containers run $(autotag causalconv1d) - -# or if using 'docker run' (specify image and mounts/ect) -sudo docker run --runtime nvidia -it --rm --network=host causalconv1d:36.3.0 - -``` -> [`jetson-containers run`](/docs/run.md) forwards arguments to [`docker run`](https://docs.docker.com/engine/reference/commandline/run/) with some defaults added (like `--runtime nvidia`, mounts a `/data` cache, and detects devices)
-> [`autotag`](/docs/run.md#autotag) finds a container image that's compatible with your version of JetPack/L4T - either locally, pulled from a registry, or by building it. - -To mount your own directories into the container, use the [`-v`](https://docs.docker.com/engine/reference/commandline/run/#volume) or [`--volume`](https://docs.docker.com/engine/reference/commandline/run/#volume) flags: -```bash -jetson-containers run -v /path/on/host:/path/in/container $(autotag causalconv1d) -``` -To launch the container running a command, as opposed to an interactive shell: -```bash -jetson-containers run $(autotag causalconv1d) my_app --abc xyz -``` -You can pass any options to it that you would to [`docker run`](https://docs.docker.com/engine/reference/commandline/run/), and it'll print out the full command that it constructs before executing it. -
-
-BUILD CONTAINER -
- -If you use [`autotag`](/docs/run.md#autotag) as shown above, it'll ask to build the container for you if needed. To manually build it, first do the [system setup](/docs/setup.md), then run: -```bash -jetson-containers build causalconv1d -``` -The dependencies from above will be built into the container, and it'll be tested during. Run it with [`--help`](/jetson_containers/build.py) for build options. -
diff --git a/packages/ml/transformer_engine/build.sh b/packages/ml/transformer_engine/build.sh index de8456b41..36e8236f3 100755 --- a/packages/ml/transformer_engine/build.sh +++ b/packages/ml/transformer_engine/build.sh @@ -2,25 +2,24 @@ set -ex # Clone the repository if it doesn't exist -git clone --branch=v${TRANSFORMER_ENGINE_VERSION} --depth=1 --recursive https://github.com/Dao-AILab/causal-conv1d /opt/transformer_engine || \ -git clone --depth=1 --recursive https://github.com/Dao-AILab/causal-conv1d /opt/transformer_engine +git clone --branch=v${TRANSFORMER_ENGINE_VERSION} --depth=1 --recursive https://github.com/NVIDIA/TransformerEngine /opt/transformer_engine || \ +git clone --depth=1 --recursive https://github.com/NVIDIA/TransformerEngine /opt/transformer_engine # Navigate to the directory containing mamba's setup.py cd /opt/transformer_engine -git apply /tmp/CASUALCONV1D/patch.diff -git diff -git status +# git apply /tmp/TRANSFORMER_ENGINE/patch.diff +# git diff +# git status +export NVTE_FRAMEWORK=pytorch MAX_JOBS=$(nproc) \ -CAUSAL_CONV1D_FORCE_BUILD="TRUE" \ -CAUSAL_CONV1D_SKIP_CUDA_BUILD="FALSE" \ python3 setup.py bdist_wheel --dist-dir=/opt/transformer_engine/wheels -pip3 install --no-cache-dir --verbose /opt/transformer_engine/wheels/causal_conv1d*.whl +pip3 install --no-cache-dir --verbose /opt/transformer_engine/wheels/transformer_engine*.whl cd /opt/transformer_engine pip3 install 'numpy<2' # Optionally upload to a repository using Twine -twine upload --verbose /opt/transformer_engine/wheels/causal_conv1d*.whl || echo "Failed to upload wheel to ${TWINE_REPOSITORY_URL}" +twine upload --verbose /opt/transformer_engine/wheels/transformer_engine*.whl || echo "Failed to upload wheel to ${TWINE_REPOSITORY_URL}" diff --git a/packages/ml/transformer_engine/config.py b/packages/ml/transformer_engine/config.py index 67eec1b1c..47bbbef30 100644 --- a/packages/ml/transformer_engine/config.py +++ b/packages/ml/transformer_engine/config.py @@ -1,30 +1,29 @@ from jetson_containers import CUDA_ARCHITECTURES -def causalconv1d(version, requires=None, default=False): +def transformer_engine(version, requires=None, default=False): pkg = package.copy() if requires: pkg['requires'] = requires - pkg['name'] = f'causalconv1d:{version}' + pkg['name'] = f'transformer_engine:{version}' pkg['build_args'] = { 'CUDAARCHS': ';'.join([str(x) for x in CUDA_ARCHITECTURES]), - 'CASUALCONV1D_VERSION': version, + 'TRANSFORMER_ENGINE_VERSION': version, } builder = pkg.copy() - builder['name'] = f'causalconv1d:{version}-builder' + builder['name'] = f'transformer_engine:{version}-builder' builder['build_args'] = {**pkg['build_args'], **{'FORCE_BUILD': 'on'}} if default: - pkg['alias'] = 'causalconv1d' - builder['alias'] = 'causalconv1d:builder' + pkg['alias'] = 'transformer_engine' + builder['alias'] = 'transformer_engine:builder' return pkg, builder package = [ - causalconv1d('1.4.0'), - causalconv1d('1.6.0', default=True) + transformer_engine('1.14', default=True) ] diff --git a/packages/ml/transformer_engine/install.sh b/packages/ml/transformer_engine/install.sh index 6e765448d..5ca972191 100755 --- a/packages/ml/transformer_engine/install.sh +++ b/packages/ml/transformer_engine/install.sh @@ -2,8 +2,8 @@ set -ex if [ "$FORCE_BUILD" == "on" ]; then - echo "Forcing build of causal-conv1d ${CAUSALCONV1D}" + echo "Forcing build of transformer_engine ${TRANSFORMER_ENGINE}" exit 1 fi -pip3 install --no-cache-dir --verbose causal_conv1d==${CASUALCONV1D_VERSION} \ No newline at end of file +pip3 install --no-cache-dir --verbose transformer-engine==${TRANSFORMER_ENGINE_VERSION} \ No newline at end of file diff --git a/packages/ml/transformer_engine/test.py b/packages/ml/transformer_engine/test.py index 21eef8830..4b08cb972 100644 --- a/packages/ml/transformer_engine/test.py +++ b/packages/ml/transformer_engine/test.py @@ -1,14 +1,26 @@ #!/usr/bin/env python3 +print ('Transformer Engine Test') import torch -from causal_conv1d import causal_conv1d_fn -import causal_conv1d_cuda +import transformer_engine.pytorch as te +from transformer_engine.common import recipe -batch, dim, seq, width = 10, 5, 17, 4 -x = torch.zeros((batch, dim, seq)).to('cuda') -weight = torch.zeros((dim, width)).to('cuda') -bias = torch.zeros((dim, )).to('cuda') +# Set dimensions. +in_features = 768 +out_features = 3072 +hidden_size = 2048 -causal_conv1d_fn(x, weight, bias, None) -conv1d_out = causal_conv1d_cuda.causal_conv1d_fwd(x, weight, bias, None, None, None, True) +# Initialize model and inputs. +model = te.Linear(in_features, out_features, bias=True) +inp = torch.randn(hidden_size, in_features, device="cuda") -print('causal_conv1d OK\n') \ No newline at end of file +# Create an FP8 recipe. Note: All input args are optional. +fp8_recipe = recipe.DelayedScaling(margin=0, fp8_format=recipe.Format.E4M3) + +# Enable autocasting for the forward pass +with te.fp8_autocast(enabled=True, fp8_recipe=fp8_recipe): + out = model(inp) + +loss = out.sum() +loss.backward() + +print('Transformer Engine OK\n') \ No newline at end of file From 84855f61f3048098d9664bf23411baa1f6e1c1e0 Mon Sep 17 00:00:00 2001 From: johnnynunez Date: Fri, 10 Jan 2025 15:15:24 +0100 Subject: [PATCH 03/23] fix --- packages/ml/transformer_engine/config.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ml/transformer_engine/config.py b/packages/ml/transformer_engine/config.py index 47bbbef30..9c5775a1a 100644 --- a/packages/ml/transformer_engine/config.py +++ b/packages/ml/transformer_engine/config.py @@ -6,7 +6,7 @@ def transformer_engine(version, requires=None, default=False): if requires: pkg['requires'] = requires - pkg['name'] = f'transformer_engine:{version}' + pkg['name'] = f'transformer-engine:{version}' pkg['build_args'] = { 'CUDAARCHS': ';'.join([str(x) for x in CUDA_ARCHITECTURES]), @@ -15,12 +15,12 @@ def transformer_engine(version, requires=None, default=False): builder = pkg.copy() - builder['name'] = f'transformer_engine:{version}-builder' + builder['name'] = f'transformer-engine:{version}-builder' builder['build_args'] = {**pkg['build_args'], **{'FORCE_BUILD': 'on'}} if default: - pkg['alias'] = 'transformer_engine' - builder['alias'] = 'transformer_engine:builder' + pkg['alias'] = 'transformer-engine' + builder['alias'] = 'transformer-engine:builder' return pkg, builder From 1b62d3b0fa745f8d026da1a1ae798ddcafc3ed94 Mon Sep 17 00:00:00 2001 From: johnnynunez Date: Fri, 10 Jan 2025 15:17:56 +0100 Subject: [PATCH 04/23] fix --- packages/ml/transformer_engine/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ml/transformer_engine/Dockerfile b/packages/ml/transformer_engine/Dockerfile index 382b88579..03104ec03 100644 --- a/packages/ml/transformer_engine/Dockerfile +++ b/packages/ml/transformer_engine/Dockerfile @@ -2,7 +2,7 @@ # name: transformer-engine # group: ml # config: config.py -# depends: [pytorch, flash-attention] +# depends: [pytorch, torchvision, onnxruntime, flash-attention] # requires: '>=34.1.0' # test: test.py # notes: https://docs.nvidia.com/deeplearning/transformer-engine/user-guide/index.html From 1470140824d6a33ec6d058d477eb884c65a1eaa6 Mon Sep 17 00:00:00 2001 From: Johnny Date: Fri, 10 Jan 2025 15:23:42 +0100 Subject: [PATCH 05/23] cosmos --- packages/diffusion/cosmos/Dockerfile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 packages/diffusion/cosmos/Dockerfile diff --git a/packages/diffusion/cosmos/Dockerfile b/packages/diffusion/cosmos/Dockerfile new file mode 100644 index 000000000..aeadbf01e --- /dev/null +++ b/packages/diffusion/cosmos/Dockerfile @@ -0,0 +1,19 @@ +#--- +# name: cosmos +# group: diffusion +# depends: [pytorch, torchvision, torchaudio, transformers, bitsandbytes, transformer-engine, huggingface_hub] +# requires: '>=34.1.0' +# docs: https://github.com/NVIDIA/Cosmos +#--- + +ARG BASE_IMAGE +FROM ${BASE_IMAGE} + +WORKDIR /opt + +RUN git clone --recursive https://github.com/NVIDIA/Cosmos && \ + cd Cosmos && \ + pip3 install --no-cache-dir einops attrs pynvml opencv-python protobuf && \ + pip3 install --no-cache-dir -r requirements.txt + +WORKDIR /opt/cosmos/ \ No newline at end of file From 1459af6c1e28e485b61ad20f8074dca83178504d Mon Sep 17 00:00:00 2001 From: Johnny Date: Fri, 10 Jan 2025 15:46:23 +0100 Subject: [PATCH 06/23] cosmos --- packages/diffusion/cosmos/Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/diffusion/cosmos/Dockerfile b/packages/diffusion/cosmos/Dockerfile index aeadbf01e..9878f5381 100644 --- a/packages/diffusion/cosmos/Dockerfile +++ b/packages/diffusion/cosmos/Dockerfile @@ -1,7 +1,7 @@ #--- # name: cosmos # group: diffusion -# depends: [pytorch, torchvision, torchaudio, transformers, bitsandbytes, transformer-engine, huggingface_hub] +# depends: [ffmpeg, pytorch, torchvision, torchaudio, transformers, bitsandbytes, transformer-engine, huggingface_hub] # requires: '>=34.1.0' # docs: https://github.com/NVIDIA/Cosmos #--- @@ -11,9 +11,14 @@ FROM ${BASE_IMAGE} WORKDIR /opt +RUN apt-get update && apt-get install -y \ + ffmpeg \ + && rm -rf /var/lib/apt/lists/* + RUN git clone --recursive https://github.com/NVIDIA/Cosmos && \ cd Cosmos && \ pip3 install --no-cache-dir einops attrs pynvml opencv-python protobuf && \ pip3 install --no-cache-dir -r requirements.txt -WORKDIR /opt/cosmos/ \ No newline at end of file +WORKDIR /opt/cosmos/ +CMD ["/bin/bash"] \ No newline at end of file From 3d656b03eec1f0dd866e3e946ed60b4a69542d6b Mon Sep 17 00:00:00 2001 From: Johnny Date: Fri, 10 Jan 2025 15:57:18 +0100 Subject: [PATCH 07/23] update opencv --- packages/opencv/config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/opencv/config.py b/packages/opencv/config.py index eba0e059f..261aa6edd 100644 --- a/packages/opencv/config.py +++ b/packages/opencv/config.py @@ -44,7 +44,8 @@ def opencv(version, requires=None, default=False, url=None): # JetPack 5/6 opencv('4.5.0', '==35.*', default=False), opencv('4.8.1', '>=35', default=(CUDA_VERSION <= Version('12.2'))), - opencv('4.10.0', '>=35', default=(CUDA_VERSION > Version('12.2'))), + opencv('4.10.0', '>=35'), + opencv('4.11.0', '>=35', default=(CUDA_VERSION > Version('12.2'))), # JetPack 4 opencv('4.5.0', '==32.*', default=True, url='https://nvidia.box.com/shared/static/5v89u6g5rb62fpz4lh0rz531ajo2t5ef.gz'), From 07067426fcbbb1eaa52c7c62334e9d6affe281ba Mon Sep 17 00:00:00 2001 From: Johnny Date: Fri, 10 Jan 2025 15:59:52 +0100 Subject: [PATCH 08/23] update opencv --- packages/README.md | 6 +++--- packages/ml/mamba/zigma/Dockerfile | 2 +- packages/robots/crossformer/Dockerfile | 2 +- packages/robots/crossformer/README.md | 2 +- packages/robots/lerobot/Dockerfile | 2 +- packages/robots/lerobot/README.md | 2 +- packages/robots/octo/Dockerfile | 2 +- packages/robots/octo/README.md | 2 +- packages/vlm/shape-llm/Dockerfile | 2 +- packages/vlm/shape-llm/README.md | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/README.md b/packages/README.md index 091ce70cf..b02138066 100644 --- a/packages/README.md +++ b/packages/README.md @@ -40,9 +40,9 @@ |     [`jupyterlab:myst`](/packages/jupyterlab) | | |     [`ninja`](/packages/build/ninja) | | |     [`numpy`](/packages/numeric/numpy) | [![`numpy_jp46`](https://img.shields.io/github/actions/workflow/status/dusty-nv/jetson-containers/numpy_jp46.yml?label=numpy:jp46)](https://github.com/dusty-nv/jetson-containers/actions/workflows/numpy_jp46.yml) [![`numpy_jp51`](https://img.shields.io/github/actions/workflow/status/dusty-nv/jetson-containers/numpy_jp51.yml?label=numpy:jp51)](https://github.com/dusty-nv/jetson-containers/actions/workflows/numpy_jp51.yml) [![`numpy_jp60`](https://img.shields.io/github/actions/workflow/status/dusty-nv/jetson-containers/numpy_jp60.yml?label=numpy:jp60)](https://github.com/dusty-nv/jetson-containers/actions/workflows/numpy_jp60.yml) | -|     [`opencv:4.10.0`](/packages/opencv) | | -|     [`opencv:4.10.0-builder`](/packages/opencv) | | -|     [`opencv:4.10.0-meta`](/packages/opencv) | | +|     [`opencv:4.11.0`](/packages/opencv) | | +|     [`opencv:4.11.0-builder`](/packages/opencv) | | +|     [`opencv:4.11.0-meta`](/packages/opencv) | | |     [`opencv:4.8.1`](/packages/opencv) | [![`opencv-481_jp60`](https://img.shields.io/github/actions/workflow/status/dusty-nv/jetson-containers/opencv-481_jp60.yml?label=opencv-481:jp60)](https://github.com/dusty-nv/jetson-containers/actions/workflows/opencv-481_jp60.yml) | |     [`opencv:4.8.1-builder`](/packages/opencv) | | |     [`opencv:4.8.1-deb`](/packages/opencv) | | diff --git a/packages/ml/mamba/zigma/Dockerfile b/packages/ml/mamba/zigma/Dockerfile index bcc243883..8913018a2 100644 --- a/packages/ml/mamba/zigma/Dockerfile +++ b/packages/ml/mamba/zigma/Dockerfile @@ -2,7 +2,7 @@ # name: zigma # group: mamba # config: config.py -# depends: [pytorch, torchvision, opencv:4.10.0, transformers, xformers, triton, causalconv1d, mamba] +# depends: [pytorch, torchvision, opencv:4.11.0, transformers, xformers, triton, causalconv1d, mamba] # requires: '>=34.1.0' # test: test.py # notes: https://github.com/CompVis/zigma diff --git a/packages/robots/crossformer/Dockerfile b/packages/robots/crossformer/Dockerfile index e35544f0f..16a51afb1 100644 --- a/packages/robots/crossformer/Dockerfile +++ b/packages/robots/crossformer/Dockerfile @@ -2,7 +2,7 @@ # name: crossformer # group: robots # docs: docs.md -# depends: [transformers, opencv:4.10.0, jax, h5py] +# depends: [transformers, opencv:4.11.0, jax, h5py] # requires: '>=36' # test: test.py #--- diff --git a/packages/robots/crossformer/README.md b/packages/robots/crossformer/README.md index 64d744b4b..ac0e00d00 100644 --- a/packages/robots/crossformer/README.md +++ b/packages/robots/crossformer/README.md @@ -10,7 +10,7 @@ docs.md | **`crossformer`** | | | :-- | :-- | |    Requires | `L4T ['>=36']` | -|    Dependencies | [`build-essential`](/packages/build/build-essential) [`pip_cache:cu122`](/packages/cuda/cuda) [`cuda:12.2`](/packages/cuda/cuda) [`cudnn`](/packages/cuda/cudnn) [`python`](/packages/build/python) [`numpy`](/packages/numeric/numpy) [`cmake`](/packages/build/cmake/cmake_pip) [`onnx`](/packages/ml/onnx) [`pytorch:2.2`](/packages/pytorch) [`torchvision`](/packages/pytorch/torchvision) [`huggingface_hub`](/packages/llm/huggingface_hub) [`rust`](/packages/build/rust) [`transformers`](/packages/llm/transformers) [`opencv:4.10.0`](/packages/opencv) [`jax`](/packages/ml/jax) [`h5py`](/packages/build/h5py) | +|    Dependencies | [`build-essential`](/packages/build/build-essential) [`pip_cache:cu122`](/packages/cuda/cuda) [`cuda:12.2`](/packages/cuda/cuda) [`cudnn`](/packages/cuda/cudnn) [`python`](/packages/build/python) [`numpy`](/packages/numeric/numpy) [`cmake`](/packages/build/cmake/cmake_pip) [`onnx`](/packages/ml/onnx) [`pytorch:2.2`](/packages/pytorch) [`torchvision`](/packages/pytorch/torchvision) [`huggingface_hub`](/packages/llm/huggingface_hub) [`rust`](/packages/build/rust) [`transformers`](/packages/llm/transformers) [`opencv:4.11.0`](/packages/opencv) [`jax`](/packages/ml/jax) [`h5py`](/packages/build/h5py) | |    Dockerfile | [`Dockerfile`](Dockerfile) | |    Images | [`dustynv/crossformer:r36.3.0`](https://hub.docker.com/r/dustynv/crossformer/tags) `(2024-09-30, 8.7GB)` | diff --git a/packages/robots/lerobot/Dockerfile b/packages/robots/lerobot/Dockerfile index c4df8ba82..c1cde7ce8 100644 --- a/packages/robots/lerobot/Dockerfile +++ b/packages/robots/lerobot/Dockerfile @@ -2,7 +2,7 @@ # name: lerobot # group: robots # docs: docs.md -# depends: [transformers, opencv:4.10.0, pyav, h5py, jupyterlab:myst] +# depends: [transformers, opencv:4.11.0, pyav, h5py, jupyterlab:myst] # requires: '>=36' # test: [test.sh, test.py] #--- diff --git a/packages/robots/lerobot/README.md b/packages/robots/lerobot/README.md index a191e4d5f..92dbd4b94 100644 --- a/packages/robots/lerobot/README.md +++ b/packages/robots/lerobot/README.md @@ -163,7 +163,7 @@ Now follow the Jupyter notebook contents. | **`lerobot`** | | | :-- | :-- | |    Requires | `L4T ['>=36']` | -|    Dependencies | [`build-essential`](/packages/build/build-essential) [`pip_cache:cu122`](/packages/cuda/cuda) [`cuda:12.2`](/packages/cuda/cuda) [`cudnn`](/packages/cuda/cudnn) [`python`](/packages/build/python) [`numpy`](/packages/numeric/numpy) [`cmake`](/packages/build/cmake/cmake_pip) [`onnx`](/packages/ml/onnx) [`pytorch:2.2`](/packages/pytorch) [`torchvision`](/packages/pytorch/torchvision) [`huggingface_hub`](/packages/llm/huggingface_hub) [`rust`](/packages/build/rust) [`transformers`](/packages/llm/transformers) [`opencv:4.10.0`](/packages/opencv) [`pyav`](/packages/multimedia/pyav) [`h5py`](/packages/build/h5py) [`jupyterlab:main`](/packages/jupyterlab) [`jupyterlab:myst`](/packages/jupyterlab) | +|    Dependencies | [`build-essential`](/packages/build/build-essential) [`pip_cache:cu122`](/packages/cuda/cuda) [`cuda:12.2`](/packages/cuda/cuda) [`cudnn`](/packages/cuda/cudnn) [`python`](/packages/build/python) [`numpy`](/packages/numeric/numpy) [`cmake`](/packages/build/cmake/cmake_pip) [`onnx`](/packages/ml/onnx) [`pytorch:2.2`](/packages/pytorch) [`torchvision`](/packages/pytorch/torchvision) [`huggingface_hub`](/packages/llm/huggingface_hub) [`rust`](/packages/build/rust) [`transformers`](/packages/llm/transformers) [`opencv:4.11.0`](/packages/opencv) [`pyav`](/packages/multimedia/pyav) [`h5py`](/packages/build/h5py) [`jupyterlab:main`](/packages/jupyterlab) [`jupyterlab:myst`](/packages/jupyterlab) | |    Dockerfile | [`Dockerfile`](Dockerfile) | |    Images | [`dustynv/lerobot:r36.3.0`](https://hub.docker.com/r/dustynv/lerobot/tags) `(2024-10-15, 7.6GB)`
[`dustynv/lerobot:r36.4.0`](https://hub.docker.com/r/dustynv/lerobot/tags) `(2024-10-15, 6.3GB)` | diff --git a/packages/robots/octo/Dockerfile b/packages/robots/octo/Dockerfile index 81a1b4334..088a7c46b 100644 --- a/packages/robots/octo/Dockerfile +++ b/packages/robots/octo/Dockerfile @@ -2,7 +2,7 @@ # name: octo # group: robots # docs: docs.md -# depends: [transformers, opencv:4.10.0, jax, h5py] +# depends: [transformers, opencv:4.11.0, jax, h5py] # requires: '>=36' # test: test.py #--- diff --git a/packages/robots/octo/README.md b/packages/robots/octo/README.md index f89a0641f..d559268ad 100644 --- a/packages/robots/octo/README.md +++ b/packages/robots/octo/README.md @@ -10,7 +10,7 @@ docs.md | **`octo`** | | | :-- | :-- | |    Requires | `L4T ['>=36']` | -|    Dependencies | [`build-essential`](/packages/build/build-essential) [`pip_cache:cu122`](/packages/cuda/cuda) [`cuda:12.2`](/packages/cuda/cuda) [`cudnn`](/packages/cuda/cudnn) [`python`](/packages/build/python) [`numpy`](/packages/numeric/numpy) [`cmake`](/packages/build/cmake/cmake_pip) [`onnx`](/packages/ml/onnx) [`pytorch:2.2`](/packages/pytorch) [`torchvision`](/packages/pytorch/torchvision) [`huggingface_hub`](/packages/llm/huggingface_hub) [`rust`](/packages/build/rust) [`transformers`](/packages/llm/transformers) [`opencv:4.10.0`](/packages/opencv) [`jax`](/packages/ml/jax) [`h5py`](/packages/build/h5py) | +|    Dependencies | [`build-essential`](/packages/build/build-essential) [`pip_cache:cu122`](/packages/cuda/cuda) [`cuda:12.2`](/packages/cuda/cuda) [`cudnn`](/packages/cuda/cudnn) [`python`](/packages/build/python) [`numpy`](/packages/numeric/numpy) [`cmake`](/packages/build/cmake/cmake_pip) [`onnx`](/packages/ml/onnx) [`pytorch:2.2`](/packages/pytorch) [`torchvision`](/packages/pytorch/torchvision) [`huggingface_hub`](/packages/llm/huggingface_hub) [`rust`](/packages/build/rust) [`transformers`](/packages/llm/transformers) [`opencv:4.11.0`](/packages/opencv) [`jax`](/packages/ml/jax) [`h5py`](/packages/build/h5py) | |    Dockerfile | [`Dockerfile`](Dockerfile) | |    Images | [`dustynv/octo:r36.3.0`](https://hub.docker.com/r/dustynv/octo/tags) `(2024-09-30, 8.7GB)` | diff --git a/packages/vlm/shape-llm/Dockerfile b/packages/vlm/shape-llm/Dockerfile index 1fd94dbd4..0e7ccff01 100644 --- a/packages/vlm/shape-llm/Dockerfile +++ b/packages/vlm/shape-llm/Dockerfile @@ -2,7 +2,7 @@ # name: shape-llm # alias: shape_llm # group: vlm -# depends: [transformers, bitsandbytes, flash-attention, opencv:4.10.0] +# depends: [transformers, bitsandbytes, flash-attention, opencv:4.11.0] # requires: '>=35' # test: [test.sh, test.py] #--- diff --git a/packages/vlm/shape-llm/README.md b/packages/vlm/shape-llm/README.md index ce27d61db..9c7d1b05c 100644 --- a/packages/vlm/shape-llm/README.md +++ b/packages/vlm/shape-llm/README.md @@ -10,7 +10,7 @@ | :-- | :-- | |    Aliases | `shape_llm` | |    Requires | `L4T ['>=35']` | -|    Dependencies | [`build-essential`](/packages/build/build-essential) [`pip_cache:cu122`](/packages/cuda/cuda) [`cuda:12.2`](/packages/cuda/cuda) [`cudnn`](/packages/cuda/cudnn) [`python`](/packages/build/python) [`numpy`](/packages/numeric/numpy) [`cmake`](/packages/build/cmake/cmake_pip) [`onnx`](/packages/ml/onnx) [`pytorch:2.2`](/packages/pytorch) [`torchvision`](/packages/pytorch/torchvision) [`huggingface_hub`](/packages/llm/huggingface_hub) [`rust`](/packages/build/rust) [`transformers`](/packages/llm/transformers) [`bitsandbytes`](/packages/llm/bitsandbytes) [`flash-attention`](/packages/llm/flash-attention) [`opencv:4.10.0`](/packages/opencv) | +|    Dependencies | [`build-essential`](/packages/build/build-essential) [`pip_cache:cu122`](/packages/cuda/cuda) [`cuda:12.2`](/packages/cuda/cuda) [`cudnn`](/packages/cuda/cudnn) [`python`](/packages/build/python) [`numpy`](/packages/numeric/numpy) [`cmake`](/packages/build/cmake/cmake_pip) [`onnx`](/packages/ml/onnx) [`pytorch:2.2`](/packages/pytorch) [`torchvision`](/packages/pytorch/torchvision) [`huggingface_hub`](/packages/llm/huggingface_hub) [`rust`](/packages/build/rust) [`transformers`](/packages/llm/transformers) [`bitsandbytes`](/packages/llm/bitsandbytes) [`flash-attention`](/packages/llm/flash-attention) [`opencv:4.11.0`](/packages/opencv) | |    Dockerfile | [`Dockerfile`](Dockerfile) | From a5784677ceabbeb02ecd9f3ac1d5505d6f15f00f Mon Sep 17 00:00:00 2001 From: Johnny Date: Fri, 10 Jan 2025 16:12:02 +0100 Subject: [PATCH 09/23] update test transformer_engine --- .../Dockerfile | 0 .../build.sh | 0 .../config.py | 0 .../install.sh | 0 .../test.py | 26 ++++++++++++++++++- 5 files changed, 25 insertions(+), 1 deletion(-) rename packages/ml/{transformer_engine => transformer-engine}/Dockerfile (100%) rename packages/ml/{transformer_engine => transformer-engine}/build.sh (100%) mode change 100755 => 100644 rename packages/ml/{transformer_engine => transformer-engine}/config.py (100%) rename packages/ml/{transformer_engine => transformer-engine}/install.sh (100%) mode change 100755 => 100644 rename packages/ml/{transformer_engine => transformer-engine}/test.py (54%) diff --git a/packages/ml/transformer_engine/Dockerfile b/packages/ml/transformer-engine/Dockerfile similarity index 100% rename from packages/ml/transformer_engine/Dockerfile rename to packages/ml/transformer-engine/Dockerfile diff --git a/packages/ml/transformer_engine/build.sh b/packages/ml/transformer-engine/build.sh old mode 100755 new mode 100644 similarity index 100% rename from packages/ml/transformer_engine/build.sh rename to packages/ml/transformer-engine/build.sh diff --git a/packages/ml/transformer_engine/config.py b/packages/ml/transformer-engine/config.py similarity index 100% rename from packages/ml/transformer_engine/config.py rename to packages/ml/transformer-engine/config.py diff --git a/packages/ml/transformer_engine/install.sh b/packages/ml/transformer-engine/install.sh old mode 100755 new mode 100644 similarity index 100% rename from packages/ml/transformer_engine/install.sh rename to packages/ml/transformer-engine/install.sh diff --git a/packages/ml/transformer_engine/test.py b/packages/ml/transformer-engine/test.py similarity index 54% rename from packages/ml/transformer_engine/test.py rename to packages/ml/transformer-engine/test.py index 4b08cb972..288a6dce7 100644 --- a/packages/ml/transformer_engine/test.py +++ b/packages/ml/transformer-engine/test.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 print ('Transformer Engine Test') -import torch +"""import torch import transformer_engine.pytorch as te from transformer_engine.common import recipe @@ -20,7 +20,31 @@ with te.fp8_autocast(enabled=True, fp8_recipe=fp8_recipe): out = model(inp) +loss = out.sum() +loss.backward()""" + +# AMPERE not has fp8 support +#!/usr/bin/env python3 +print('Transformer Engine Test (FP16 with Ampere)') +import torch +import transformer_engine.pytorch as te + +# Set dimensions. +in_features = 768 +out_features = 3072 +hidden_size = 2048 + +# Initialize model and inputs on the GPU. +model = te.Linear(in_features, out_features, bias=True).cuda() +inp = torch.randn(hidden_size, in_features, device="cuda") + +# Enable autocasting for the forward pass using FP16 +with torch.cuda.amp.autocast(): + out = model(inp) + loss = out.sum() loss.backward() +print('Transformer Engine with FP16 OK\n') + print('Transformer Engine OK\n') \ No newline at end of file From 42b6d8345c624d88e2192499a17ccc4a80f1af15 Mon Sep 17 00:00:00 2001 From: Johnny Date: Fri, 10 Jan 2025 16:17:24 +0100 Subject: [PATCH 10/23] update test transformer_engine --- packages/ml/transformer-engine/test.py | 71 ++++++++++++++++---------- 1 file changed, 43 insertions(+), 28 deletions(-) diff --git a/packages/ml/transformer-engine/test.py b/packages/ml/transformer-engine/test.py index 288a6dce7..164604f4e 100644 --- a/packages/ml/transformer-engine/test.py +++ b/packages/ml/transformer-engine/test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 print ('Transformer Engine Test') -"""import torch +print('Transformer Engine Test (FP8, FP16, FP32)') +import torch import transformer_engine.pytorch as te from transformer_engine.common import recipe @@ -9,42 +10,56 @@ out_features = 3072 hidden_size = 2048 -# Initialize model and inputs. -model = te.Linear(in_features, out_features, bias=True) +# Initialize model and inputs on the GPU. +model = te.Linear(in_features, out_features, bias=True).cuda() inp = torch.randn(hidden_size, in_features, device="cuda") -# Create an FP8 recipe. Note: All input args are optional. -fp8_recipe = recipe.DelayedScaling(margin=0, fp8_format=recipe.Format.E4M3) +# --- FP8 Attempt --- +try: + print("Trying FP8...") + # Create an FP8 recipe. + fp8_recipe = recipe.DelayedScaling(margin=0, fp8_format=recipe.Format.E4M3) -# Enable autocasting for the forward pass -with te.fp8_autocast(enabled=True, fp8_recipe=fp8_recipe): - out = model(inp) + # Enable autocasting for the forward pass using FP8 + with te.fp8_autocast(enabled=True, fp8_recipe=fp8_recipe): + out = model(inp) + loss = out.sum() + loss.backward() + print("FP8 Successful!\n") -loss = out.sum() -loss.backward()""" +except RuntimeError as e: + print(f"FP8 Failed: {e} or not supported (Ampere)") -# AMPERE not has fp8 support -#!/usr/bin/env python3 -print('Transformer Engine Test (FP16 with Ampere)') -import torch -import transformer_engine.pytorch as te + # --- FP16 Attempt --- + try: + print("Trying FP16...") + # Reset gradients + model.zero_grad() -# Set dimensions. -in_features = 768 -out_features = 3072 -hidden_size = 2048 + # Enable autocasting for the forward pass using FP16 + with torch.cuda.amp.autocast(): + out = model(inp) + loss = out.sum() + loss.backward() + print("FP16 Successful!\n") -# Initialize model and inputs on the GPU. -model = te.Linear(in_features, out_features, bias=True).cuda() -inp = torch.randn(hidden_size, in_features, device="cuda") + except RuntimeError as e: + print(f"FP16 Failed: {e}") -# Enable autocasting for the forward pass using FP16 -with torch.cuda.amp.autocast(): - out = model(inp) + # --- FP32 Attempt --- + try: + print("Trying FP32...") + # Reset gradients + model.zero_grad() -loss = out.sum() -loss.backward() + # Run forward and backward pass in FP32 + out = model(inp) + loss = out.sum() + loss.backward() + print("FP32 Successful!\n") -print('Transformer Engine with FP16 OK\n') + except Exception as e: + print(f"FP32 Failed: {e}") + print("All attempts failed.\n") print('Transformer Engine OK\n') \ No newline at end of file From 3bf6e2a91cf07840373776519032dd2e14d421ee Mon Sep 17 00:00:00 2001 From: johnnynunez Date: Fri, 10 Jan 2025 16:31:09 +0100 Subject: [PATCH 11/23] fix --- packages/ml/transformer-engine/Dockerfile | 2 +- packages/ml/transformer-engine/build.sh | 0 packages/ml/transformer-engine/install.sh | 0 packages/ml/transformer-engine/test.py | 0 run.sh | 358 ---------------------- 5 files changed, 1 insertion(+), 359 deletions(-) mode change 100644 => 100755 packages/ml/transformer-engine/build.sh mode change 100644 => 100755 packages/ml/transformer-engine/install.sh mode change 100644 => 100755 packages/ml/transformer-engine/test.py delete mode 100755 run.sh diff --git a/packages/ml/transformer-engine/Dockerfile b/packages/ml/transformer-engine/Dockerfile index 03104ec03..ae1c8965d 100644 --- a/packages/ml/transformer-engine/Dockerfile +++ b/packages/ml/transformer-engine/Dockerfile @@ -13,7 +13,7 @@ FROM ${BASE_IMAGE} ARG TRANSFORMER_ENGINE_VERSION \ CUDAARCHS -# COPY build.sh install.sh /tmp/TRANSFORMER_ENGINE/ +COPY build.sh install.sh /tmp/TRANSFORMER_ENGINE/ # COPY patches/${TRANSFORMER_ENGINE_VERSION}.diff /tmp/TRANSFORMER_ENGINE/patch.diff diff --git a/packages/ml/transformer-engine/build.sh b/packages/ml/transformer-engine/build.sh old mode 100644 new mode 100755 diff --git a/packages/ml/transformer-engine/install.sh b/packages/ml/transformer-engine/install.sh old mode 100644 new mode 100755 diff --git a/packages/ml/transformer-engine/test.py b/packages/ml/transformer-engine/test.py old mode 100644 new mode 100755 diff --git a/run.sh b/run.sh deleted file mode 100755 index 4fffdcb29..000000000 --- a/run.sh +++ /dev/null @@ -1,358 +0,0 @@ -#!/usr/bin/env bash -# pass-through commands to 'docker run' with some defaults -# https://docs.docker.com/engine/reference/commandline/run/ -ROOT="$(dirname "$(readlink -f "$0")")" - -# Function to clean up background processes -cleanup() { - if [[ ${#BG_PIDS[@]} -gt 0 ]]; then - echo "Terminating background processes..." - for pid in "${BG_PIDS[@]}"; do - kill "$pid" # Terminate each background process - wait "$pid" 2>/dev/null # Wait for the process to finish - done - fi - sudo modprobe -r v4l2loopback -} - -# Trap signals like INT (Ctrl+C) or TERM to invoke the cleanup function -trap cleanup INT TERM - -# Initialize variables (default for arguments) -csi_to_webcam_conversion=false -capture_res="1640x1232@30" -output_res="1280x720@30" -capture_width="1640" -capture_height="1232" -capture_fps="30" -output_width="1280" -output_height="720" -output_fps="30" - -# Loop through arguments -for arg in "$@"; do - # Check for the --csi2webcam option - if [[ "$arg" == "--csi2webcam" ]]; then - csi_to_webcam_conversion=true - continue # Move to next argument - fi - - # Check for --csi-capture-res - if [[ "$arg" =~ --csi-capture-res= ]]; then - csi_capture_res="${arg#*=}" - # Extract width, height, and fps from capture_res - if [[ $csi_capture_res =~ ([0-9]+)x([0-9]+)@([0-9]+) ]]; then - capture_width="${BASH_REMATCH[1]}" - capture_height="${BASH_REMATCH[2]}" - capture_fps="${BASH_REMATCH[3]}" - else - echo "Invalid format for --csi-capture-res. Expected format: widthxheight@fps" - exit 1 - fi - continue - fi - - # Check for --csi-output-res - if [[ "$arg" =~ --csi-output-res= ]]; then - csi_output_res="${arg#*=}" - # Extract width, height, and fps from output_res - if [[ $csi_output_res =~ ([0-9]+)x([0-9]+)@([0-9]+) ]]; then - output_width="${BASH_REMATCH[1]}" - output_height="${BASH_REMATCH[2]}" - output_fps="${BASH_REMATCH[3]}" - else - echo "Invalid format for --csi-output-res. Expected format: widthxheight@fps" - exit 1 - fi - continue - fi -done - -# check for V4L2 devices -V4L2_DEVICES="" - -if [[ "$csi_to_webcam_conversion" == true ]]; then - - echo "CSI to Webcam conversion enabled." - echo "CSI Capture resolution: ${capture_width}x${capture_height}@${capture_fps}" - echo "CSI Output resolution : ${output_width}x${output_height}@${output_fps}" - - # Check if v4l2loopback-dkms is installed - if dpkg -l | grep -q v4l2loopback-dkms; then - echo "( v4l2loopback-dkms is installed. )" - else - echo "[Error] v4l2loopback-dkms is not installed." - echo " " - echo "Perform the following command to first install v4l2loopback moddule." - echo " " - echo " sudo apt update && sudo apt install v4l2loopback-dkms" - echo " " - exit 1 - fi - - # Check if v4l2-ctl is installed - if command -v v4l2-ctl &> /dev/null - then - echo "(v4l2-ctl is installed)" - else - echo "[Error] v4l2-ctl is not installed" - echo " " - echo "Perform the following command to first install v4l-utils package." - echo " " - echo " sudo apt install v4l-utils" - echo " " - exit 1 - fi - - sudo systemctl restart nvargus-daemon.service - - # Store /dev/video index number for each CSI camera found - csi_indexes=() - # Store /dev/video* device name for each CSI camera found - csi_devices=() - - # Loop through all matching /dev/video* devices - for device in /dev/video*; do - # Use v4l2-ctl to check if the device supports RG10 (CSI camera format) - if v4l2-ctl -d "$device" --list-formats-ext 2>/dev/null | grep -q "RG10"; then - echo "$device is a CSI camera (RG10 format)" - # Store the device name in array if CSI camera - csi_devices+=("$device") - # Extract the device index number and add to the csi_devices array - dev_index=$(echo "$device" | grep -o '[0-9]\+') - csi_indexes+=("$dev_index") - else - echo "$device is not a CSI camera (likely a webcam)" - V4L2_DEVICES="$V4L2_DEVICES --device $device " - fi - done - - # Load the v4l2loopback module to create as many devices as CSI cameras found in the prior step - sudo modprobe v4l2loopback devices=${#csi_indexes[@]} exclusive_caps=1 card_label="Cam1,Cam2" - - # Get all new /dev/video devices created by v4l2loopback - new_devices=($(v4l2-ctl --list-devices | grep -A 1 "v4l2loopback" | grep '/dev/video' | awk '{print $1}')) - echo "###### new_devices: ${new_devices[@]}" - - # add the created v4l2loopback devices - if [[ -n "${new_devices[@]}" ]]; then - for converted_device in ${new_devices[@]}; do - V4L2_DEVICES="$V4L2_DEVICES --device $converted_device " - done - else - echo "No v4l2loopback devices found." - fi - - # Save the current DISPLAY variable - ORIGINAL_DISPLAY=$DISPLAY - - # Start background processes for each CSI camera found - i=0 - for csi_index in "${csi_indexes[@]}"; do - echo "Starting background process for CSI camera device number: $csi_index" - - echo "CSI Capture resolution: ${capture_width}x${capture_height}@${capture_fps}" - echo "CSI Output resolution : ${output_width}x${output_height}@${output_fps}" - - # Unset the DISPLAY env variable because, apparently, some GStreamer components might try to use this display - # for video rendering or processing, which can conflict with other GStreamer elements or hardware device - - # Temporarily unset DISPLAY for the GStreamer command - unset DISPLAY - - echo "gst-launch-1.0 -v nvarguscamerasrc sensor-id=${csi_index} \ - ! 'video/x-raw(memory:NVMM), format=NV12, width=${capture_width}, height=${capture_height}, framerate=${capture_fps}/1' \ - ! queue max-size-buffers=1 leaky=downstream ! nvvidconv \ - ! 'video/x-raw, width=${output_width}, height=${output_height}, framerate=${output_fps}/1', format=I420 \ - ! queue max-size-buffers=1 leaky=downstream ! nvjpegenc \ - ! queue max-size-buffers=1 leaky=downstream ! multipartmux \ - ! multipartdemux single-stream=1 \ - ! \"image/jpeg, width=${output_width}, height=${output_height}, parsed=(boolean)true, colorimetry=(string)2:4:7:1, framerate=(fraction)${output_fps}/1, sof-marker=(int)0\" \ - ! v4l2sink device=${new_devices[$i]} sync=false > $ROOT/logs/gst-launch-process_${csi_index}.txt 2>&1 &" - gst-launch-1.0 -v nvarguscamerasrc sensor-id=${csi_index} \ - ! "video/x-raw(memory:NVMM), format=NV12, width=${capture_width}, height=${capture_height}, framerate=${capture_fps}/1" \ - ! queue max-size-buffers=1 leaky=downstream ! nvvidconv \ - ! "video/x-raw, width=${output_width}, height=${output_height}, framerate=${output_fps}/1", format=I420 \ - ! queue max-size-buffers=1 leaky=downstream ! nvjpegenc \ - ! queue max-size-buffers=1 leaky=downstream ! multipartmux \ - ! multipartdemux single-stream=1 \ - ! "image/jpeg, width=${output_width}, height=${output_height}, parsed=(boolean)true, colorimetry=(string)2:4:7:1, framerate=(fraction)${output_fps}/1, sof-marker=(int)0" \ - ! v4l2sink device=${new_devices[$i]} sync=false > $ROOT/logs/gst-launch-process_${csi_index}.txt 2>&1 & - - # Store the PID of the background process if you want to manage it later - BG_PIDS+=($!) - echo "BG_PIDS: ${BG_PIDS[@]}" - - ((i++)) - done - - # Restore the DISPLAY env variable - export DISPLAY=$ORIGINAL_DISPLAY - -else - # Loop through all matching /dev/video* devices - for device in /dev/video*; do - if [ -e "$device" ]; then # Check if the device file exists - V4L2_DEVICES="$V4L2_DEVICES --device $device " - fi - done -fi - -echo "V4L2_DEVICES: $V4L2_DEVICES" - -if [ -n "$csi_indexes" ]; then - echo "CSI_INDEXES: $csi_indexes" -fi - -# check for I2C devices -I2C_DEVICES="" - -for i in {0..9} -do - if [ -a "/dev/i2c-$i" ]; then - I2C_DEVICES="$I2C_DEVICES --device /dev/i2c-$i " - fi -done - -# check for ttyACM devices -ACM_DEVICES="" - -# Loop through all matching /dev/ttyACM* devices -for dev in /dev/ttyACM*; do - if [ -e "$dev" ]; then # Check if the device file exists - ACM_DEVICES="$ACM_DEVICES --device $dev " - fi -done - -# check for display -DISPLAY_DEVICE="" - -if [ -n "$DISPLAY" ]; then - echo "### DISPLAY environmental variable is already set: \"$DISPLAY\"" - # give docker root user X11 permissions - xhost +si:localuser:root || sudo xhost +si:localuser:root - - # enable SSH X11 forwarding inside container (https://stackoverflow.com/q/48235040) - XAUTH=/tmp/.docker.xauth - xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge - - chmod 777 $XAUTH - - DISPLAY_DEVICE="-e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix -v $XAUTH:$XAUTH -e XAUTHORITY=$XAUTH" -fi - -# check for jtop -JTOP_SOCKET="" -JTOP_SOCKET_FILE="/run/jtop.sock" - -if [ -S "$JTOP_SOCKET_FILE" ]; then - JTOP_SOCKET="-v /run/jtop.sock:/run/jtop.sock" -fi - -# PulseAudio arguments -PULSE_AUDIO_ARGS="" - -if [ -d "${XDG_RUNTIME_DIR}/pulse" ]; then - PULSE_AUDIO_ARGS="-e PULSE_SERVER=unix:${XDG_RUNTIME_DIR}/pulse/native -v ${XDG_RUNTIME_DIR}/pulse:${XDG_RUNTIME_DIR}/pulse" -fi - -# extra flags -EXTRA_FLAGS="" - -if [ -n "$HUGGINGFACE_TOKEN" ]; then - EXTRA_FLAGS="$EXTRA_FLAGS --env HUGGINGFACE_TOKEN=$HUGGINGFACE_TOKEN" -fi - -# additional permission optional run arguments -OPTIONAL_PERMISSION_ARGS="" - -if [ "$USE_OPTIONAL_PERMISSION_ARGS" = "true" ]; then - OPTIONAL_PERMISSION_ARGS="-v /lib/modules:/lib/modules --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor=unconfined" -fi - -# check if sudo is needed -if [ $(id -u) -eq 0 ] || id -nG "$USER" | grep -qw "docker"; then - SUDO="" -else - SUDO="sudo" -fi - -# Initialize an empty array for filtered arguments -filtered_args=() - -# Loop through all provided arguments -for arg in "$@"; do - if [[ "$arg" != "--csi2webcam" && "$arg" != --csi-capture-res=* && "$arg" != --csi-output-res=* ]]; then - filtered_args+=("$arg") # Add to the new array if not the argument to remove - fi - - if [[ "$arg" = "--name" || "$arg" = --name* ]]; then - HAS_CONTAINER_NAME=1 - fi -done - -if [ -z "$HAS_CONTAINER_NAME" ]; then - # Generate a unique container name so we can wait for it to exit and cleanup the bg processes after - BUILD_DATE_TIME=$(date +%Y%m%d_%H%M%S) - #CONTAINER_IMAGE_NAME=$(basename "${filtered_args[0]}") # unfortunately this doesn't work in the general case, and you can't easily parse the container image from the command-line - #SANITIZED_CONTAINER_IMAGE_NAME=$(echo "$CONTAINER_IMAGE_NAME" | sed 's/[^a-zA-Z0-9_.-]/_/g') - CONTAINER_NAME="jetson_container_${BUILD_DATE_TIME}" - CONTAINER_NAME_FLAGS="--name $CONTAINER_NAME" -fi - -# run the container -ARCH=$(uname -i) - -if [ $ARCH = "aarch64" ]; then - - # this file shows what Jetson board is running - # /proc or /sys files aren't mountable into docker - cat /proc/device-tree/model > /tmp/nv_jetson_model - - # https://stackoverflow.com/a/19226038 - ( set -x ; - - $SUDO docker run --runtime nvidia -it --rm --network host \ - --shm-size=8g \ - --volume /tmp/argus_socket:/tmp/argus_socket \ - --volume /etc/enctune.conf:/etc/enctune.conf \ - --volume /etc/nv_tegra_release:/etc/nv_tegra_release \ - --volume /tmp/nv_jetson_model:/tmp/nv_jetson_model \ - --volume /var/run/dbus:/var/run/dbus \ - --volume /var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket \ - --volume /var/run/docker.sock:/var/run/docker.sock \ - --volume $ROOT/data:/data \ - -v /etc/localtime:/etc/localtime:ro -v /etc/timezone:/etc/timezone:ro \ - --device /dev/snd \ - $PULSE_AUDIO_ARGS \ - --device /dev/bus/usb \ - $OPTIONAL_PERMISSION_ARGS $DATA_VOLUME $DISPLAY_DEVICE $V4L2_DEVICES $I2C_DEVICES $ACM_DEVICES $JTOP_SOCKET $EXTRA_FLAGS \ - $CONTAINER_NAME_FLAGS \ - "${filtered_args[@]}" - ) - -elif [ $ARCH = "x86_64" ]; then - - ( set -x ; - - $SUDO docker run --gpus all -it --rm --network=host \ - --shm-size=8g \ - --ulimit memlock=-1 \ - --ulimit stack=67108864 \ - --env NVIDIA_DRIVER_CAPABILITIES=all \ - --volume $ROOT/data:/data \ - -v /etc/localtime:/etc/localtime:ro -v /etc/timezone:/etc/timezone:ro \ - $OPTIONAL_ARGS $DATA_VOLUME $DISPLAY_DEVICE $V4L2_DEVICES $I2C_DEVICES $ACM_DEVICES $JTOP_SOCKET $EXTRA_FLAGS \ - $CONTAINER_NAME_FLAGS \ - "${filtered_args[@]}" - ) -fi - -if [[ "$csi_to_webcam_conversion" == true ]]; then - - # Wait for the Docker container to finish (if it exits) - docker wait "$CONTAINER_NAME" - - # When Docker container exits, cleanup will be called - cleanup - -fi From 644f5929617a3d6a7c84f45539b368940fdb9125 Mon Sep 17 00:00:00 2001 From: johnnynunez Date: Fri, 10 Jan 2025 16:40:30 +0100 Subject: [PATCH 12/23] fix architecture --- packages/ml/transformer-engine/build.sh | 3 ++- packages/ml/transformer-engine/config.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/ml/transformer-engine/build.sh b/packages/ml/transformer-engine/build.sh index 36e8236f3..6e6397f41 100755 --- a/packages/ml/transformer-engine/build.sh +++ b/packages/ml/transformer-engine/build.sh @@ -11,9 +11,10 @@ cd /opt/transformer_engine # git apply /tmp/TRANSFORMER_ENGINE/patch.diff # git diff # git status -export NVTE_FRAMEWORK=pytorch MAX_JOBS=$(nproc) \ +NVTE_FRAMEWORK=pytorch \ +NVTE_CUDA_ARCHS=${CUDAARCHS} \ python3 setup.py bdist_wheel --dist-dir=/opt/transformer_engine/wheels pip3 install --no-cache-dir --verbose /opt/transformer_engine/wheels/transformer_engine*.whl diff --git a/packages/ml/transformer-engine/config.py b/packages/ml/transformer-engine/config.py index 9c5775a1a..e02db7222 100644 --- a/packages/ml/transformer-engine/config.py +++ b/packages/ml/transformer-engine/config.py @@ -25,5 +25,5 @@ def transformer_engine(version, requires=None, default=False): return pkg, builder package = [ - transformer_engine('1.14', default=True) + transformer_engine('1.14.0', default=True) ] From 17b8b394207d323db52bd03b268a524760928221 Mon Sep 17 00:00:00 2001 From: Johnny Date: Fri, 10 Jan 2025 16:58:31 +0100 Subject: [PATCH 13/23] update test transformer_engine --- packages/ml/transformer-engine/test.py | 50 +++++++++++++------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/packages/ml/transformer-engine/test.py b/packages/ml/transformer-engine/test.py index 164604f4e..f010ae73c 100755 --- a/packages/ml/transformer-engine/test.py +++ b/packages/ml/transformer-engine/test.py @@ -15,7 +15,7 @@ inp = torch.randn(hidden_size, in_features, device="cuda") # --- FP8 Attempt --- -try: +"""try: print("Trying FP8...") # Create an FP8 recipe. fp8_recipe = recipe.DelayedScaling(margin=0, fp8_format=recipe.Format.E4M3) @@ -30,36 +30,36 @@ except RuntimeError as e: print(f"FP8 Failed: {e} or not supported (Ampere)") - # --- FP16 Attempt --- + # --- FP16 Attempt ---""" +try: + print("Trying FP16...") + # Reset gradients + model.zero_grad() + + # Enable autocasting for the forward pass using FP16 + with torch.cuda.amp.autocast(): + out = model(inp) + loss = out.sum() + loss.backward() + print("FP16 Successful!\n") + +except RuntimeError as e: + print(f"FP16 Failed: {e}") + + # --- FP32 Attempt --- try: - print("Trying FP16...") + print("Trying FP32...") # Reset gradients model.zero_grad() - # Enable autocasting for the forward pass using FP16 - with torch.cuda.amp.autocast(): - out = model(inp) + # Run forward and backward pass in FP32 + out = model(inp) loss = out.sum() loss.backward() - print("FP16 Successful!\n") - - except RuntimeError as e: - print(f"FP16 Failed: {e}") - - # --- FP32 Attempt --- - try: - print("Trying FP32...") - # Reset gradients - model.zero_grad() - - # Run forward and backward pass in FP32 - out = model(inp) - loss = out.sum() - loss.backward() - print("FP32 Successful!\n") + print("FP32 Successful!\n") - except Exception as e: - print(f"FP32 Failed: {e}") - print("All attempts failed.\n") + except Exception as e: + print(f"FP32 Failed: {e}") + print("All attempts failed.\n") print('Transformer Engine OK\n') \ No newline at end of file From 4abf2c7e786c0c83d1d7987599f7b51b377af953 Mon Sep 17 00:00:00 2001 From: Johnny Date: Fri, 10 Jan 2025 17:05:54 +0100 Subject: [PATCH 14/23] update test transformer_engine --- run.sh | 358 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 358 insertions(+) create mode 100644 run.sh diff --git a/run.sh b/run.sh new file mode 100644 index 000000000..c45306d29 --- /dev/null +++ b/run.sh @@ -0,0 +1,358 @@ +#!/usr/bin/env bash +# pass-through commands to 'docker run' with some defaults +# https://docs.docker.com/engine/reference/commandline/run/ +ROOT="$(dirname "$(readlink -f "$0")")" + +# Function to clean up background processes +cleanup() { + if [[ ${#BG_PIDS[@]} -gt 0 ]]; then + echo "Terminating background processes..." + for pid in "${BG_PIDS[@]}"; do + kill "$pid" # Terminate each background process + wait "$pid" 2>/dev/null # Wait for the process to finish + done + fi + sudo modprobe -r v4l2loopback +} + +# Trap signals like INT (Ctrl+C) or TERM to invoke the cleanup function +trap cleanup INT TERM + +# Initialize variables (default for arguments) +csi_to_webcam_conversion=false +capture_res="1640x1232@30" +output_res="1280x720@30" +capture_width="1640" +capture_height="1232" +capture_fps="30" +output_width="1280" +output_height="720" +output_fps="30" + +# Loop through arguments +for arg in "$@"; do + # Check for the --csi2webcam option + if [[ "$arg" == "--csi2webcam" ]]; then + csi_to_webcam_conversion=true + continue # Move to next argument + fi + + # Check for --csi-capture-res + if [[ "$arg" =~ --csi-capture-res= ]]; then + csi_capture_res="${arg#*=}" + # Extract width, height, and fps from capture_res + if [[ $csi_capture_res =~ ([0-9]+)x([0-9]+)@([0-9]+) ]]; then + capture_width="${BASH_REMATCH[1]}" + capture_height="${BASH_REMATCH[2]}" + capture_fps="${BASH_REMATCH[3]}" + else + echo "Invalid format for --csi-capture-res. Expected format: widthxheight@fps" + exit 1 + fi + continue + fi + + # Check for --csi-output-res + if [[ "$arg" =~ --csi-output-res= ]]; then + csi_output_res="${arg#*=}" + # Extract width, height, and fps from output_res + if [[ $csi_output_res =~ ([0-9]+)x([0-9]+)@([0-9]+) ]]; then + output_width="${BASH_REMATCH[1]}" + output_height="${BASH_REMATCH[2]}" + output_fps="${BASH_REMATCH[3]}" + else + echo "Invalid format for --csi-output-res. Expected format: widthxheight@fps" + exit 1 + fi + continue + fi +done + +# check for V4L2 devices +V4L2_DEVICES="" + +if [[ "$csi_to_webcam_conversion" == true ]]; then + + echo "CSI to Webcam conversion enabled." + echo "CSI Capture resolution: ${capture_width}x${capture_height}@${capture_fps}" + echo "CSI Output resolution : ${output_width}x${output_height}@${output_fps}" + + # Check if v4l2loopback-dkms is installed + if dpkg -l | grep -q v4l2loopback-dkms; then + echo "( v4l2loopback-dkms is installed. )" + else + echo "[Error] v4l2loopback-dkms is not installed." + echo " " + echo "Perform the following command to first install v4l2loopback moddule." + echo " " + echo " sudo apt update && sudo apt install v4l2loopback-dkms" + echo " " + exit 1 + fi + + # Check if v4l2-ctl is installed + if command -v v4l2-ctl &> /dev/null + then + echo "(v4l2-ctl is installed)" + else + echo "[Error] v4l2-ctl is not installed" + echo " " + echo "Perform the following command to first install v4l-utils package." + echo " " + echo " sudo apt install v4l-utils" + echo " " + exit 1 + fi + + sudo systemctl restart nvargus-daemon.service + + # Store /dev/video index number for each CSI camera found + csi_indexes=() + # Store /dev/video* device name for each CSI camera found + csi_devices=() + + # Loop through all matching /dev/video* devices + for device in /dev/video*; do + # Use v4l2-ctl to check if the device supports RG10 (CSI camera format) + if v4l2-ctl -d "$device" --list-formats-ext 2>/dev/null | grep -q "RG10"; then + echo "$device is a CSI camera (RG10 format)" + # Store the device name in array if CSI camera + csi_devices+=("$device") + # Extract the device index number and add to the csi_devices array + dev_index=$(echo "$device" | grep -o '[0-9]\+') + csi_indexes+=("$dev_index") + else + echo "$device is not a CSI camera (likely a webcam)" + V4L2_DEVICES="$V4L2_DEVICES --device $device " + fi + done + + # Load the v4l2loopback module to create as many devices as CSI cameras found in the prior step + sudo modprobe v4l2loopback devices=${#csi_indexes[@]} exclusive_caps=1 card_label="Cam1,Cam2" + + # Get all new /dev/video devices created by v4l2loopback + new_devices=($(v4l2-ctl --list-devices | grep -A 1 "v4l2loopback" | grep '/dev/video' | awk '{print $1}')) + echo "###### new_devices: ${new_devices[@]}" + + # add the created v4l2loopback devices + if [[ -n "${new_devices[@]}" ]]; then + for converted_device in ${new_devices[@]}; do + V4L2_DEVICES="$V4L2_DEVICES --device $converted_device " + done + else + echo "No v4l2loopback devices found." + fi + + # Save the current DISPLAY variable + ORIGINAL_DISPLAY=$DISPLAY + + # Start background processes for each CSI camera found + i=0 + for csi_index in "${csi_indexes[@]}"; do + echo "Starting background process for CSI camera device number: $csi_index" + + echo "CSI Capture resolution: ${capture_width}x${capture_height}@${capture_fps}" + echo "CSI Output resolution : ${output_width}x${output_height}@${output_fps}" + + # Unset the DISPLAY env variable because, apparently, some GStreamer components might try to use this display + # for video rendering or processing, which can conflict with other GStreamer elements or hardware device + + # Temporarily unset DISPLAY for the GStreamer command + unset DISPLAY + + echo "gst-launch-1.0 -v nvarguscamerasrc sensor-id=${csi_index} \ + ! 'video/x-raw(memory:NVMM), format=NV12, width=${capture_width}, height=${capture_height}, framerate=${capture_fps}/1' \ + ! queue max-size-buffers=1 leaky=downstream ! nvvidconv \ + ! 'video/x-raw, width=${output_width}, height=${output_height}, framerate=${output_fps}/1', format=I420 \ + ! queue max-size-buffers=1 leaky=downstream ! nvjpegenc \ + ! queue max-size-buffers=1 leaky=downstream ! multipartmux \ + ! multipartdemux single-stream=1 \ + ! \"image/jpeg, width=${output_width}, height=${output_height}, parsed=(boolean)true, colorimetry=(string)2:4:7:1, framerate=(fraction)${output_fps}/1, sof-marker=(int)0\" \ + ! v4l2sink device=${new_devices[$i]} sync=false > $ROOT/logs/gst-launch-process_${csi_index}.txt 2>&1 &" + gst-launch-1.0 -v nvarguscamerasrc sensor-id=${csi_index} \ + ! "video/x-raw(memory:NVMM), format=NV12, width=${capture_width}, height=${capture_height}, framerate=${capture_fps}/1" \ + ! queue max-size-buffers=1 leaky=downstream ! nvvidconv \ + ! "video/x-raw, width=${output_width}, height=${output_height}, framerate=${output_fps}/1", format=I420 \ + ! queue max-size-buffers=1 leaky=downstream ! nvjpegenc \ + ! queue max-size-buffers=1 leaky=downstream ! multipartmux \ + ! multipartdemux single-stream=1 \ + ! "image/jpeg, width=${output_width}, height=${output_height}, parsed=(boolean)true, colorimetry=(string)2:4:7:1, framerate=(fraction)${output_fps}/1, sof-marker=(int)0" \ + ! v4l2sink device=${new_devices[$i]} sync=false > $ROOT/logs/gst-launch-process_${csi_index}.txt 2>&1 & + + # Store the PID of the background process if you want to manage it later + BG_PIDS+=($!) + echo "BG_PIDS: ${BG_PIDS[@]}" + + ((i++)) + done + + # Restore the DISPLAY env variable + export DISPLAY=$ORIGINAL_DISPLAY + +else + # Loop through all matching /dev/video* devices + for device in /dev/video*; do + if [ -e "$device" ]; then # Check if the device file exists + V4L2_DEVICES="$V4L2_DEVICES --device $device " + fi + done +fi + +echo "V4L2_DEVICES: $V4L2_DEVICES" + +if [ -n "$csi_indexes" ]; then + echo "CSI_INDEXES: $csi_indexes" +fi + +# check for I2C devices +I2C_DEVICES="" + +for i in {0..9} +do + if [ -a "/dev/i2c-$i" ]; then + I2C_DEVICES="$I2C_DEVICES --device /dev/i2c-$i " + fi +done + +# check for ttyACM devices +ACM_DEVICES="" + +# Loop through all matching /dev/ttyACM* devices +for dev in /dev/ttyACM*; do + if [ -e "$dev" ]; then # Check if the device file exists + ACM_DEVICES="$ACM_DEVICES --device $dev " + fi +done + +# check for display +DISPLAY_DEVICE="" + +if [ -n "$DISPLAY" ]; then + echo "### DISPLAY environmental variable is already set: \"$DISPLAY\"" + # give docker root user X11 permissions + xhost +si:localuser:root || sudo xhost +si:localuser:root + + # enable SSH X11 forwarding inside container (https://stackoverflow.com/q/48235040) + XAUTH=/tmp/.docker.xauth + xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge - + chmod 777 $XAUTH + + DISPLAY_DEVICE="-e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix -v $XAUTH:$XAUTH -e XAUTHORITY=$XAUTH" +fi + +# check for jtop +JTOP_SOCKET="" +JTOP_SOCKET_FILE="/run/jtop.sock" + +if [ -S "$JTOP_SOCKET_FILE" ]; then + JTOP_SOCKET="-v /run/jtop.sock:/run/jtop.sock" +fi + +# PulseAudio arguments +PULSE_AUDIO_ARGS="" + +if [ -d "${XDG_RUNTIME_DIR}/pulse" ]; then + PULSE_AUDIO_ARGS="-e PULSE_SERVER=unix:${XDG_RUNTIME_DIR}/pulse/native -v ${XDG_RUNTIME_DIR}/pulse:${XDG_RUNTIME_DIR}/pulse" +fi + +# extra flags +EXTRA_FLAGS="" + +if [ -n "$HUGGINGFACE_TOKEN" ]; then + EXTRA_FLAGS="$EXTRA_FLAGS --env HUGGINGFACE_TOKEN=$HUGGINGFACE_TOKEN" +fi + +# additional permission optional run arguments +OPTIONAL_PERMISSION_ARGS="" + +if [ "$USE_OPTIONAL_PERMISSION_ARGS" = "true" ]; then + OPTIONAL_PERMISSION_ARGS="-v /lib/modules:/lib/modules --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor=unconfined" +fi + +# check if sudo is needed +if [ $(id -u) -eq 0 ] || id -nG "$USER" | grep -qw "docker"; then + SUDO="" +else + SUDO="sudo" +fi + +# Initialize an empty array for filtered arguments +filtered_args=() + +# Loop through all provided arguments +for arg in "$@"; do + if [[ "$arg" != "--csi2webcam" && "$arg" != --csi-capture-res=* && "$arg" != --csi-output-res=* ]]; then + filtered_args+=("$arg") # Add to the new array if not the argument to remove + fi + + if [[ "$arg" = "--name" || "$arg" = --name* ]]; then + HAS_CONTAINER_NAME=1 + fi +done + +if [ -z "$HAS_CONTAINER_NAME" ]; then + # Generate a unique container name so we can wait for it to exit and cleanup the bg processes after + BUILD_DATE_TIME=$(date +%Y%m%d_%H%M%S) + #CONTAINER_IMAGE_NAME=$(basename "${filtered_args[0]}") # unfortunately this doesn't work in the general case, and you can't easily parse the container image from the command-line + #SANITIZED_CONTAINER_IMAGE_NAME=$(echo "$CONTAINER_IMAGE_NAME" | sed 's/[^a-zA-Z0-9_.-]/_/g') + CONTAINER_NAME="jetson_container_${BUILD_DATE_TIME}" + CONTAINER_NAME_FLAGS="--name $CONTAINER_NAME" +fi + +# run the container +ARCH=$(uname -i) + +if [ $ARCH = "aarch64" ]; then + + # this file shows what Jetson board is running + # /proc or /sys files aren't mountable into docker + cat /proc/device-tree/model > /tmp/nv_jetson_model + + # https://stackoverflow.com/a/19226038 + ( set -x ; + + $SUDO docker run --runtime nvidia -it --rm --network host \ + --shm-size=8g \ + --volume /tmp/argus_socket:/tmp/argus_socket \ + --volume /etc/enctune.conf:/etc/enctune.conf \ + --volume /etc/nv_tegra_release:/etc/nv_tegra_release \ + --volume /tmp/nv_jetson_model:/tmp/nv_jetson_model \ + --volume /var/run/dbus:/var/run/dbus \ + --volume /var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket \ + --volume /var/run/docker.sock:/var/run/docker.sock \ + --volume $ROOT/data:/data \ + -v /etc/localtime:/etc/localtime:ro -v /etc/timezone:/etc/timezone:ro \ + --device /dev/snd \ + $PULSE_AUDIO_ARGS \ + --device /dev/bus/usb \ + $OPTIONAL_PERMISSION_ARGS $DATA_VOLUME $DISPLAY_DEVICE $V4L2_DEVICES $I2C_DEVICES $ACM_DEVICES $JTOP_SOCKET $EXTRA_FLAGS \ + $CONTAINER_NAME_FLAGS \ + "${filtered_args[@]}" + ) + +elif [ $ARCH = "x86_64" ]; then + + ( set -x ; + + $SUDO docker run --gpus all -it --rm --network=host \ + --shm-size=8g \ + --ulimit memlock=-1 \ + --ulimit stack=67108864 \ + --env NVIDIA_DRIVER_CAPABILITIES=all \ + --volume $ROOT/data:/data \ + -v /etc/localtime:/etc/localtime:ro -v /etc/timezone:/etc/timezone:ro \ + $OPTIONAL_ARGS $DATA_VOLUME $DISPLAY_DEVICE $V4L2_DEVICES $I2C_DEVICES $ACM_DEVICES $JTOP_SOCKET $EXTRA_FLAGS \ + $CONTAINER_NAME_FLAGS \ + "${filtered_args[@]}" + ) +fi + +if [[ "$csi_to_webcam_conversion" == true ]]; then + + # Wait for the Docker container to finish (if it exits) + docker wait "$CONTAINER_NAME" + + # When Docker container exits, cleanup will be called + cleanup + +fi \ No newline at end of file From e2825df36d42a683c3d9f62aa51ffa2b4d4011a5 Mon Sep 17 00:00:00 2001 From: johnnynunez Date: Fri, 10 Jan 2025 17:06:18 +0100 Subject: [PATCH 15/23] revert --- run.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 run.sh diff --git a/run.sh b/run.sh old mode 100644 new mode 100755 From 034463249074dec1a3691dc698d70a3150aff417 Mon Sep 17 00:00:00 2001 From: johnnynunez Date: Fri, 10 Jan 2025 17:23:23 +0100 Subject: [PATCH 16/23] . --- packages/ml/onnxruntime/test.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 packages/ml/onnxruntime/test.py diff --git a/packages/ml/onnxruntime/test.py b/packages/ml/onnxruntime/test.py old mode 100644 new mode 100755 From 9137bfcafa2f1bd66593de6e67ffeeb1ffc60eb7 Mon Sep 17 00:00:00 2001 From: johnnynunez Date: Fri, 10 Jan 2025 18:40:07 +0100 Subject: [PATCH 17/23] final fix --- packages/diffusion/cosmos/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/diffusion/cosmos/Dockerfile b/packages/diffusion/cosmos/Dockerfile index 9878f5381..885db3f95 100644 --- a/packages/diffusion/cosmos/Dockerfile +++ b/packages/diffusion/cosmos/Dockerfile @@ -20,5 +20,5 @@ RUN git clone --recursive https://github.com/NVIDIA/Cosmos && \ pip3 install --no-cache-dir einops attrs pynvml opencv-python protobuf && \ pip3 install --no-cache-dir -r requirements.txt -WORKDIR /opt/cosmos/ +WORKDIR /opt/Cosmos/ CMD ["/bin/bash"] \ No newline at end of file From 765b791e7f6e1de56cdb6bd8c3cb623990dbaf32 Mon Sep 17 00:00:00 2001 From: johnnynunez Date: Fri, 10 Jan 2025 20:14:55 +0100 Subject: [PATCH 18/23] fix --- packages/diffusion/cosmos/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/diffusion/cosmos/Dockerfile b/packages/diffusion/cosmos/Dockerfile index 885db3f95..769c0277b 100644 --- a/packages/diffusion/cosmos/Dockerfile +++ b/packages/diffusion/cosmos/Dockerfile @@ -1,7 +1,7 @@ #--- # name: cosmos # group: diffusion -# depends: [ffmpeg, pytorch, torchvision, torchaudio, transformers, bitsandbytes, transformer-engine, huggingface_hub] +# depends: [ffmpeg, pytorch, torchvision, torchaudio, transformers, opencv:4.11.0, bitsandbytes, transformer-engine, huggingface_hub] # requires: '>=34.1.0' # docs: https://github.com/NVIDIA/Cosmos #--- @@ -17,7 +17,7 @@ RUN apt-get update && apt-get install -y \ RUN git clone --recursive https://github.com/NVIDIA/Cosmos && \ cd Cosmos && \ - pip3 install --no-cache-dir einops attrs pynvml opencv-python protobuf && \ + pip3 install --no-cache-dir einops attrs pynvml opencv-python-contrib protobuf && \ pip3 install --no-cache-dir -r requirements.txt WORKDIR /opt/Cosmos/ From 2ccb6075e89a00d694f1ab49f7cfadb522373ff6 Mon Sep 17 00:00:00 2001 From: johnnynunez Date: Fri, 10 Jan 2025 20:18:29 +0100 Subject: [PATCH 19/23] fix --- packages/opencv/install_deps.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/opencv/install_deps.sh b/packages/opencv/install_deps.sh index fa8714b7b..b6e0a3c40 100755 --- a/packages/opencv/install_deps.sh +++ b/packages/opencv/install_deps.sh @@ -51,6 +51,7 @@ apt-get install -y --no-install-recommends \ qv4l2 \ v4l-utils \ zlib1g-dev \ + tesseract-ocr \ $EXTRAS # on x86, the python dev packages are already installed in the NGC containers under conda From 1b3232a24f18a90ecdf0896d7cb26c8331ed393f Mon Sep 17 00:00:00 2001 From: johnnynunez Date: Fri, 10 Jan 2025 22:17:47 +0100 Subject: [PATCH 20/23] revert --- packages/diffusion/cosmos/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/diffusion/cosmos/Dockerfile b/packages/diffusion/cosmos/Dockerfile index 769c0277b..2edcd0241 100644 --- a/packages/diffusion/cosmos/Dockerfile +++ b/packages/diffusion/cosmos/Dockerfile @@ -1,7 +1,7 @@ #--- # name: cosmos # group: diffusion -# depends: [ffmpeg, pytorch, torchvision, torchaudio, transformers, opencv:4.11.0, bitsandbytes, transformer-engine, huggingface_hub] +# depends: [ffmpeg, pytorch, torchvision, torchaudio, transformer-engine, transformers, opencv:4.11.0, bitsandbytes, huggingface_hub] # requires: '>=34.1.0' # docs: https://github.com/NVIDIA/Cosmos #--- @@ -17,7 +17,7 @@ RUN apt-get update && apt-get install -y \ RUN git clone --recursive https://github.com/NVIDIA/Cosmos && \ cd Cosmos && \ - pip3 install --no-cache-dir einops attrs pynvml opencv-python-contrib protobuf && \ + pip3 install --no-cache-dir einops attrs pynvml opencv-contrib-python protobuf && \ pip3 install --no-cache-dir -r requirements.txt WORKDIR /opt/Cosmos/ From ea06efbe9b6f07af2cf79e1acfa973b52438ecb5 Mon Sep 17 00:00:00 2001 From: johnnynunez Date: Tue, 14 Jan 2025 14:12:25 +0100 Subject: [PATCH 21/23] cosmos Readme --- packages/diffusion/cosmos/Dockerfile | 2 +- packages/diffusion/cosmos/README.md | 67 ++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 packages/diffusion/cosmos/README.md diff --git a/packages/diffusion/cosmos/Dockerfile b/packages/diffusion/cosmos/Dockerfile index 2edcd0241..a9f946b44 100644 --- a/packages/diffusion/cosmos/Dockerfile +++ b/packages/diffusion/cosmos/Dockerfile @@ -3,7 +3,7 @@ # group: diffusion # depends: [ffmpeg, pytorch, torchvision, torchaudio, transformer-engine, transformers, opencv:4.11.0, bitsandbytes, huggingface_hub] # requires: '>=34.1.0' -# docs: https://github.com/NVIDIA/Cosmos +# docs: docs.md #--- ARG BASE_IMAGE diff --git a/packages/diffusion/cosmos/README.md b/packages/diffusion/cosmos/README.md new file mode 100644 index 000000000..edac9f966 --- /dev/null +++ b/packages/diffusion/cosmos/README.md @@ -0,0 +1,67 @@ +# cosmos + +> [`CONTAINERS`](#user-content-containers) [`IMAGES`](#user-content-images) [`RUN`](#user-content-run) [`BUILD`](#user-content-build) + +docs.md +
+CONTAINERS +
+ +| **`cosmos`** | | +| :-- |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +|    Requires | `L4T ['>=36.1.0']` | +|    Dependencies | [`build-essential`](/packages/build/build-essential) [`pip_cache:cu126`](/packages/cuda/cuda) [`cuda:12.6`](/packages/cuda/cuda) [`cudnn`](/packages/cuda/cudnn) [`python`](/packages/build/python) [`numpy`](/packages/numeric/numpy) [`cmake`](/packages/build/cmake/cmake_pip) [`onnx`](/packages/ml/onnx) [`pytorch:2.5`](/packages/pytorch) [`torchvision`](/packages/pytorch/torchvision) [`torchaudio`](/packages/pytorch/torchaudio) [`huggingface_hub`](/packages/llm/huggingface_hub) [`transformer-engine`](/packages/ml/rust) [`transformer-engine`](/packages/llm/transformers) [`bitsandbytes`](/packages/llm/bitsandbytes) | +|    Dockerfile | [`Dockerfile`](Dockerfile) | +|    Images | [`dustynv/cosmos:r36.4.0`](https://hub.docker.com/r/dustynv/cosmos/tags) `(2025-01-13, 12.26GB)` | + +
+ +
+CONTAINER IMAGES +
+ +| Repository/Tag | Date | Arch | Size | +| :-- | :--: | :--: | :--: | +|   [`dustynv/cosmos:r36.4.0`](https://hub.docker.com/r/dustynv/cosmos/tags) | `2025-01-13` | `arm64` | `12.26GB` | + + +
+ +
+RUN CONTAINER +
+ +To start the container, you can use [`jetson-containers run`](/docs/run.md) and [`autotag`](/docs/run.md#autotag), or manually put together a [`docker run`](https://docs.docker.com/engine/reference/commandline/run/) command: +```bash +# automatically pull or build a compatible container image +jetson-containers run $(autotag cosmos) + +# or explicitly specify one of the container images above +jetson-containers run dustynv/cosmos:r36.4.0 + +# or if using 'docker run' (specify image and mounts/ect) +sudo docker run --runtime nvidia -it --rm --network=host dustynv/cosmos:r36.4.0 +``` +> [`jetson-containers run`](/docs/run.md) forwards arguments to [`docker run`](https://docs.docker.com/engine/reference/commandline/run/) with some defaults added (like `--runtime nvidia`, mounts a `/data` cache, and detects devices)
+> [`autotag`](/docs/run.md#autotag) finds a container image that's compatible with your version of JetPack/L4T - either locally, pulled from a registry, or by building it. + +To mount your own directories into the container, use the [`-v`](https://docs.docker.com/engine/reference/commandline/run/#volume) or [`--volume`](https://docs.docker.com/engine/reference/commandline/run/#volume) flags: +```bash +jetson-containers run -v /path/on/host:/path/in/container $(autotag cosmos) +``` +To launch the container running a command, as opposed to an interactive shell: +```bash +jetson-containers run $(autotag cosmos) my_app --abc xyz +``` +You can pass any options to it that you would to [`docker run`](https://docs.docker.com/engine/reference/commandline/run/), and it'll print out the full command that it constructs before executing it. +
+
+BUILD CONTAINER +
+ +If you use [`autotag`](/docs/run.md#autotag) as shown above, it'll ask to build the container for you if needed. To manually build it, first do the [system setup](/docs/setup.md), then run: +```bash +jetson-containers build cosmos +``` +The dependencies from above will be built into the container, and it'll be tested during. Run it with [`--help`](/jetson_containers/build.py) for build options. +
From 3523f7cb7863d6c18fc8f46725ccf02f1c80fe14 Mon Sep 17 00:00:00 2001 From: johnnynunez Date: Tue, 14 Jan 2025 14:15:15 +0100 Subject: [PATCH 22/23] cosmos Readme --- packages/diffusion/cosmos/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/diffusion/cosmos/README.md b/packages/diffusion/cosmos/README.md index edac9f966..fa97128fd 100644 --- a/packages/diffusion/cosmos/README.md +++ b/packages/diffusion/cosmos/README.md @@ -7,12 +7,12 @@ docs.md CONTAINERS
-| **`cosmos`** | | -| :-- |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -|    Requires | `L4T ['>=36.1.0']` | -|    Dependencies | [`build-essential`](/packages/build/build-essential) [`pip_cache:cu126`](/packages/cuda/cuda) [`cuda:12.6`](/packages/cuda/cuda) [`cudnn`](/packages/cuda/cudnn) [`python`](/packages/build/python) [`numpy`](/packages/numeric/numpy) [`cmake`](/packages/build/cmake/cmake_pip) [`onnx`](/packages/ml/onnx) [`pytorch:2.5`](/packages/pytorch) [`torchvision`](/packages/pytorch/torchvision) [`torchaudio`](/packages/pytorch/torchaudio) [`huggingface_hub`](/packages/llm/huggingface_hub) [`transformer-engine`](/packages/ml/rust) [`transformer-engine`](/packages/llm/transformers) [`bitsandbytes`](/packages/llm/bitsandbytes) | -|    Dockerfile | [`Dockerfile`](Dockerfile) | -|    Images | [`dustynv/cosmos:r36.4.0`](https://hub.docker.com/r/dustynv/cosmos/tags) `(2025-01-13, 12.26GB)` | +| **`cosmos`** | | +| :-- |:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +|    Requires | `L4T ['>=36.1.0']` | +|    Dependencies | [`build-essential`](/packages/build/build-essential) [`pip_cache:cu126`](/packages/cuda/cuda) [`cuda:12.6`](/packages/cuda/cuda) [`cudnn`](/packages/cuda/cudnn) [`python`](/packages/build/python) [`ffmpeg`](/packages/multimedia/ffmpeg) [`pytorch:2.5`](/packages/pytorch) [`torchvision`](/packages/pytorch/torchvision) [`torchaudio`](/packages/pytorch/torchaudio) [`transformer-engine`](/packages/ml/rust) [`transformer`](/packages/llm/transformers) [`opencv:4.11`](/packages/opencv) [`bitsandbytes`](/packages/llm/bitsandbytes) [`huggingface_hub`](/packages/llm/huggingface_hub) | +|    Dockerfile | [`Dockerfile`](Dockerfile) | +|    Images | [`dustynv/cosmos:r36.4.0`](https://hub.docker.com/r/dustynv/cosmos/tags) `(2025-01-13, 12.26GB)` | From fbc30d74d74b8997ec29d702d38417bcf4e86f63 Mon Sep 17 00:00:00 2001 From: Johnny Date: Tue, 14 Jan 2025 17:03:03 +0100 Subject: [PATCH 23/23] Added Cosmos to Readme --- README.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 947eb5913..8c0158757 100644 --- a/README.md +++ b/README.md @@ -6,20 +6,20 @@ Modular container build system that provides the latest [**AI/ML packages**](http://jetson.webredirect.org/) for [NVIDIA Jetson](https://developer.nvidia.com/embedded-computing) :rocket::robot: -| | | -|---|---| -| **ML** | [`pytorch`](packages/pytorch) [`tensorflow`](packages/ml/tensorflow) [`jax`](packages/ml/jax) [`onnxruntime`](packages/ml/onnxruntime) [`deepstream`](packages/multimedia/deepstream) [`holoscan`](packages/multimedia/holoscan) [`CTranslate2`](packages/ml/ctranslate2) [`JupyterLab`](packages/ml/jupyterlab) | +| | | +|---|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **ML** | [`pytorch`](packages/pytorch) [`tensorflow`](packages/ml/tensorflow) [`jax`](packages/ml/jax) [`onnxruntime`](packages/ml/onnxruntime) [`deepstream`](packages/multimedia/deepstream) [`holoscan`](packages/multimedia/holoscan) [`CTranslate2`](packages/ml/ctranslate2) [`JupyterLab`](packages/ml/jupyterlab) | | **LLM** | [`NanoLLM`](packages/llm/nano_llm) [`transformers`](packages/llm/transformers) [`text-generation-webui`](packages/llm/text-generation-webui) [`ollama`](packages/llm/ollama) [`llama.cpp`](packages/llm/llama_cpp) [`llama-factory`](packages/llm/llama-factory) [`exllama`](packages/llm/exllama) [`vLLM`](packages/llm/vllm) [`MLC`](packages/llm/mlc) [`AWQ`](packages/llm/awq) [`AutoGPTQ`](packages/llm/auto_gptq) [`FlashAttention`](packages/llm/flash-attention) [`DeepSpeed`](packages/llm/deepspeed) [`bitsandbytes`](packages/llm/bitsandbytes) [`xformers`](packages/llm/xformers) | -| **VLM** | [`llava`](packages/vlm/llava) [`llama-vision`](packages/vlm/llama-vision) [`VILA`](packages/vlm/vila) [`LITA`](packages/vlm/lita) [`NanoLLM`](packages/llm/nano_llm) [`ShapeLLM`](packages/vlm/shape-llm) [`Prismatic`](packages/vlm/prismatic) [`xtuner`](packages/vlm/xtuner) | -| **VIT** | [`NanoOWL`](packages/vit/nanoowl) [`NanoSAM`](packages/vit/nanosam) [`Segment Anything (SAM)`](packages/vit/sam) [`Track Anything (TAM)`](packages/vit/tam) [`clip_trt`](packages/vit/clip_trt) | -| **RAG** | [`llama-index`](packages/rag/llama-index) [`langchain`](packages/rag/langchain) [`jetson-copilot`](packages/rag/jetson-copilot) [`NanoDB`](packages/vectordb/nanodb) [`FAISS`](packages/vectordb/faiss) [`RAFT`](packages/ml/rapids/raft) | -| **L4T** | [`l4t-pytorch`](packages/l4t/l4t-pytorch) [`l4t-tensorflow`](packages/l4t/l4t-tensorflow) [`l4t-ml`](packages/l4t/l4t-ml) [`l4t-diffusion`](packages/l4t/l4t-diffusion) [`l4t-text-generation`](packages/l4t/l4t-text-generation) | -| **CUDA** | [`cupy`](packages/cuda/cupy) [`cuda-python`](packages/cuda/cuda-python) [`pycuda`](packages/cuda/pycuda) [`numba`](packages/numba) [`opencv:cuda`](packages/opencv) [`cudf`](packages/ml/rapids/cudf) [`cuml`](packages/ml/rapids/cuml) | -| **Robotics** | [`ROS`](packages/ros) [`LeRobot`](packages/robots/lerobot) [`OpenVLA`](packages/robots/openvla) [`3D Diffusion Policy`](packages/robots/3d_diffusion_policy) [`Crossformer`](packages/robots/crossformer) [`MimicGen`](packages/robots/mimicgen) [`OpenDroneMap`](packages/robots/opendronemap) [`ZED`](packages/hardware/zed) | -| **Graphics** | [`stable-diffusion-webui`](packages/diffusion/stable-diffusion-webui) [`comfyui`](packages/diffusion/comfyui) [`nerfstudio`](packages/nerf/nerfstudio) [`meshlab`](packages/nerf/meshlab) [`pixsfm`](packages/nerf/pixsfm) [`gsplat`](packages/nerf/gsplat) | -| **Mamba** | [`mamba`](packages/mamba/mamba) [`mambavision`](packages/mamba/mambavision) [`cobra`](packages/mamba/cobra) [`dimba`](packages/mamba/dimba) [`videomambasuite`](packages/mamba/videomambasuite) | -| **Speech** | [`whisper`](packages/speech/whisper) [`whisper_trt`](packages/speech/whisper_trt) [`piper`](packages/speech/piper-tts) [`riva`](packages/speech/riva-client) [`audiocraft`](packages/speech/audiocraft) [`voicecraft`](packages/speech/voicecraft) [`xtts`](packages/speech/xtts)| -| **Home/IoT** | [`homeassistant-core`](packages/smart-home/homeassistant-core) [`wyoming-whisper`](packages/smart-home/wyoming/wyoming-whisper) [`wyoming-openwakeword`](packages/smart-home/wyoming/openwakeword) [`wyoming-piper`](packages/smart-home/wyoming/piper) | +| **VLM** | [`llava`](packages/vlm/llava) [`llama-vision`](packages/vlm/llama-vision) [`VILA`](packages/vlm/vila) [`LITA`](packages/vlm/lita) [`NanoLLM`](packages/llm/nano_llm) [`ShapeLLM`](packages/vlm/shape-llm) [`Prismatic`](packages/vlm/prismatic) [`xtuner`](packages/vlm/xtuner) | +| **VIT** | [`NanoOWL`](packages/vit/nanoowl) [`NanoSAM`](packages/vit/nanosam) [`Segment Anything (SAM)`](packages/vit/sam) [`Track Anything (TAM)`](packages/vit/tam) [`clip_trt`](packages/vit/clip_trt) | +| **RAG** | [`llama-index`](packages/rag/llama-index) [`langchain`](packages/rag/langchain) [`jetson-copilot`](packages/rag/jetson-copilot) [`NanoDB`](packages/vectordb/nanodb) [`FAISS`](packages/vectordb/faiss) [`RAFT`](packages/ml/rapids/raft) | +| **L4T** | [`l4t-pytorch`](packages/l4t/l4t-pytorch) [`l4t-tensorflow`](packages/l4t/l4t-tensorflow) [`l4t-ml`](packages/l4t/l4t-ml) [`l4t-diffusion`](packages/l4t/l4t-diffusion) [`l4t-text-generation`](packages/l4t/l4t-text-generation) | +| **CUDA** | [`cupy`](packages/cuda/cupy) [`cuda-python`](packages/cuda/cuda-python) [`pycuda`](packages/cuda/pycuda) [`numba`](packages/numba) [`opencv:cuda`](packages/opencv) [`cudf`](packages/ml/rapids/cudf) [`cuml`](packages/ml/rapids/cuml) | +| **Robotics** | [`ROS`](packages/ros) [`LeRobot`](packages/robots/lerobot) [`OpenVLA`](packages/robots/openvla) [`3D Diffusion Policy`](packages/robots/3d_diffusion_policy) [`Crossformer`](packages/robots/crossformer) [`MimicGen`](packages/robots/mimicgen) [`OpenDroneMap`](packages/robots/opendronemap) [`ZED`](packages/hardware/zed) | +| **Graphics** | [`Cosmos`](packages/diffusion/cosmos) [`stable-diffusion-webui`](packages/diffusion/stable-diffusion-webui) [`comfyui`](packages/diffusion/comfyui) [`nerfstudio`](packages/nerf/nerfstudio) [`meshlab`](packages/nerf/meshlab) [`pixsfm`](packages/nerf/pixsfm) [`gsplat`](packages/nerf/gsplat) | +| **Mamba** | [`mamba`](packages/mamba/mamba) [`mambavision`](packages/mamba/mambavision) [`cobra`](packages/mamba/cobra) [`dimba`](packages/mamba/dimba) [`videomambasuite`](packages/mamba/videomambasuite) | +| **Speech** | [`whisper`](packages/speech/whisper) [`whisper_trt`](packages/speech/whisper_trt) [`piper`](packages/speech/piper-tts) [`riva`](packages/speech/riva-client) [`audiocraft`](packages/speech/audiocraft) [`voicecraft`](packages/speech/voicecraft) [`xtts`](packages/speech/xtts) | +| **Home/IoT** | [`homeassistant-core`](packages/smart-home/homeassistant-core) [`wyoming-whisper`](packages/smart-home/wyoming/wyoming-whisper) [`wyoming-openwakeword`](packages/smart-home/wyoming/openwakeword) [`wyoming-piper`](packages/smart-home/wyoming/piper) | See the [**`packages`**](packages) directory for the full list, including pre-built container images for JetPack/L4T.