This repository was archived by the owner on May 20, 2026. It is now read-only.
Commit 38b0309
Adding DiT training and Inference (#27)
* first dit commit.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* inference working with old checkpoint.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* add on_validation_start step to generate video.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* EDM loss bug fix.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* Refactor DIT components: add comments for potential removals and clarify usage of common elements in the codebase.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* Add utility functions for tensor operations and dynamic imports
- Introduced `batch_ops.py` with functions for tensor broadcasting and element-wise operations (addition, multiplication, subtraction, division).
- Added `dynamic_import.py` for dynamic loading of classes or functions from specified paths.
- Created `torch_split_tensor_for_cp.py` for tensor splitting and concatenation in checkpoint parallelism.
- Implemented a new data module for handling multimodal datasets in `base.py` and `diffusion_energon_datamodule.py`.
- Added `diffusion_taskencoder.py` for encoding image/video samples for diffusion tasks.
- Updated `edm_pipeline.py` to utilize new utility functions for tensor operations.
- Included a script for preparing the Energon dataset in `prepare_energon_dataset_butterfly.py`.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* remove unused layers from spec.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* Remove unused AdaLN and STDiTLayerWithAdaLN classes from dit_layer_spec.py to streamline the codebase.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* Refactor DIT model files: removed unused functions from `dit_provider.py`, updated import paths in `dit.py`, and adjusted training parameters for `task_encoder_seq_length` and `save_interval` to optimize configuration.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* Add README for DiT model setup: include instructions for cloning repositories, dataset location, Docker setup, installation, and running the model on the butterfly dataset.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* Remove unused files and refactor DIT model components: deleted obsolete files including `decode_cosmos_latent.py`, `attention_wan.py`, `diffusers_vae.py`, `dit_embeddings.py`, `dit_inference.py`, and others. Updated import paths and streamlined the codebase for improved maintainability.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* Add new components for DiT model:
- Introduced `attention_wan.py` with implementations for WAN self and cross attention layers, including adaptive layer normalization.
- Added `time_pos_embeddings.py` for various temporal positional embedding strategies.
- Created `dit_data_process.py` for data handling in DiT model training, including batch processing and sequence length encoding.
- Implemented `dit_model_provider.py` for model configuration and instantiation of DiT models.
- Added utility functions in `edm_utils.py` for EDM sampling and scaling processes.
These additions enhance the DiT model's capabilities and streamline data processing and model configuration.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* revert THD to SBHD and use remove prints.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* add support sequence for sequence packing.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* move files in proper location, uncomment cp related code, cleaning.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* fix lint errors.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* fix README lint error.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* add the missing copyright.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* removed dependency on nemo CausalVideoTokenizer by implementing a minimal Tokenizer version.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* remove nemo vae modules.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* update readme.md
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* remove unused temporal_self_attention attribute from DiTWithAdaLNSubmodules class
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* create an abstract DiffusionTaskEncoder to encompass the sequence packing logic that is shared across models.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* fix use seq_length instead of packing_buffer_size to set max number of tokens.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* Add the missing copy write. Minor update to the config.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* lint still complains about the nemo_vfm file.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* move data modules to common, move cosmos to common/tokenizer instad of common/models. Make inference compatible with the new data loading.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* uncomment omega config overwrite.
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
* change import (remote lint complains).
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
---------
Signed-off-by: Sajad Norouzi <snorouzi@nvidia.com>
Co-authored-by: Abhinav Garg <abhinavg@stanford.edu>1 parent 0a6addd commit 38b0309
41 files changed
Lines changed: 4836 additions & 0 deletions
File tree
- dfm/src
- common
- tokenizers
- cosmos
- cosmos1
- utils
- megatron
- data
- common
- dit
- model
- common
- dit
- edm
- recipes
- dit
- examples/megatron/recipes
- dit
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Whitespace-only changes.
Whitespace-only changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
Lines changed: 193 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
Lines changed: 145 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
Whitespace-only changes.
0 commit comments