Data structure changes caused by pyannote version update, as well as timestamp recognition issues and fixed

#5
by a112292454 - opened
  1. 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

  1. 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)

Sign up or log in to comment