SeanNaren / deepspeech.pytorch

Speech Recognition using DeepSpeech2.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FineTune with new label.json

masoudMZB opened this issue · comments

I'm trying to finetune the librispeech model to train a Persian STT.
this is the command :
CUDA_VISIBLE_DEVICES=1 python train.py data.train_path=/mnt/ssd/masoud_parpanchi/cv-corpus-6.1-2020-12-11/fa/clips/train_data.json data.val_path=/mnt/ssd/masoud_parpanchi/cv-corpus-6.1-2020-12-11/fa/clips/dev_data.json trainer.gpus=1 data.batch_size=4 trainer.resume_from_checkpoint=/mnt/ssd/masoud_parpanchi/deepspeech2/checkpoint_libriSpeech/librispeech_pretrained_v3.ckpt

But I get the following error

Error executing job with overrides: ['data.train_path=/mnt/ssd/masoud_parpanchi/cv-corpus-6.1-2020-12-11/fa/clips/train_data.json', 'data.val_path=/mnt/ssd/masoud_parpanchi/cv-corpus-6.1-2020-12-11/fa/clips/dev_data.json', 'trainer.gpus=1', 'data.batch_size=4', 'trainer.resume_from_checkpoint=/mnt/ssd/masoud_parpanchi/deepspeech2/checkpoint_libriSpeech/librispeech_pretrained_v3.ckpt']
Traceback (most recent call last):
File "/mnt/ssd/masoud_parpanchi/deepspeech2/deepspeech.pytorch/train.py", line 21, in hydra_main
train(cfg=cfg)
File "/mnt/ssd/masoud_parpanchi/deepspeech2/deepspeech.pytorch/deepspeech_pytorch/training.py", line 53, in train
trainer.fit(model, data_loader)
File "/home/shenasa/anaconda3/envs/deepspeech2/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 499, in fit
self.dispatch()
File "/home/shenasa/anaconda3/envs/deepspeech2/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 546, in dispatch
self.accelerator.start_training(self)
File "/home/shenasa/anaconda3/envs/deepspeech2/lib/python3.9/site-packages/pytorch_lightning/accelerators/accelerator.py", line 73, in start_training
self.training_type_plugin.start_training(trainer)
File "/home/shenasa/anaconda3/envs/deepspeech2/lib/python3.9/site-packages/pytorch_lightning/plugins/training_type/training_type_plugin.py", line 114, in start_training
self._results = trainer.run_train()
File "/home/shenasa/anaconda3/envs/deepspeech2/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 602, in run_train
self._pre_training_routine()
File "/home/shenasa/anaconda3/envs/deepspeech2/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 593, in _pre_training_routine
self.checkpoint_connector.restore_weights()
File "/home/shenasa/anaconda3/envs/deepspeech2/lib/python3.9/site-packages/pytorch_lightning/trainer/connectors/checkpoint_connector.py", line 73, in restore_weights
self.restore(self.trainer.resume_from_checkpoint, on_gpu=self.trainer._device_type == DeviceType.GPU)
File "/home/shenasa/anaconda3/envs/deepspeech2/lib/python3.9/site-packages/pytorch_lightning/trainer/connectors/checkpoint_connector.py", line 100, in restore
self.restore_model_state(model, checkpoint)
File "/home/shenasa/anaconda3/envs/deepspeech2/lib/python3.9/site-packages/pytorch_lightning/trainer/connectors/checkpoint_connector.py", line 124, in restore_model_state
model.load_state_dict(checkpoint['state_dict'])
File "/home/shenasa/anaconda3/envs/deepspeech2/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1406, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for DeepSpeech:
size mismatch for fc.0.module.1.weight: copying a param with shape torch.Size([29, 1024]) from checkpoint, the shape in current model is torch.Size([39, 1024]).

I Saw there was a finetune flag before but now How to do this? The English model has 29 chars but I have 39.

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.