You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: nemo_vfm/diffusion/data/readme.rst
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
Preparing Image / Video Megatron Energon WebDataset with Cosmos Tokenizer
1
+
Preparing Image / Video Megatron Energon WebDataset with Cosmos Tokenizer
2
2
===========================
3
3
4
4
This script is an example on preparing a WebDataset for an image / video + text dataset using distributed processing with the Cosmos Tokenizer. It processes each sample by generating a **continuous** image / video latent using the Cosmos video tokenizer and a T5 embedding from the text caption. Then, the processed data is stored in a WebDataset-compatible format.
@@ -22,5 +22,5 @@ Usage
22
22
23
23
3. **Running the Script**:
24
24
To run the script on 8 GPUs, use the following command:
Copy file name to clipboardExpand all lines: nemo_vfm/diffusion/readme.rst
+19-19Lines changed: 19 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
-
Diffusion Training Framework
1
+
Diffusion Training Framework
2
2
=============
3
3
4
4
Overview
5
5
--------
6
6
7
-
The NeMo Diffusion Training Framework provides a scalable training platform for diffusion models with transformer backbones. Our new features streamline the training process, allowing developers to efficiently train state-of-the-art models with ease.
7
+
The NeMo Diffusion Training Framework provides a scalable training platform for diffusion models with transformer backbones. Our new features streamline the training process, allowing developers to efficiently train state-of-the-art models with ease.
8
8
9
9
10
10
Some of the features we currently support include:
@@ -23,13 +23,13 @@ We support image diffusion training. Video training incoming.
23
23
+---------------------------+------------------+
24
24
| Parallelism | Status |
25
25
+===========================+==================+
26
-
| FSDP |✅ Supported |
26
+
| FSDP |✅ Supported |
27
27
+---------------------------+------------------+
28
-
| CP+TP+SP+distopt |✅ Supported |
28
+
| CP+TP+SP+distopt |✅ Supported |
29
29
+---------------------------+------------------+
30
-
| CP+TP+SP+PP+distopt |✅ Supported |
30
+
| CP+TP+SP+PP+distopt |✅ Supported |
31
31
+---------------------------+------------------+
32
-
| CP+TP+SP+FSDP |🕒 Coming Soon |
32
+
| CP+TP+SP+FSDP |🕒 Coming Soon |
33
33
+---------------------------+------------------+
34
34
35
35
@@ -44,11 +44,11 @@ We support image diffusion training. Video training incoming.
@@ -58,7 +58,7 @@ Energon Dataloader for Webscale Dataloading
58
58
Webscale Dataloading
59
59
^^^^^^^^^^^^^^^^^^^^
60
60
61
-
Megatron-Energon is an optimized multi-modal dataloader for large-scale deep learning with Megatron. Energon allows for distributed loading of large training training data for multi-modal model training. Energon allows for blending many datasets together and distributing the dataloading workflow across multiple cluster nodes/processes while ensuring reproducibility and resumability.
61
+
Megatron-Energon is an optimized multi-modal dataloader for large-scale deep learning with Megatron. Energon allows for distributed loading of large training training data for multi-modal model training. Energon allows for blending many datasets together and distributing the dataloading workflow across multiple cluster nodes/processes while ensuring reproducibility and resumability.
62
62
63
63
Dataloader Checkpointing
64
64
^^^^^^^^^^^^^^^^^^^^^^^^
@@ -84,7 +84,7 @@ Our dataloader provides support for mixed image-video training by using the NeMo
84
84
85
85
Model and Data Parallelism
86
86
--------------------------
87
-
NeMo provides support for training models using tensor parallelism, sequence parallelism, pipeline parallelism, and context parallelism. To support pipeline parallelism with conditional diffusion training, we duplicate the conditional embeddings across the pipeline stages, and perform an all-reduce during the backward pass. This approach uses more compute, but it has a lower communication cost than sending the conditional embeddings through different pipeline stages.
87
+
NeMo provides support for training models using tensor parallelism, sequence parallelism, pipeline parallelism, and context parallelism. To support pipeline parallelism with conditional diffusion training, we duplicate the conditional embeddings across the pipeline stages, and perform an all-reduce during the backward pass. This approach uses more compute, but it has a lower communication cost than sending the conditional embeddings through different pipeline stages.
88
88
89
89
.. image:: assets/pipeline_conditioning.png
90
90
:alt:Conditioning mechanism for pipeline parallelism
@@ -116,14 +116,14 @@ this will generate a folder a tar files. .pth contains image/video latent repres
116
116
.. code-block:: bash
117
117
118
118
shard_000.tar
119
-
├── samples/sample_0000.pth
120
-
├── samples/sample_0000.pickle
121
-
├── samples/sample_0000.json
122
-
├── samples/sample_0001.pth
123
-
├── samples/sample_0001.pickle
124
-
├── samples/sample_0001.json
125
-
└── ...
126
-
shard_001.tar
119
+
├── samples/sample_0000.pth
120
+
├── samples/sample_0000.pickle
121
+
├── samples/sample_0000.json
122
+
├── samples/sample_0001.pth
123
+
├── samples/sample_0001.pickle
124
+
├── samples/sample_0001.json
125
+
└── ...
126
+
shard_001.tar
127
127
128
128
The following is a sample command to prepare prepare webdataset into energon dataset:
Copy file name to clipboardExpand all lines: nemo_vfm/diffusion/vae/readme.rst
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
============================
1
+
============================
2
2
Pretraining Variational AutoEncoder
3
3
============================
4
4
@@ -49,11 +49,11 @@ Data Preparation
49
49
.. code-block:: bash
50
50
51
51
000000.tar
52
-
├── 1.jpg
53
-
├── 2.jpg
52
+
├── 1.jpg
53
+
├── 2.jpg
54
54
000001.tar
55
-
├── 3.jpg
56
-
├── 4.jpg
55
+
├── 3.jpg
56
+
├── 4.jpg
57
57
58
58
2. next we need to index the webdataset with `energon <https://nvidia.github.io/Megatron-Energon/>`_. navigate to the dataset directory and run the following command:
59
59
@@ -64,7 +64,7 @@ Data Preparation
64
64
3. then select dataset type `ImageWebdataset` and specify the type `jpg`. Below is an example of the interactive setup:
65
65
66
66
.. code-block:: bash
67
-
67
+
68
68
Found 2925 tar files in total. The first and last ones are:
Copy file name to clipboardExpand all lines: nemo_vfm/physicalai/Cosmos/cosmos1/models/autoregressive/nemo/post_training/tokenizer/README.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Cosmos Autoregressive-based World Foundation Models: Changing the Video Tokenizer
1
+
# Cosmos Autoregressive-based World Foundation Models: Changing the Video Tokenizer
2
2
3
3
Learn how to post-train Cosmos Autoregressive-based World Foundation Models (WFMs) using the NVIDIA NeMo Framework when swapping out the original tokenizer for a new one. This recipe provides a conceptual overview of how to adapt your existing model to handle a different discrete video (DV) tokenizer, ensuring high-quality video generation under a new compression setting.
4
4
@@ -49,20 +49,20 @@ The NeMo Framework supports the following Cosmos Autoregressive (AR) models for
49
49
50
50
## Why Change Tokenizers?
51
51
52
-
Cosmos Autoregressive models are typically trained on a specific tokenizer configuration (e.g., 8×16×16). If you’d like to reduce patch size or change compression (e.g., to 4×8×8), you can post-train the existing weights so that the model effectively aligns its internal representations with the new token embeddings—without re-training the tokenizer.
52
+
Cosmos Autoregressive models are typically trained on a specific tokenizer configuration (e.g., 8×16×16). If you’d like to reduce patch size or change compression (e.g., to 4×8×8), you can post-train the existing weights so that the model effectively aligns its internal representations with the new token embeddings—without re-training the tokenizer.
53
53
54
54
## Tutorial: Finetuning Cosmos-4B on 10k Videos with a New Tokenizer
55
55
56
56
In this tutorial, we will:
57
-
- Take a model originally trained on an 8×16×16 tokenizer.
58
-
- Post-train it on a 4×8×8 tokenizer.
57
+
- Take a model originally trained on an 8×16×16 tokenizer.
58
+
- Post-train it on a 4×8×8 tokenizer.
59
59
- Demonstrate using a sample dataset of 10 (in production, we recommend using 10k videos from a distribution similar to that of pretraining).
- Adjust parameters such as `--max_steps`, `--global_batch_size`, and `--lr` to suit your needs.
140
-
- Ensure that `--model_path` matches the checkpoint originally trained on an 8×16×16 tokenizer.
140
+
- Ensure that `--model_path` matches the checkpoint originally trained on an 8×16×16 tokenizer.
141
141
- For an explanation on other configuration options, please see [the general post-training tutorial](https://github.com/NVIDIA/Cosmos/blob/main/cosmos1/models/autoregressive/nemo/post_training/README.md#configuration-options).
142
142
143
143
### 5. Monitor Quality
144
144
145
145
After training, monitor checkpoints and generate sample outputs. Please keep in mind that you will have to
146
146
disable the diffusion decoder, as this is not yet supported for non-standard tokenizers.
147
147
148
-
1.**Checkpoints:**
148
+
1.**Checkpoints:**
149
149
Checkpoints are saved under `./experiments/example_log_dir/default/checkpoints/`. For example:
150
150
```bash
151
151
epoch=1-step=49
@@ -154,7 +154,7 @@ disable the diffusion decoder, as this is not yet supported for non-standard tok
154
154
```
155
155
Choose a checkpoint (e.g., `epoch=1-step=99`) for inference.
156
156
157
-
2.**Run Inference:**
157
+
2.**Run Inference:**
158
158
Generate sample video outputs:
159
159
```bash
160
160
# Set the checkpoint directory
@@ -177,7 +177,7 @@ disable the diffusion decoder, as this is not yet supported for non-standard tok
Copy file name to clipboardExpand all lines: nemo_vfm/physicalai/Cosmos/cosmos1/models/diffusion/nemo/post_training/README.md
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Cosmos Diffusion-based World Foundation Models: NeMo Framework User Guide
1
+
# Cosmos Diffusion-based World Foundation Models: NeMo Framework User Guide
2
2
3
3
Learn how to [post-train](#post-train) Cosmos Diffusion-based World Foundation Models (WFMs) using the [NVIDIA NeMo Framework](https://docs.nvidia.com/nemo-framework/user-guide/latest/overview.html) for your custom Physical AI tasks by following this guide.
For different post-training recipes make sure to change the autoresume directory so that checkpoints generated from recipe A are not used for recipe B. Modify 'recipe.trainer.callbacks.dirpath' and 'recipe.resume.resume_from_directory'.
464
+
For different post-training recipes make sure to change the autoresume directory so that checkpoints generated from recipe A are not used for recipe B. Modify 'recipe.trainer.callbacks.dirpath' and 'recipe.resume.resume_from_directory'.
465
465
466
-
'recipe.trainer.val_check_interval' and 'recipe.trainer.limit_val_batches' can be set to 0 to disable validation during post-training.
466
+
'recipe.trainer.val_check_interval' and 'recipe.trainer.limit_val_batches' can be set to 0 to disable validation during post-training.
467
467
468
468
Under `HF_HOME`, there should be a `hub` folder, which contains the base checkpoints. Under `multicamera` folder, there should be view embeddings, `mkdir -p $HF_HOME/multicamera && symlink -s cosmos1/models/diffusion/nemo/post_training/multicamera/*.pt $HF_HOME/multicamera`
0 commit comments