oobabooga / text-generation-webui

A Gradio web UI for Large Language Models.
GNU Affero General Public License v3.0
40.57k stars 5.31k forks source link

Whisper STT: audioop.error: not a whole number of frames #5869

Closed JackieGLQ closed 4 months ago

JackieGLQ commented 6 months ago

Describe the bug

Traceback (most recent call last): File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\gradio\queueing.py", line 527, in process_events response = await route_utils.call_process_api( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\gradio\route_utils.py", line 261, in call_process_api output = await app.get_blocks().process_api( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\gradio\blocks.py", line 1786, in process_api result = await self.call_function( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\gradio\blocks.py", line 1338, in call_function prediction = await anyio.to_thread.run_sync( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\anyio\to_thread.py", line 56, in run_sync return await get_async_backend().run_sync_in_worker_thread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\anyio_backends_asyncio.py", line 2144, in run_sync_in_worker_thread return await future ^^^^^^^^^^^^ File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\anyio_backends_asyncio.py", line 851, in run result = context.run(func, args) ^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\gradio\utils.py", line 759, in wrapper response = f(args, **kwargs) ^^^^^^^^^^^^^^^^^^ File "E:\GaoLLM\Test\TextgenCN\text-generation-webui\extensions\whisper_stt\script.py", line 48, in auto_transcribe transcription = do_stt(audio, whipser_model, whipser_language) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\GaoLLM\Test\TextgenCN\text-generation-webui\extensions\whisper_stt\script.py", line 36, in do_stt transcription = r.recognize_whisper(audio_data, language=whipser_language, model=whipser_model) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\speech_recognition__init__.py", line 1486, in recognize_whisper wav_bytes = audio_data.get_wav_data(convert_rate=16000) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\speech_recognition\audio.py", line 146, in get_wav_data raw_data = self.get_raw_data(convert_rate, convert_width) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\speech_recognition\audio.py", line 91, in get_raw_data rawdata, = audioop.ratecv( ^^^^^^^^^^^^^^^ audioop.error: not a whole number of frames

Is there an existing issue for this?

Reproduction

audioop.error: not a whole number of frames

Screenshot

1713335561011 1713335652093

Logs

(TextgenCN) E:\GaoLLM\Test\TextgenCN\text-generation-webui>python server.py --listen --trust-remote-code
14:01:46-242352 INFO     正在启动Text generation web UI...
14:01:46-258582 WARNING  trust_remote_code已启用。这有危险。
14:01:46-259548 WARNING
                         您可能正在将Web界面暴露给整个互联网,而没有任何访问密码。
                         您可以使用“--gradio-auth”标志创建一个,如下所示:                                            

                         --gradio-auth 用户名:密码

                         确保将用户名:密码替换为您自己的。

Running on local URL:  http://0.0.0.0:7860

Closing server running on port: 7860
14:03:08-711169 INFO     正在加载扩展 "whisper_stt"
14:03:08-814831 INFO     正在加载扩展 "coqui_tts"
[XTTS] 正在加载XTTS...
 > tts_models/multilingual/multi-dataset/xtts_v2 is already downloaded.
 > Using model: xtts
[XTTS] 加载完毕!

Running on local URL:  http://0.0.0.0:7860

14:05:55-010932 INFO     Loading "internlm2-chat-1_8b"
14:05:55-038076 INFO     TRANSFORMERS_PARAMS=
{   'low_cpu_mem_usage': True,
    'torch_dtype': torch.float16,
    'trust_remote_code': True}

Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████| 2/2 [00:51<00:00, 25.53s/it]
14:06:49-953526 INFO     加载器:"Transformers"
14:06:49-958197 INFO     截断长度:32768
14:06:49-959196 INFO     指令模板:"Custom (obtained from model metadata)"
14:06:49-960196 INFO     在54.95秒内加载了模型。
Traceback (most recent call last):
  File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\gradio\queueing.py", line 527, in process_events
    response = await route_utils.call_process_api(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\gradio\route_utils.py", line 261, in call_process_api
    output = await app.get_blocks().process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\gradio\blocks.py", line 1786, in process_api
    result = await self.call_function(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\gradio\blocks.py", line 1338, in call_function
    prediction = await anyio.to_thread.run_sync(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\anyio\to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\anyio\_backends\_asyncio.py", line 2144, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\anyio\_backends\_asyncio.py", line 851, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\gradio\utils.py", line 759, in wrapper
    response = f(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^
  File "E:\GaoLLM\Test\TextgenCN\text-generation-webui\extensions\whisper_stt\script.py", line 48, in auto_transcribe
    transcription = do_stt(audio, whipser_model, whipser_language)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\GaoLLM\Test\TextgenCN\text-generation-webui\extensions\whisper_stt\script.py", line 36, in do_stt
    transcription = r.recognize_whisper(audio_data, language=whipser_language, model=whipser_model)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\speech_recognition\__init__.py", line 1486, in recognize_whisper
    wav_bytes = audio_data.get_wav_data(convert_rate=16000)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\speech_recognition\audio.py", line 146, in get_wav_data
    raw_data = self.get_raw_data(convert_rate, convert_width)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\speech_recognition\audio.py", line 91, in get_raw_data
    raw_data, _ = audioop.ratecv(
                  ^^^^^^^^^^^^^^^
audioop.error: not a whole number of frames
输出生成耗时3.28秒(速率为3.97 语素/秒,共13个语素,上下文长度为55,种子为1707950999)
 > Text splitted to sentences.
["I'd like to book a reservation for the evening."]
 > Processing time: 6.5040388107299805
 > Real-time factor: 1.6719601727359175
Traceback (most recent call last):
  File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\gradio\queueing.py", line 527, in process_events
    response = await route_utils.call_process_api(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\gradio\route_utils.py", line 261, in call_process_api
    output = await app.get_blocks().process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\gradio\blocks.py", line 1786, in process_api
    result = await self.call_function(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\gradio\blocks.py", line 1338, in call_function
    prediction = await anyio.to_thread.run_sync(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\anyio\to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\anyio\_backends\_asyncio.py", line 2144, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\anyio\_backends\_asyncio.py", line 851, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\gradio\utils.py", line 759, in wrapper
    response = f(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^
  File "E:\GaoLLM\Test\TextgenCN\text-generation-webui\extensions\whisper_stt\script.py", line 48, in auto_transcribe
    transcription = do_stt(audio, whipser_model, whipser_language)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\GaoLLM\Test\TextgenCN\text-generation-webui\extensions\whisper_stt\script.py", line 36, in do_stt
    transcription = r.recognize_whisper(audio_data, language=whipser_language, model=whipser_model)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\speech_recognition\__init__.py", line 1486, in recognize_whisper
    wav_bytes = audio_data.get_wav_data(convert_rate=16000)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\speech_recognition\audio.py", line 146, in get_wav_data
    raw_data = self.get_raw_data(convert_rate, convert_width)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\anaconda3\envs\TextgenCN\Lib\site-packages\speech_recognition\audio.py", line 91, in get_raw_data
    raw_data, _ = audioop.ratecv(
                  ^^^^^^^^^^^^^^^
audioop.error: not a whole number of frames

System Info

system:Windows 10 
GPU:NVIDIA Geforce RTX 3060
RAM:16G
Quidam2k commented 6 months ago

The Whisper extension's been broken for weeks. There was a pull request about it, but it doesn't look like that was included in the most recent release.

unixshaman commented 6 months ago

Same with snapshot-2024-04-21. OS: Windows 10 GPU: NVIDIA Geforce RTX 2070 Super Max-Q (8G) RAM:32G

github-actions[bot] commented 4 months ago

This issue has been closed due to inactivity for 2 months. If you believe it is still relevant, please leave a comment below. You can tag a developer in your comment.

LonnieDixon commented 4 months ago

This error is still happening to me and is still getting hits on a similar bug/ reddit thread leading me to think it has yet to be resolved in a pull request, correct me if I'm wrong, otherwise, update on the fix? Thanks!