Fine Tune the hind Nvidia Nemo

Trying to finetune the pretrained nemo model with below command
python speech_to_text_ctc_bpe.py --config-path=“/path/to/confiig/file” --config-name=“conformer_ctc_bpe_v13” trainer.max_epochs=50 +init_from_nemo_model=“path/to/stt_hi_conformer_ctc_medium.nemo”

Getting error as shown below:
from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for encoder.layers.17.norm_self_att.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for encoder.layers.17.norm_self_att.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for encoder.layers.17.self_attn.pos_bias_u: copying a param with shape torch.Size([4, 64]) from checkpoint, the shape in current model is torch.Size([8, 64]).
size mismatch for encoder.layers.17.self_attn.pos_bias_v: copying a param with shape torch.Size([4, 64]) from checkpoint, the shape in current model is torch.Size([8, 64]).
size mismatch for encoder.layers.17.self_attn.linear_q.weight: copying a param with shape torch.Size([256, 256]) from checkpoint, the shape in current model is torch.Size([512, 512]).
size mismatch for encoder.layers.17.self_attn.linear_q.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for encoder.layers.17.self_attn.linear_k.weight: copying a param with shape torch.Size([256, 256]) from checkpoint, the shape in current model is torch.Size([512, 512]).
size mismatch for encoder.layers.17.self_attn.linear_k.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for encoder.layers.17.self_attn.linear_v.weight: copying a param with shape torch.Size([256, 256]) from checkpoint, the shape in current model is torch.Size([512, 512]).
size mismatch for encoder.layers.17.self_attn.linear_v.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for encoder.layers.17.self_attn.linear_out.weight: copying a param with shape torch.Size([256, 256]) from checkpoint, the shape in current model is torch.Size([512, 512]).
size mismatch for encoder.layers.17.self_attn.linear_out.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for encoder.layers.17.self_attn.linear_pos.weight: copying a param with shape torch.Size([256, 256]) from checkpoint, the shape in current model is torch.Size([512, 512]).
size mismatch for encoder.layers.17.norm_feed_forward2.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for encoder.layers.17.norm_feed_forward2.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for encoder.layers.17.feed_forward2.linear1.weight: copying a param with shape torch.Size([1024, 256]) from checkpoint, the shape in current model is torch.Size([2048, 512]).
size mismatch for encoder.layers.17.feed_forward2.linear1.bias: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([2048]).
size mismatch for encoder.layers.17.feed_forward2.linear2.weight: copying a param with shape torch.Size([256, 1024]) from checkpoint, the shape in current model is torch.Size([512, 2048]).
size mismatch for encoder.layers.17.feed_forward2.linear2.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for encoder.layers.17.norm_out.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for encoder.layers.17.norm_out.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for decoder.decoder_layers.0.weight: copying a param with shape torch.Size([129, 256, 1]) from checkpoint, the shape in current model is torch.Size([129, 512, 1]).

Can you please help out with the error?

Hi @iamgarimanarang

Thanks for your interest in Riva

Since it is related to Nemo, Please file the issue at below Github link

Thanks

Hi @rvinobha,

Thanks for the response. I’ve created a new Git issue for the same.

Hi @iamgarimanarang

I have inputs regarding this issue

The Issue seems to happen because you are using tokenizer vocabulary size of 512 whereas our pretrained medium model uses 128.

We suggest to use 128 vocab size only.

Please try and let us know

Thanks

Okay @rvinobha
Will try it

Hi @rvinobha
I’ve used the tokenizer_spe_unigram_v128.
This is how I created the tokenizer. I did not use 512 as vocab. size.
tao speech_to_text_conformer create_tokenizer -e /specs/speech_to_text_conformer/create_tokenizer.yaml -r /results/conformer/create_tokenizer manifests=/data/train_manifest.json output_root=/data/con_asr vocab_size=128.
Can you please let me know if this is correct and let me know if there is some other way to create the vocab?

Hi @iamgarimanarang

Can you please share the create_tokenizer.yaml used
in path /specs/speech_to_text_conformer/create_tokenizer.yaml
with us

Also we request the following changes in Nemo

i.e project under which speech_to_text_ctc_bpe.py scripts exists

in conformer_ctc_bpe.yaml file,
Change Line no 106 from
d_model: 512
to
d_model: 256

in same conformer_ctc_bpe.yaml file,
Change Line no 119 from
n_heads: 8
to
n_heads: 4

and try again and let us know if it helps

Thanks

Please find attached the yaml file. Also, I’m updating the changes in the conformer yaml file.
Uploading: create_tokenizer.yaml…

Training is happening after updating the above parameters.

Thanks, @rvinobha

Hi @rvinobha
Can you help me with the parameter to enable in order to save the best model?

Thanks,
Garima Narang

Hi @rvinobha
I’m trying to convert the model using nemo2riva but getting segmentation fault error.
Can you please check this?
nemo2riva --out Conformer-CTC-BPE.riva Conformer-CTC-BPE/2023-01-16_07-30-05/checkpoints/Conformer-CTC-BPE.nemo

Thanks
Garima Narang

Hi @iamgarimanarang

can help me with the parameter to enable in order to save the best model?

I will get back to the developers on this request and provide inputs

I’m trying to convert the model using nemo2riva but getting segmentation fault error.
Can you please check this?

Apologies you are facing issue
Will it be possible to share the model with us via GoogleDrive/OneDrive, that will be the best to test the scenario and reproduce from our end, (if yes please let me know i will send an an email in private)

Also request to share the nemo version used
please run pip list and share the complete output with us

Thanks

Hi @rvinobha

Thanks @rvinobha. I am able to do the conversion. It was a version problem.

I’ve done riva-build and riva-deploy and now I want to run the riva_client. Can you send me the sample config.sh for riva_quickstart_v2.8.1 I’m getting errors while running the client.
E0117 07:52:06.480595 207 grpc_riva_asr.cc:885] Error: Unavailable model requested given these parameters: language_code=hi-IN; type=offline;

Can you please help me out with the issue?

Thanks
Garima Narang

Hi @rvinobha,

I used the parameter +save_best_model=True while fine-tuning the model. Please confirm and let me know if this is how we get the best model. Also, verify if the best model gets saved in checkpoints/Conformer-CTC-BPE.nemo.

Thanks
Garima Narang

Hi @rvinobha
Yes, I can share the model in private. Let me know how to share.
Thanks,
Garima

Hi @iamgarimanarang

I got some inputs from developers choosing best model

By default the yaml should save top 3 or top 5 based on lowest wer. this is default behaviour,

However, you can leverage checkpoint averaging across them and 95% of the time u will get a model which is more accurate than top1

For the model sharing, i have sent the drive link to your email (the gmail you have created account with forum), Please upload the model, let me know once done

Hi @rvinobha
I’ve uploaded the model on the link. Kindly check.

Thanks,
Garima Narang

Hi @iamgarimanarang

Thanks for sharing the nemo model
Will it be possible to also share the nemo2riva converted .riva model in the same drive

Thanks

Hi @rvinobha

Uploaded the converted .riva model in the drive.

Thanks

Hi @iamgarimanarang

I was able to get the riva-build and riva-deploy done,
But facing error on riva_start.sh

I am checking with the developers, once i fix and get it running, will share you the notebook

Thanks