Poor performance with whisper.cpp or faster-whisper

#6
by digikar - opened

Hello, thank you for finetuning whisper for Hindi!

I tried it out on both whisper.cpp and faster-whisper in an attempt to run it efficiently on CPU. For a sample audio I'm testing it out on, the provided whisper-hindi-large-v2 model produces the following output:

हैलो हैलो मैं बोल रहा हूँ आपकी क्वीरी जो सॉल्व नहीं हुई थी फर्स्ट आपका मेल मिला था हमारी तरफ से तीन मेल भी गए थे उसका रिस्पॉन्स नहीं अच्छा मैं ये बता रहा था मैडम इसमें ज्यादा प्रॉब्लम होगी नहीं तो आज मैने स्पेशली अपने ब्रांच मैनेजर से कहा मैने कहा निधि का करो या उनका फिर वो फंड में हाँ तो मैं अभी क्या करूँ मैडम मैं आपकी कॉल ट्रांसफर कर रहा हूँ अभी दो एजेंट �्य और भोलू प्रसाद दोनों खाली है न तो इनमें से मैडम को कोई भी समझा देगा भोलू प्रसाद को ट्रांसफर कर देता हूँ मैं आपकी कॉल नहीं नहीं वेट वेट वेट हाँ एकलव्य सर आई थिंक अपने एकलव्य किसी का नाम या उनको ट्रांसफर कर दीजिये आई डोंट नो

However, with whisper.cpp, the output is quite poor. The model was obtained using the procedure described here. It produces the following output:

[00:00:02.040 --> 00:00:32.040] हैलो हैलो निधि में मैं बैंक से बोल रहा हूँ आपकी क्वेरी जो सॉल्व नहीं हुई थी सॉरी फर्स्ट आपका मेल मिला था हमारी तरफ से तीन मेल भी गए थे उसका रिस्पॉन्स नहीं अभी
[00:00:32.040 --> 00:01:02.040] मैं आपकी कॉल ट्रांसफर कर रहा हूं

For faster-whisper, as suggested here, the model was obtained using:

ct2-transformers-converter --model /path/to/whisper-hindi-large-v2/ --output_dir whisper-large-v2-ct2
--copy_files tokenizer_config.json preprocessor_config.json

It produced:

[0.00s -> 0.96s] हैलो हैलो मैं बोल रहा हूँ आपकी जो सॉल्व नहीं हुई थी फर्स्ट आपका मेल मिला था हमारी तरफ से तीन मेल भी गए थे उसका रिस्पॉन्स नहीं अभी
[30.00s -> 30.72s] तो मैं अभी क्या करूँ मैडम मैं आपकी कॉल ट्रांसफर कर रहा हूँ

On a closer look, it seems that in both cases, the model is picking up on the first several words and losing out on everything else in the... segment. So, I wonder if the problem is something silly. Should I be changing any parameters for the two run-scripts? I have already tried setting chunk_length=30 for WhisperModel in faster_whisper. This should anyways be taken from the preprocessor_config.json.

Let me know if you (or anyone) have any thoughts on this!

By removing chunk_length_s=30, I'm able to reproduce the poor performance with the model version in this repository. So, it seems it is doing a fair bit of magic too.

Output with chunk_length_s=30:

Transcription: हैलो हैलो मैं बोल रहा हूँ आपकी क्वीरी जो सॉल्व नहीं हुई थी फर्स्ट आपका मेल मिला था हमारी तरफ से तीन मेल भी गए थे उसका रिस्पॉन्स नहीं अच्छा मैं ये बता रहा था मैडम इसमें ज्यादा प्रॉब्लम होगी नहीं तो आज मैने स्पेशली अपने ब्रांच मैनेजर से कहा मैने कहा निधि का करो या उनका फिर वो फंड में हाँ तो मैं अभी क्या करूँ मैडम मैं आपकी कॉल ट्रांसफर कर रहा हूँ अभी दो एजेंट �्य और भोलू प्रसाद दोनों खाली है न तो इनमें से मैडम को कोई भी समझा देगा भोलू प्रसाद को ट्रांसफर कर देता हूँ मैं आपकी कॉल नहीं नहीं वेट वेट वेट हाँ एकलव्य सर आई थिंक अपने एकलव्य किसी का नाम या उनको ट्रांसफर कर दीजिये आई डोंट नो

Output without chunk_length_s=30:

Transcription: हैलो हैलो मैं बोल रहा हूँ आपकी क्वीरी जो सॉल्व नहीं हुई थी फर्स्ट आपका मेल मिला था हमारी तरफ से तीन मेल भी गए थे उसका रिस्पॉन्स नहीं अभी

I'm able to get the ctranslate2 version of this model working for this particular audio through whisperX. Even with an int8 quantization, it produced a very reasonable transcription (60 second audio, 3 minutes processing time on an i7-8750H from 2017 :)):

हैलो हैलो नीति में मैं बैंक से बोल रहा हूँ आपकी कोरी जो सॉल्व नहीं हुई थी सॉरी फर्स्ट पॉल आपका मेल मिला था हमारी तरफ से तीन मेल भी गए थे उसका रिस्पॉन्स नहीं अभी
आई थिंक मेरे पास शायद मेल आया नहीं मैंने चकनी किया फेस्टिवल है ना ओके ओके ओके सॉरी सॉरी अच्छा मैं ये बता रहा था मैडम इसमें ज्यादा प्रॉब्लम होगी नहीं तो आज मैंने स्पेशली अपने ब्रांच मैनेजर से कहा मैंने कहा निधि का सॉल्व कर
एकलव्य और भोलू प्रसाद दोनों खाली है न तो इनमें से मैडम को कोई भी समझा देगा भोलू प्रसाद को ट्रांसफर कर देता हूँ मैं आपकी कॉल नहीं नहीं नहीं वेट वेट वेट हाँ एकलव्य सर आई थिंक अपने एकलव्य किसी का नाम या उनको ट्रांसफर कर

However, I also want to be able to diarize this, and the pyannote.audio diarization pipeline that whisperX uses performs abysmally on this audio. So, now that is the next target.

The full hindi diarization facilities are available through whisper-diarization. I have made the quantized model available at digikar/vasista22-whisper-hindi-large-v2-ct2-int8.

The output is still less than perfect, but very much reasonable. whisper-diarization also produces the srt file with appropriate timestamps. Here is the diarized transcript:

  • Speaker 1: हैलो
  • Speaker 0: हैलो नीति में मैं बैंक से बोल रहा हूँ आपकी क्वेरी जो सॉल्व नहीं हुई थी सॉरी फर्स्ट पॉल आपका मेल मिला था हमारी तरफ से तीन मेल भी गए थे उसका रिस्पॉन्स नहीं अभी
  • Speaker 1: आई थिंक मेरे पास शायद मेल आया नहीं मैंने चेक नहीं किया फेस्टिवल है ना
  • Speaker 0: ओके ओके ओके सॉरी सॉरी अच्छा मैं ये बता रहा था मैडम इसमें ज्यादा प्रॉब्लम होगी नहीं तो आज मैंने स्पेशली अपने ब्रांच मैनेजर से कहा मैंने कहा निधि का सॉल् एकलव्य और भोलू प्रसाद दोनों खाली है न तो इनमें से मैडम को कोई भी समझा देगा भोलू प्रसाद को ट्रांसफर कर देता हूँ मैं आपकी कॉल
  • Speaker 1: नहीं नहीं नहीं वेट वेट वेट
  • Speaker 0: हाँ
  • Speaker 1: एकलव्य सर आई थिंक अपने एकलव्य किसी का नाम या उनको ट्रांसफर कर
digikar changed discussion status to closed

Sign up or log in to comment