Instructions to use kotoba-tech/kotoba-whisper-v2.2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kotoba-tech/kotoba-whisper-v2.2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="kotoba-tech/kotoba-whisper-v2.2")# Load model directly from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq processor = AutoProcessor.from_pretrained("kotoba-tech/kotoba-whisper-v2.2") model = AutoModelForSpeechSeq2Seq.from_pretrained("kotoba-tech/kotoba-whisper-v2.2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Data structure changes caused by pyannote version update, as well as timestamp recognition issues and fixed
#5
by a112292454 - opened
- pyannote-audio was updated, causing the code to become unusable
See also:
https://github.com/pyannote/pyannote-audio/pull/1917/files#diff-02c250da4a29a8ebf4c8821d62e99a70dfbb4e0a2307f535615de20705c2cbaf
It states that if legacy is not passed in, the returned result will be changed to the DiarizeOutput type, which is not an Annotation subclass. Therefore, labels = list(sd.labels()) and a series of subsequent operations in your code will report errors.
Typical:
/kotoba_whisper.py", line 194, in preprocess labels = list(sd.labels()) ^^^^^^^^^ AttributeError: 'DiarizeOutput' object has no attribute 'labels'
See: https://discuss.huggingface.co/t/problem-with-pyannote-audio-3-1-0/169326/4
https://huggingface.co/kotoba-tech/kotoba-whisper-v2.2/discussions/3 (There is no effective method given here)
However, I did not change the version of the audio library (back to 3.1.x), because this would lead to more version dependency issues
I modified line 66 in your kotoba_whisper.py:
return output
-> return output.speaker_diarization
Then there will be no more problems
- However, there seems to be another problem unrelated to this:
When in the postprocess, in the result recognized by _decode_asr, if the first timestamp is 0 (that is, token 50365), it will cause the timestamp to return none, causing an error in line 260 (means c["timestamp"] is none)
I handled it by adding a line before it
c["timestamp"]=c["timestamp"] if c["timestamp"][0] is not None else (0.00,0.00)