Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: module 'gradio' has no attribute 'make_waveform' #514

Open
My12123 opened this issue Dec 6, 2024 · 2 comments
Open

AttributeError: module 'gradio' has no attribute 'make_waveform' #514

My12123 opened this issue Dec 6, 2024 · 2 comments

Comments

@My12123
Copy link

My12123 commented Dec 6, 2024

2024-12-06 11:33:10.800846: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:485] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2024-12-06 11:33:10.820199: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:8454] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
2024-12-06 11:33:10.826072: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1452] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2024-12-06 11:33:10.839991: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX512F FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-12-06 11:33:12.339628: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
False
* Running on local URL: http://127.0.0.1:7860/
INFO:httpx:HTTP Request: GET http://127.0.0.1:7860/gradio_api/startup-events "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: HEAD http://127.0.0.1:7860/ "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: GET https://api.gradio.app/pkg-version "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: GET https://api.gradio.app/v3/tunnel-request "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: GET https://cdn-media.huggingface.co/frpc-gradio-0.3/frpc_linux_amd64 "HTTP/1.1 200 OK"
* Running on public URL: https://93737663b80915891a.gradio.live/

This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from the terminal in the working directory to deploy to Hugging Face Spaces (https://huggingface.co/spaces)
loading MBD
compression_state_dict.bin: 100% 236M/236M [00:01<00:00, 214MB/s]
/usr/local/lib/python3.10/dist-packages/torch/nn/utils/weight_norm.py:30: UserWarning: torch.nn.utils.weight_norm is deprecated in favor of torch.nn.utils.parametrizations.weight_norm.
 warnings.warn("torch.nn.utils.weight_norm is deprecated in favor of torch.nn.utils.parametrizations.weight_norm.")
mbd_musicgen_32khz.th: 100% 1.65G/1.65G [00:12<00:00, 129MB/s]
Loading model facebook/musicgen-stereo-medium
state_dict.bin: 100% 3.73G/3.73G [02:31<00:00, 24.6MB/s]
INFO:audiocraft.modules.conditioners:T5 will be evaluated with autocast as float32
spiece.model: 100% 792k/792k [00:00<00:00, 31.0MB/s]
tokenizer.json: 100% 1.39M/1.39M [00:00<00:00, 31.9MB/s]
config.json: 100% 1.21k/1.21k [00:00<00:00, 8.84MB/s]
model.safetensors: 100% 892M/892M [00:04<00:00, 192MB/s]
compression_state_dict.bin: 100% 589/589 [00:00<00:00, 3.14MB/s]
INFO:root:Getting pretrained compression model from HF facebook/encodec_32khz
config.json: 100% 758/758 [00:00<00:00, 5.59MB/s]
model.safetensors: 100% 236M/236M [00:01<00:00, 195MB/s]
/usr/local/lib/python3.10/dist-packages/transformers/models/encodec/modeling_encodec.py:124: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
 self.register_buffer("padding_total", torch.tensor(kernel_size - stride, dtype=torch.int64), persistent=False)
new batch 1 ['Punk rock with loud drum and power guitar'] [None]
INFO:audiocraft.modules.codebooks_patterns:New pattern, time steps: 500, sequence steps: 504
concurrent.futures.process._RemoteTraceback: 
"""
Traceback (most recent call last):
 File "/usr/lib/python3.10/concurrent/futures/process.py", line 246, in _process_worker
 r = call_item.fn(*call_item.args, **call_item.kwargs)
 File "/content/audiocraft/demos/musicgen_app.py", line 89, in make_waveform
 out = gr.make_waveform(*args, **kwargs)
AttributeError: module 'gradio' has no attribute 'make_waveform'
"""

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

Traceback (most recent call last):
 File "/usr/local/lib/python3.10/dist-packages/gradio/queueing.py", line 624, in process_events
 response = await route_utils.call_process_api(
 File "/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py", line 323, in call_process_api
 output = await app.get_blocks().process_api(
 File "/usr/local/lib/python3.10/dist-packages/gradio/blocks.py", line 2043, in process_api
 result = await self.call_function(
 File "/usr/local/lib/python3.10/dist-packages/gradio/blocks.py", line 1590, in call_function
 prediction = await anyio.to_thread.run_sync( # type: ignore
 File "/usr/local/lib/python3.10/dist-packages/anyio/to_thread.py", line 33, in run_sync
 return await get_asynclib().run_sync_in_worker_thread(
 File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
 return await future
 File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 807, in run
 result = context.run(func, *args)
 File "/usr/local/lib/python3.10/dist-packages/gradio/utils.py", line 865, in wrapper
 response = f(*args, **kwargs)
 File "/content/audiocraft/demos/musicgen_app.py", line 221, in predict_full
 videos, wavs = _do_predictions(
 File "/content/audiocraft/demos/musicgen_app.py", line 166, in _do_predictions
 out_videos = [pending_video.result() for pending_video in pending_videos]
 File "/content/audiocraft/demos/musicgen_app.py", line 166, in <listcomp>
 out_videos = [pending_video.result() for pending_video in pending_videos]
 File "/usr/lib/python3.10/concurrent/futures/_base.py", line 451, in result
 return self.__get_result()
 File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
 raise self._exception
AttributeError: module 'gradio' has no attribute 'make_waveform'
@vladislav-vitalyevich-panin

Can confirm the same issue with the Colab demo.

@vladislav-vitalyevich-panin
Copy link

vladislav-vitalyevich-panin commented Dec 13, 2024

It appears that make_waveform was removed in Gradio 5. Downgrading Gradio version in the Colab's code fixes the issue, go to step 1 ("Execute first for installing AudioCraft") to the definition of the "install" function, and change this:

try:
        run_log_on_fail("git clone", ["git", "clone", "https://github.com/facebookresearch/audiocraft"], cwd=ac_folder.parent)
        run_log_on_fail("pip install", ["pip", "install", "-e", "."], cwd=ac_folder)
        pass

To this:

try:
        run_log_on_fail("git clone", ["git", "clone", "https://github.com/facebookresearch/audiocraft"], cwd=ac_folder.parent)
        run_log_on_fail("pip install", ["pip", "install", "-e", "."], cwd=ac_folder)
        run_log_on_fail("pip install", ["pip", "install", "gradio==4.44.1", "-e", "."], cwd=ac_folder) #Added
        pass

And relaunch. The third line fixes the gradio version to 4.44.1, which, from my short testing works well with the demo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants