resemble-ai / resemble-enhance

AI powered speech denoising and enhancement
https://huggingface.co/spaces/ResembleAI/resemble-enhance
MIT License
1.09k stars 103 forks source link

Web Application throws Errors on Submit #13

Closed liferadioat closed 6 months ago

liferadioat commented 6 months ago

Hi,

I am running the Web App (app.yml) and whenever I´ve uploaded a file and click on submit I can see the following output at the webserver:

Traceback (most recent call last):
  File "/opt/resemble-enhance/.venv/lib/python3.11/site-packages/gradio/queueing.py", line 456, in call_prediction
    output = await route_utils.call_process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/resemble-enhance/.venv/lib/python3.11/site-packages/gradio/route_utils.py", line 232, in call_process_api
    output = await app.get_blocks().process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/resemble-enhance/.venv/lib/python3.11/site-packages/gradio/blocks.py", line 1522, in process_api
    result = await self.call_function(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/resemble-enhance/.venv/lib/python3.11/site-packages/gradio/blocks.py", line 1144, in call_function
    prediction = await anyio.to_thread.run_sync(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/resemble-enhance/.venv/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/resemble-enhance/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2134, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "/opt/resemble-enhance/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 851, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/resemble-enhance/.venv/lib/python3.11/site-packages/gradio/utils.py", line 674, in wrapper
    response = f(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^
  File "/opt/resemble-enhance/app.py", line 24, in _fn
    wav1, new_sr = denoise(dwav, sr, device)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/resemble-enhance/.venv/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/resemble-enhance/resemble_enhance/enhancer/inference.py", line 29, in denoise
    enhancer = load_enhancer(run_dir, device)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/resemble-enhance/resemble_enhance/enhancer/inference.py", line 16, in load_enhancer
    run_dir = download()
              ^^^^^^^^^^
  File "/opt/resemble-enhance/resemble_enhance/enhancer/download.py", line 40, in download
    run_command(["git", "-C", str(REPO_DIR), "lfs", "pull"], "Failed to pull latest changes, please try again.")
  File "/opt/resemble-enhance/resemble_enhance/enhancer/download.py", line 17, in run_command
    raise RuntimeError(msg) from e
RuntimeError: Failed to pull latest changes, please try again.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/resemble-enhance/.venv/lib/python3.11/site-packages/gradio/queueing.py", line 501, in process_events
    response = await self.call_prediction(awake_events, batch)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/resemble-enhance/.venv/lib/python3.11/site-packages/gradio/queueing.py", line 465, in call_prediction
    raise Exception(str(error) if show_error else None) from error
Exception: None

How can I solve this? Thanks in advance.

enhuiz commented 6 months ago

It seems git-lfs is missing, you may install it here. related #10

You may also update to the latest version: pip install resemble-enhance --upgrade --pre, which no longer uses git-lfs.

liferadioat commented 6 months ago

Thanks, I´ve upgraded to the pre version, but there is a new error:

Traceback (most recent call last):
  File "/opt/resemble-enhance/.venv/lib/python3.11/site-packages/gradio/queueing.py", line 456, in call_prediction
    output = await route_utils.call_process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/resemble-enhance/.venv/lib/python3.11/site-packages/gradio/route_utils.py", line 232, in call_process_api
    output = await app.get_blocks().process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/resemble-enhance/.venv/lib/python3.11/site-packages/gradio/blocks.py", line 1522, in process_api
    result = await self.call_function(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/resemble-enhance/.venv/lib/python3.11/site-packages/gradio/blocks.py", line 1144, in call_function
    prediction = await anyio.to_thread.run_sync(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/resemble-enhance/.venv/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/resemble-enhance/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2134, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "/opt/resemble-enhance/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 851, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/resemble-enhance/.venv/lib/python3.11/site-packages/gradio/utils.py", line 674, in wrapper
    response = f(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^
  File "/opt/resemble-enhance/app.py", line 24, in _fn
    wav1, new_sr = denoise(dwav, sr, device)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/resemble-enhance/.venv/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/resemble-enhance/resemble_enhance/enhancer/inference.py", line 29, in denoise
    enhancer = load_enhancer(run_dir, device)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/resemble-enhance/resemble_enhance/enhancer/inference.py", line 16, in load_enhancer
    run_dir = download()
              ^^^^^^^^^^
  File "/opt/resemble-enhance/resemble_enhance/enhancer/download.py", line 40, in download
    run_command(["git", "-C", str(REPO_DIR), "lfs", "pull"], "Failed to pull latest changes, please try again.")
  File "/opt/resemble-enhance/resemble_enhance/enhancer/download.py", line 17, in run_command
    raise RuntimeError(msg) from e
RuntimeError: Failed to pull latest changes, please try again.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/resemble-enhance/.venv/lib/python3.11/site-packages/gradio/queueing.py", line 501, in process_events
    response = await self.call_prediction(awake_events, batch)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/resemble-enhance/.venv/lib/python3.11/site-packages/gradio/queueing.py", line 465, in call_prediction
    raise Exception(str(error) if show_error else None) from error
Exception: None
enhuiz commented 6 months ago

what's the output of pip show resemble-enhance?

liferadioat commented 6 months ago

This is the output:

Name: resemble-enhance Version: 0.0.2.dev240104122303 Summary: Speech denoising and enhancement with deep learning Home-page: https://github.com/resemble-ai/resemble-enhance Author: Resemble AI Author-email: team@resemble.ai License: Location: /opt/resemble-enhance/.venv/lib/python3.11/site-packages Requires: celluloid, deepspeed, gradio, librosa, matplotlib, numpy, omegaconf, pandas, ptflops, resampy, rich, scipy, soundfile, tabulate, torch, torchaudio, torchvision, tqdm Required-by: currently I am installing the app like python3 -m pip install resemble-enhance --upgrade --pre and I am starting the web app like python3 app.py. Can the missing .venv cause this problem?

enhuiz commented 6 months ago

oic, you are running under the repo folder and it uses the old code (not the one newly installed with pip). you can try to git pull the latest version, or go to another folder.

liferadioat commented 6 months ago

Sorry, it´s not clear for me already. I´ve used git pull now and restarted the webserver, but it´s throwing the same error. How can I run the app in a different folder after git pull?

But it processes now for about 3 seconds, before the error is thrown.

I´ve tried different scenarios now:

Also I am running the latest git with all code updates. Is there any other installation requirement, which is missing at the readme? Specific folders, which should be created with chmod right XY?

liferadioat commented 6 months ago

OK, I solved it by my own. When running this application with venv you need to copy the app.py to e.g. .venv/bin/ and then start it here. Works!