jianfch / stable-ts

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

ValueError("n ({0}) cannot be negative".format(n)) *while using --align* #326

Closed barrars closed 7 months ago

barrars commented 7 months ago

while trying to align lyrics to an mp3 I get this error. I've been able to align smaller files but this is about 2.5 minutes long. I'm curious if theres something I should be doing different.

thanks,


➜  Downloads stable-ts drums.mp3 --align drums.txt  --language en -o drums.ass                        
Loaded Whisper base model   
Align: 100%|███████████████████████████████████████████████████████████████████████████████| 186.1/186.1 [00:11<00:00, 15.98sec/s]
Adjustment: 186.04sec [00:00, 36192.41sec/s]                                                                                      
Traceback (most recent call last):
  File "/home/lg/.local/bin/stable-ts", line 8, in <module>
    sys.exit(cli())
  File "/home/lg/.local/lib/python3.8/site-packages/stable_whisper/whisper_word_level/cli.py", line 705, in cli
    raise error
  File "/home/lg/.local/lib/python3.8/site-packages/stable_whisper/whisper_word_level/cli.py", line 693, in cli
    _cli(cmd=cmd, _cache=cache)
  File "/home/lg/.local/lib/python3.8/site-packages/stable_whisper/whisper_word_level/cli.py", line 660, in _cli
    result: WhisperResult = call_method_with_options(transcribe_method, transcribe_options)
  File "/home/lg/.local/lib/python3.8/site-packages/stable_whisper/whisper_word_level/cli.py", line 504, in call_method_with_options
    return method(**options)
  File "/home/lg/.local/lib/python3.8/site-packages/stable_whisper/alignment.py", line 557, in align
    result.suppress_silence(
  File "/home/lg/.local/lib/python3.8/site-packages/stable_whisper/result.py", line 1050, in suppress_silence
    tqdm_pbar.update(tqdm_pbar.total - tqdm_pbar.n)
  File "/usr/lib/python3/dist-packages/tqdm/_tqdm.py", line 1081, in update
    raise ValueError("n ({0}) cannot be negative".format(n))
ValueError: n (-18.379999999999995) cannot be negative
barrars commented 7 months ago

nevermind.....I need to take a walk. The following command worked


➜  temp stable-ts drums.mp3 --suppress_silence false  --align drums.txt --language en -o drums.ass
barrars commented 7 months ago

I'll re-open..... the following fails:

➜  temp stable-ts drums.mp3 --suppress_silence true  --align drums.txt --language en -o drums.ass

the following proceeds without error

➜  temp stable-ts drums.mp3 --suppress_silence false  --align drums.txt --language en -o drums.ass

omitting --suppress_silience also fails with the same error

➜  temp stable-ts drums.mp3  --align drums.txt --language en -o drums.ass
jianfch commented 7 months ago

This is caused by progress bar using the incorrect value for its total, so you should be able to prevent the error by disabling the progress bar with -v 0. But this issue should be fixed after ad013d7f80de2b090ccfe967eb7801c8094cdf8a.