openspeech-team / openspeech

Open-Source Toolkit for End-to-End Speech Recognition leveraging PyTorch-Lightning and Hydra.
https://openspeech-team.github.io/openspeech/
MIT License
670 stars 112 forks source link

Unsupported criterion: CTCLoss (error) #189

Closed ccyang123 closed 1 year ago

ccyang123 commented 1 year ago

❓ Questions & Help

When I changed the "criterion" from 'cross_entropy' to 'ctc', the following error occurs. (cross_entropy can work fine)

File "/Desktop/CodeFolder/ASR/openspeech/openspeech/models/openspeech_encoder_decoder_model.py", line 97, in collect_outputs raise ValueError(f"Unsupported criterion: {self.criterion}") ValueError: Unsupported criterion: CTCLoss( (ctc_loss): CTCLoss()

Details

My training script is as followings: python ./openspeech_cli/hydra_train.py dataset="librispeech" dataset.dataset_download=False dataset.dataset_path=$DATASET_PATH dataset.dataset_path="/dataSSD/" dataset.manifest_file_path=$MANIFEST_FILE_PATH dataset.manifest_file_path="/dataSSD/LibriSpeech/libri_subword_manifest.txt" tokenizer=libri_subword tokenizer.vocab_path=$VOCAB_FILE_PATH tokenizer.vocab_path="/dataSSD/LibriSpeech" model=conformer_lstm audio=fbank trainer=gpu lr_scheduler=warmup_reduce_lr_on_plateau ++trainer.accelerator=dp ++trainer.batch_size=64 ++trainer.num_workers=4 criterion=ctc

akthddus22 commented 1 year ago

I got same problem with many other models too. I think that, some models only support 1 loss function. Actually It makes sense because there are some model which needs ctc loss critically while the others are not.

upskyy commented 1 year ago

@ccyang123 @akthddus22 That's right. There is a criterion supported by each model. It would be good to refer to this. https://github.com/openspeech-team/openspeech/wiki/Criterion-suitable-for-the-model#criterion

ccyang123 commented 1 year ago

Got it! Thank you for your reply.