Skip to content

Commit 0a6386b

Browse files
authored
update readme
1 parent 50a363c commit 0a6386b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,21 @@ python ./scripts/train_fine_stage.py \
8787
--kmeans_path PATH_TO_KMEANS_CHECKPOINT # path to previously trained kmeans
8888
```
8989

90+
## Preprocessing
91+
In the above case, we are using CLAP, Hubert and Encodec to generate clap, semantic and acoustic tokens live during training. However, these models take up space on the GPU, and it is inefficient to recompute these tokens if we're making multiple runs on the same data. We can instead compute these tokens ahead of time and iterate over them during training.
92+
93+
To do this, fill in the `data_preprocessor_cfg` field in the config and set `use_preprocessed_data` to True in the trainer configs (look at train_fma_preprocess.json for inspiration). Then run the following to preprocess the dataset, followed by your training script.
94+
95+
```shell
96+
python ./scripts/preprocess_data.py \
97+
--stage all # stage(s) we want to preprocess for: all | semantic | coarse | fine
98+
--model_config ./configs/model/musiclm_small.json \
99+
--training_config ./configs/training/train_fma_preprocess.json \
100+
--rvq_path PATH_TO_RVQ_CHECKPOINT \ # path to previously trained rvq
101+
--kmeans_path PATH_TO_KMEANS_CHECKPOINT # path to previously trained kmeans
102+
```
103+
Note: make sure to process enough data for the number of training steps you're planning to run. Once the trainer runs out of data it cycles back to the beginning, but there is no random cropping in this case so the samples will be repeated.
104+
90105
## Inference
91106
Generate multiple samples and use CLAP to select the best ones:
92107
```shell

0 commit comments

Comments
 (0)