Skip to content

Commit

Permalink
Merge branch 'main' into long_clus
Browse files Browse the repository at this point in the history
  • Loading branch information
nithinraok committed Nov 6, 2023
2 parents 22dee0a + 86b198f commit 1416307
Show file tree
Hide file tree
Showing 78 changed files with 2,872 additions and 171 deletions.
96 changes: 64 additions & 32 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pipeline {
agent {
docker {
image 'nvcr.io/nvidia/pytorch:23.09-py3'
args '--device=/dev/nvidia0 --gpus all --user 0:128 -v /home/TestData:/home/TestData -v $HOME/.cache:/root/.cache --shm-size=8g --env TRANSFORMERS_OFFLINE=1 --env HYDRA_FULL_ERROR=1'
args '--device=/dev/nvidia0 --gpus all --user 0:128 -v /home/TestData:/home/TestData -v $HOME/.cache:/root/.cache --shm-size=8g --env TRANSFORMERS_OFFLINE=0 --env HYDRA_FULL_ERROR=1'
}
}
options {
Expand Down Expand Up @@ -194,7 +194,7 @@ pipeline {
stage('Speech To Text Finetuning') {
steps {
sh 'python examples/asr/speech_to_text_finetune.py \
--config-path="conf" --config-name="speech_to_text_finetune" \
--config-path="conf/asr_finetune" --config-name="speech_to_text_finetune" \
model.train_ds.manifest_filepath=/home/TestData/an4_dataset/an4_train.json \
model.validation_ds.manifest_filepath=/home/TestData/an4_dataset/an4_val.json \
init_from_nemo_model=/home/TestData/asr/stt_en_fastconformer_transducer_large.nemo \
Expand All @@ -207,6 +207,38 @@ pipeline {
}
}

stage('Speech To Text HF Finetuning') {
steps {
sh 'python examples/asr/speech_to_text_finetune.py \
--config-path="conf/asr_finetune" --config-name="speech_to_text_hf_finetune" \
~model.train_ds.hf_data_cfg \
model.train_ds.num_workers=1 \
model.train_ds.batch_size=2 model.validation_ds.batch_size=2 \
model.train_ds.streaming=true \
+model.train_ds.hf_data_cfg.path="librispeech_asr" \
+model.train_ds.hf_data_cfg.name=null \
+model.train_ds.hf_data_cfg.split="test.clean" \
+model.train_ds.hf_data_cfg.streaming=true \
~model.validation_ds.hf_data_cfg \
model.validation_ds.streaming=true \
+model.validation_ds.hf_data_cfg.path="librispeech_asr" \
+model.validation_ds.hf_data_cfg.name=null \
+model.validation_ds.hf_data_cfg.split="test.clean" \
+model.validation_ds.hf_data_cfg.streaming=true \
~model.test_ds \
init_from_nemo_model=/home/TestData/asr/stt_en_fastconformer_transducer_large.nemo \
model.tokenizer.update_tokenizer=False \
model.optim.sched.warmup_steps=0 \
+model.optim.sched.max_steps=3 \
trainer.max_epochs=null \
trainer.devices=[1] \
trainer.accelerator="gpu" \
+trainer.fast_dev_run=True \
exp_manager.exp_dir=examples/asr/speech_finetuning_results'
sh 'rm -rf examples/asr/speech_finetuning_results'
}
}

// TODO: Please Fix Me
// Error locating target 'nemo.collections.asr.modules.wav2vec_modules.ConvFeatureEncoder', see chained exception above.
// stage('L2: Speech Pre-training - Wav2Vec') {
Expand Down Expand Up @@ -801,7 +833,7 @@ pipeline {
// TODO: pleasefixme @redoctopus
// stage('ByT5G2P training, evaluation and inference') {
// steps {
// sh 'TRANSFORMERS_OFFLINE=1 && cd examples/tts/g2p && \
// sh 'cd examples/tts/g2p && \
// TIME=`date +"%Y-%m-%d-%T"` && OUTPUT_DIR_T5=output_byt5_${TIME} && \
// python g2p_train_and_evaluate.py \
// train_manifest=/home/TestData/g2p/g2p.json \
Expand All @@ -818,7 +850,7 @@ pipeline {
// python g2p_inference.py \
// pretrained_model=${OUTPUT_DIR_T5}/T5G2P/test/checkpoints/T5G2P.nemo \
// manifest_filepath=/home/TestData/g2p/g2p.json \
// phoneme_field=text && TRANSFORMERS_OFFLINE=1'
// phoneme_field=text'
// }
// }
stage('HeteronymClassificationModel training, evaluation and inference') {
Expand Down Expand Up @@ -945,7 +977,7 @@ pipeline {
parallel {
stage('Dialogue: Intent and slot classification using GPT') {
steps {
sh 'TRANSFORMERS_OFFLINE=1 && cd examples/nlp/dialogue && \
sh 'cd examples/nlp/dialogue && \
python dialogue.py \
model.dataset.data_dir=/home/TestData/nlp/sgd_small \
model.language_model.lm_checkpoint=/home/TestData/nlp/gpt2/pytorch_model.bin\
Expand All @@ -972,7 +1004,7 @@ pipeline {
}
stage('Intent and slot classification using SGDQA') {
steps {
sh 'TRANSFORMERS_OFFLINE=1 && cd examples/nlp/dialogue && \
sh 'cd examples/nlp/dialogue && \
python dialogue.py \
model.dataset.data_dir=/home/TestData/nlp/sgd_small \
model.dataset.dialogues_example_dir=sgd_gen_bert_outputs \
Expand All @@ -995,7 +1027,7 @@ pipeline {
}
stage('Intent and slot classification using IntentSlotClassificationModel') {
steps {
sh 'TRANSFORMERS_OFFLINE=1 && cd examples/nlp/dialogue && \
sh 'cd examples/nlp/dialogue && \
python dialogue.py \
model.dataset.data_dir=/home/TestData/nlp/processed_assistant \
model.dataset.dialogues_example_dir=sgd_gen_bert_intent_classification_outputs \
Expand All @@ -1012,12 +1044,12 @@ pipeline {
model.language_model.pretrained_model_name=bert-base-uncased \
trainer.accelerator=gpu \
exp_manager=null && \
rm -rf sgd_gen_bert_intent_classification_outputs && TRANSFORMERS_OFFLINE=1'
rm -rf sgd_gen_bert_intent_classification_outputs'
}
}
stage('Intent classification using ZeroShotIntentModel') {
steps {
sh 'TRANSFORMERS_OFFLINE=1 && cd examples/nlp/dialogue && \
sh 'cd examples/nlp/dialogue && \
python dialogue.py \
do_training=False \
model.dataset.data_dir=/home/TestData/nlp/drive_thru_revised \
Expand All @@ -1037,12 +1069,12 @@ pipeline {
model.language_model.pretrained_model_name=bert-base-uncased \
trainer.accelerator=gpu \
exp_manager=null && \
rm -rf sgd_gen_zero_shot_intent_classification_outputs && TRANSFORMERS_OFFLINE=1'
rm -rf sgd_gen_zero_shot_intent_classification_outputs'
}
}
stage('Design Intent classification using ZeroShotIntentModel') {
steps {
sh 'TRANSFORMERS_OFFLINE=1 && cd examples/nlp/dialogue && \
sh 'cd examples/nlp/dialogue && \
python dialogue.py \
do_training=False \
model.dataset.data_dir=/home/TestData/nlp/design_dataset \
Expand All @@ -1063,12 +1095,12 @@ pipeline {
model.language_model.pretrained_model_name=bert-base-uncased \
trainer.accelerator=gpu \
exp_manager=null && \
rm -rf design_zero_shot_intent_classification_outputs && TRANSFORMERS_OFFLINE=1'
rm -rf design_zero_shot_intent_classification_outputs'
}
}
stage('Design Intent classification using ZeroShotIntentModel BART Classifier') {
steps {
sh 'TRANSFORMERS_OFFLINE=1 && cd examples/nlp/dialogue && \
sh 'cd examples/nlp/dialogue && \
python dialogue.py \
do_training=False \
model.dataset.data_dir=/home/TestData/nlp/design_dataset \
Expand All @@ -1082,12 +1114,12 @@ pipeline {
model.language_model.pretrained_model_name=bert-base-uncased \
trainer.accelerator=gpu \
exp_manager=null && \
rm -rf design_zero_shot_intent_classification_bart_outputs && TRANSFORMERS_OFFLINE=1'
rm -rf design_zero_shot_intent_classification_bart_outputs'
}
}
stage('Design Intent classification using DialogueNearestNeighbourModel') {
steps {
sh 'TRANSFORMERS_OFFLINE=1 && cd examples/nlp/dialogue && \
sh 'cd examples/nlp/dialogue && \
python dialogue.py \
do_training=False \
model.dataset.data_dir=/home/TestData/nlp/design_dataset \
Expand All @@ -1100,7 +1132,7 @@ pipeline {
model.language_model.pretrained_model_name=sentence-transformers/all-MiniLM-L6-v2 \
trainer.accelerator=gpu \
exp_manager=null && \
rm -rf design_dialogue_nearest_neighbour_classification_outputs && TRANSFORMERS_OFFLINE=1'
rm -rf design_dialogue_nearest_neighbour_classification_outputs'
}
}
}
Expand All @@ -1116,7 +1148,7 @@ pipeline {
parallel {
stage('Dialogue: Answer Extender using DialogueS2SGenerationModel') {
steps {
sh 'TRANSFORMERS_OFFLINE=1 && cd examples/nlp/dialogue && \
sh 'cd examples/nlp/dialogue && \
python dialogue.py \
do_training=False \
model.dataset.data_dir=/home/TestData/nlp/ms-marco-qa \
Expand All @@ -1141,7 +1173,7 @@ pipeline {
}
stage('Dialogue: SGD Based Answer Extender using DialogueS2SGenerationModel') {
steps {
sh 'TRANSFORMERS_OFFLINE=1 && cd examples/nlp/dialogue && \
sh 'cd examples/nlp/dialogue && \
python dialogue.py \
do_training=False \
model.dataset.data_dir=/home/TestData/nlp/sgd_small \
Expand Down Expand Up @@ -1182,7 +1214,7 @@ pipeline {
// parallel {
// stage('Dialogue: Answer Extender using DialogueGPTGenerationModel') {
// steps {
// sh 'TRANSFORMERS_OFFLINE=1 && cd examples/nlp/dialogue && \
// sh 'cd examples/nlp/dialogue && \
// python dialogue.py \
// do_training=False \
// model.dataset.data_dir=/home/TestData/nlp/ms-marco-qa \
Expand Down Expand Up @@ -1212,7 +1244,7 @@ pipeline {
parallel {
stage('Dialogue: Answer Extender using DialogueGPTGenerationModel') {
steps {
sh 'TRANSFORMERS_OFFLINE=0 && cd examples/nlp/dialogue && \
sh 'cd examples/nlp/dialogue && \
python dialogue.py \
do_training=False \
model.dataset.data_dir=/home/TestData/nlp/ms-marco-qa \
Expand Down Expand Up @@ -1336,7 +1368,7 @@ pipeline {
stage('BERT SQUAD 1.1') {
// Cannot do fast_dev_run because squad needs whole dev dataset
steps {
sh 'TRANSFORMERS_OFFLINE=1 && cd examples/nlp/question_answering && \
sh 'cd examples/nlp/question_answering && \
python question_answering.py \
model.train_ds.file=/home/TestData/nlp/squad_mini/v1.1/train-v1.1.json \
model.dataset.use_cache=false \
Expand All @@ -1355,13 +1387,13 @@ pipeline {
trainer.precision=16 \
trainer.devices=[0] \
trainer.accelerator="gpu" \
exp_manager=null && TRANSFORMERS_OFFLINE=1'
exp_manager=null'
}
}
stage('BERT SQUAD 2.0') {
// Cannot do fast_dev_run because squad needs whole dev dataset
steps {
sh 'TRANSFORMERS_OFFLINE=1 && cd examples/nlp/question_answering && \
sh 'cd examples/nlp/question_answering && \
python question_answering.py \
model.train_ds.file=/home/TestData/nlp/squad_mini/v2.0/train-v2.0.json \
model.dataset.use_cache=false \
Expand All @@ -1377,7 +1409,7 @@ pipeline {
trainer.precision=16 \
trainer.devices=[1] \
trainer.accelerator="gpu" \
exp_manager=null && TRANSFORMERS_OFFLINE=1'
exp_manager=null'
}
}
}
Expand All @@ -1395,7 +1427,7 @@ pipeline {
stage('BART SQUAD 1.1') {
// Cannot do fast_dev_run because squad needs whole dev dataset
steps {
sh 'TRANSFORMERS_OFFLINE=1 && cd examples/nlp/question_answering && \
sh 'cd examples/nlp/question_answering && \
python question_answering.py \
model.train_ds.file=/home/TestData/nlp/squad_mini/v1.1/train-v1.1.json \
model.dataset.use_cache=false \
Expand All @@ -1415,13 +1447,13 @@ pipeline {
trainer.precision=16 \
trainer.devices=[0] \
trainer.accelerator="gpu" \
exp_manager=null && TRANSFORMERS_OFFLINE=1'
exp_manager=null'
}
}
stage('BART SQUAD 2.0') {
// Cannot do fast_dev_run because squad needs whole dev dataset
steps {
sh 'TRANSFORMERS_OFFLINE=1 && cd examples/nlp/question_answering && \
sh 'cd examples/nlp/question_answering && \
python question_answering.py \
model.train_ds.file=/home/TestData/nlp/squad_mini/v2.0/train-v2.0.json \
model.dataset.use_cache=false \
Expand All @@ -1438,7 +1470,7 @@ pipeline {
trainer.precision=16 \
trainer.devices=[1] \
trainer.accelerator="gpu" \
exp_manager=null && TRANSFORMERS_OFFLINE=1'
exp_manager=null'
}
}
}
Expand All @@ -1456,7 +1488,7 @@ pipeline {
stage('GPT2 SQUAD 1.1') {
// Cannot do fast_dev_run because squad needs whole dev dataset
steps {
sh 'TRANSFORMERS_OFFLINE=0 && cd examples/nlp/question_answering && \
sh 'cd examples/nlp/question_answering && \
python question_answering.py \
model.train_ds.file=/home/TestData/nlp/squad_mini/v1.1/train-v1.1.json \
model.dataset.use_cache=false \
Expand All @@ -1476,13 +1508,13 @@ pipeline {
trainer.precision=16 \
trainer.devices=[0] \
trainer.accelerator="gpu" \
exp_manager=null && TRANSFORMERS_OFFLINE=1'
exp_manager=null'
}
}
stage('GPT2 SQUAD 2.0') {
// Cannot do fast_dev_run because squad needs whole dev dataset
steps {
sh 'TRANSFORMERS_OFFLINE=1 && cd examples/nlp/question_answering && \
sh 'cd examples/nlp/question_answering && \
python question_answering.py \
model.train_ds.file=/home/TestData/nlp/squad_mini/v2.0/train-v2.0.json \
model.dataset.use_cache=false \
Expand All @@ -1499,7 +1531,7 @@ pipeline {
trainer.precision=16 \
trainer.devices=[1] \
trainer.accelerator="gpu" \
exp_manager=null && TRANSFORMERS_OFFLINE=1'
exp_manager=null'
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -340,13 +340,13 @@ NeMo Text Processing, specifically (Inverse) Text Normalization, is now a separa

Docker containers:
~~~~~~~~~~~~~~~~~~
We release NeMo containers alongside NeMo releases. For example, NeMo ``r1.20.0`` comes with container ``nemo:23.06``, you may find more details about released containers in `releases page <https://github.com/NVIDIA/NeMo/releases>`_.
We release NeMo containers alongside NeMo releases. For example, NeMo ``r1.21.0`` comes with container ``nemo:23.08``, you may find more details about released containers in `releases page <https://github.com/NVIDIA/NeMo/releases>`_.

To use built container, please run

.. code-block:: bash
docker pull nvcr.io/nvidia/nemo:23.06
docker pull nvcr.io/nvidia/nemo:23.08
To build a nemo container with Dockerfile from a branch, please run

Expand All @@ -355,13 +355,13 @@ To build a nemo container with Dockerfile from a branch, please run
DOCKER_BUILDKIT=1 docker build -f Dockerfile -t nemo:latest .
If you choose to work with the main branch, we recommend using NVIDIA's PyTorch container version 23.06-py3 and then installing from GitHub.
If you choose to work with the main branch, we recommend using NVIDIA's PyTorch container version 23.08-py3 and then installing from GitHub.

.. code-block:: bash
docker run --gpus all -it --rm -v <nemo_github_folder>:/NeMo --shm-size=8g \
-p 8888:8888 -p 6006:6006 --ulimit memlock=-1 --ulimit \
stack=67108864 --device=/dev/snd nvcr.io/nvidia/pytorch:23.06-py3
stack=67108864 --device=/dev/snd nvcr.io/nvidia/pytorch:23.08-py3
Examples
--------
Expand Down
12 changes: 12 additions & 0 deletions docs/source/asr/configs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,18 @@ The same script can be used to finetune CTC, RNNT or Hybrid models as well.
trainer.max_epochs=50 \
+init_from_nemo_model="<path to .nemo model file>" (or +init_from_pretrained_model="<name of pretrained checkpoint>")
Refer to <NeMo_repo>/examples/asr/conf/asr_finetune/speech_to_text_finetune.yaml for more details.
Finetune ASR Models using HuggingFace Datasets
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Users can utilize HuggingFace Datasets for finetuning NeMo ASR models. The following config file can be used for this purpose:
`<NeMo_repo>/examples/asr/conf/asr_finetune/speech_to_text_hf_finetune.yaml`
As mentioned earlier, users can update the tokenizer or use an existing one based on their requirements. If users want to create a new tokenizer
from HuggingFace Datasets, they can use the following script:
`<NeMo_repo>/scripts/tokenizers/get_hf_text_data.py`
Fine-tuning by changing model architecture and tokenizer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ Language Support Matrix
+------------------+----------+----------+----------+--------------------+----------------------+
| Arabic | ar | x | x | | |
+------------------+----------+----------+----------+--------------------+----------------------+
| Russian | ru | x | x | x | |
| Russian | ru | | x | x | |
+------------------+----------+----------+----------+--------------------+----------------------+
| Swedish | sv | x | x | | |
+------------------+----------+----------+----------+--------------------+----------------------+
Expand Down
Loading

0 comments on commit 1416307

Please sign in to comment.