jhj0517 / Whisper-WebUI

A Web UI for easy subtitle using whisper model.
Apache License 2.0
1.43k stars 201 forks source link

Can't run T2T Translation #80

Closed ShadF0x closed 10 months ago

ShadF0x commented 10 months ago

Which OS are you using?

Wanted to tinker with T2T Translation to see what it's capable off, but upon loading any NLLB model, the process errors out with this output in the console:

Traceback (most recent call last):
  File "I:\Whisper-WebUI\venv\lib\site-packages\gradio\queueing.py", line 495, in call_prediction
    output = await route_utils.call_process_api(
  File "I:\Whisper-WebUI\venv\lib\site-packages\gradio\route_utils.py", line 232, in call_process_api
    output = await app.get_blocks().process_api(
  File "I:\Whisper-WebUI\venv\lib\site-packages\gradio\blocks.py", line 1570, in process_api
    data = self.postprocess_data(fn_index, result["prediction"], state)
  File "I:\Whisper-WebUI\venv\lib\site-packages\gradio\blocks.py", line 1397, in postprocess_data
    self.validate_outputs(fn_index, predictions)  # type: ignore
  File "I:\Whisper-WebUI\venv\lib\site-packages\gradio\blocks.py", line 1371, in validate_outputs
    raise ValueError(
ValueError: An event handler (translate_file) didn't receive enough output values (needed: 2, received: 1).
Wanted outputs:
    [textbox, file]
Received outputs:
    [None]
jhj0517 commented 10 months ago

Hi @ShadF0x, thanks for reporting this. This should now be fixed in #81, please let me know if the problem persists!

ShadF0x commented 10 months ago

Yep, works fine now.

mciszczon commented 4 weeks ago

I stumbled upon a similar issue today, though the stack trace is different, the exact exception seems to be the same:

app-1  | Error: 'NoneType' object has no attribute 'endswith'
app-1  | Traceback (most recent call last):
app-1  |   File "/Whisper-WebUI/venv/lib/python3.11/site-packages/gradio/queueing.py", line 624, in process_events
app-1  |     response = await route_utils.call_process_api(
app-1  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app-1  |   File "/Whisper-WebUI/venv/lib/python3.11/site-packages/gradio/route_utils.py", line 323, in call_process_api
app-1  |     output = await app.get_blocks().process_api(
app-1  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app-1  |   File "/Whisper-WebUI/venv/lib/python3.11/site-packages/gradio/blocks.py", line 2028, in process_api
app-1  |     data = await self.postprocess_data(block_fn, result["prediction"], state)
app-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app-1  |   File "/Whisper-WebUI/venv/lib/python3.11/site-packages/gradio/blocks.py", line 1784, in postprocess_data
app-1  |     self.validate_outputs(block_fn, predictions)  # type: ignore
app-1  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app-1  |   File "/Whisper-WebUI/venv/lib/python3.11/site-packages/gradio/blocks.py", line 1739, in validate_outputs
app-1  |     raise ValueError(
app-1  | ValueError: A  function (translate_file) didn't return enough output values (needed: 2, returned: 1).
app-1  |     Output components:
app-1  |         [textbox, file]
app-1  |     Output values returned:
app-1  |         [None]
jhj0517 commented 4 weeks ago

@mciszczon I just tried to reproduce, it worked fine with latest version.

Can you try with the latest version?

mciszczon commented 4 weeks ago

@mciszczon I just tried to reproduce, it worked fine with latest version.

Can you try with the latest version?

Duh, I was indeed a few commits behind, but after pulling in changes and rebuilding the image just to be sure, the problem still remains.

I am on an M2 Macbook Air and running the app through Docker Compose.

jhj0517 commented 4 weeks ago

Hmm. Can you paste the stack trace again? is the error message the same?

Error: 'NoneType' object has no attribute 'endswith'

This is weird because the only place I used endswith is just one line out of the whole project, and it's nothing to do with the translation.

mciszczon commented 4 weeks ago

Unfortunately that's the entire stack that I see from the container log, literally it:

$ dc logs -f --tail 200

app-1  | Use "faster-whisper" implementation
app-1  | Device "auto" is detected
app-1  | * Running on local URL:  http://0.0.0.0:7860
app-1  |
app-1  | To create a public link, set `share=True` in `launch()`.
app-1  |
app-1  | Initializing NLLB Model..
app-1  |
app-1  | Error: 'NoneType' object has no attribute 'endswith'
app-1  | Traceback (most recent call last):
app-1  |   File "/Whisper-WebUI/venv/lib/python3.11/site-packages/gradio/queueing.py", line 624, in process_events
app-1  |     response = await route_utils.call_process_api(
app-1  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app-1  |   File "/Whisper-WebUI/venv/lib/python3.11/site-packages/gradio/route_utils.py", line 323, in call_process_api
app-1  |     output = await app.get_blocks().process_api(
app-1  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app-1  |   File "/Whisper-WebUI/venv/lib/python3.11/site-packages/gradio/blocks.py", line 2028, in process_api
app-1  |     data = await self.postprocess_data(block_fn, result["prediction"], state)
app-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app-1  |   File "/Whisper-WebUI/venv/lib/python3.11/site-packages/gradio/blocks.py", line 1784, in postprocess_data
app-1  |     self.validate_outputs(block_fn, predictions)  # type: ignore
app-1  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app-1  |   File "/Whisper-WebUI/venv/lib/python3.11/site-packages/gradio/blocks.py", line 1739, in validate_outputs
app-1  |     raise ValueError(
app-1  | ValueError: A  function (translate_file) didn't return enough output values (needed: 2, returned: 1).
app-1  |     Output components:
app-1  |         [textbox, file]
app-1  |     Output values returned:
app-1  |         [None]

Any possibility that it's actually a bug in gradio itself? See that the stack trace doesn't even contain anything from your code base, it starts and ends entirely in site-packages.

jhj0517 commented 4 weeks ago

I couldn't reproduce it.

I'm sorry but what I can say is just remove the image completely (even the builds, since there have been changes in the requirements.txt) and rebuild the image from scratch.

This will take some time.

Or if it still fails, you can try the pinokio, since this WebUI is registered in there.