jianfch / stable-ts

Transcription, forced alignment, and audio indexing with OpenAI's Whisper
MIT License
1.59k stars 176 forks source link

Assertion error, stable_whisper.transcribe_any #246

Closed mmichelli closed 1 year ago

mmichelli commented 1 year ago

Using stable_whisper.transcribe_any

I get an assertion error because the order is reversed here: https://github.com/jianfch/stable-ts/blob/5c512a1880b937025792d441b98f5a13ab5a735e/stable_whisper/result.py#L52

The inference function returns an array of words sorted by start, but I suspect there must be a slight overlap.

Does it have to throw an error?

jianfch commented 1 year ago

The inference function returns an array of words sorted by start, but I suspect there must be a slight overlap.

If the words are sorted by start in ascending order, it shouldn't throw this error because self.start <= other.start will always be true. Try force_order=True. https://github.com/jianfch/stable-ts/blob/b336735ff784bb59690eec8f9f706b0151dda74c/stable_whisper/non_whisper.py#L107-L109

mmichelli commented 1 year ago

It happens on the last step of the regoup, and the words are swapped, so self.start <= other.start and self.end<= other.end

jianfch commented 1 year ago

The assert statements have been removed in a038ad18c8ed86aafe298b5a0f67c45bf7ffadb2.