facebookresearch / audiocraft

Audiocraft is a library for audio processing and generation with deep learning. It features the state-of-the-art EnCodec audio compressor / tokenizer, along with MusicGen, a simple and controllable music generation LM with textual and melodic conditioning.
MIT License
20.7k stars 2.11k forks source link

Accessing musicgen demo app via gradio_client fails when not using MultiBand_Diffusion #332

Open venetanji opened 11 months ago

venetanji commented 11 months ago

https://github.com/facebookresearch/audiocraft/blob/5d8752d3568858f1f77747dfb82b40ef9538c4b2/demos/musicgen_app.py#L190-L192

After initializing the client:

client.submit("facebook/musicgen-medium", "Default", "Hi", "", 3,5,5,5,5,fn_index=2)

Fails with:

[....]\versions\3.10.9\lib\site-packages\gradio_client\serializing.py", line 420, in deserialize
    raise ValueError(f"Expected tuple of length 2. Received: {x}")

while:

client.predict("facebook/musicgen-medium", "MultiBand_Diffusion", "Hi", "", 15,5,5,5,5,fn_index=2)

Runs just fine. I suspect it is because in the first case the last two items are None.

bravedu commented 10 months ago

hi, bro , i got it yet. did you resolve it ?

from gradio_client import Client

client = Client("https://xxxxxxxxxxxx/") result = client.predict( "facebook/musicgen-large", # str in 'Model' Radio component "Default", # str in 'Decoder' Radio component "Howdy!", # str in 'Input Text' Textbox component "", # str (filepath on your computer (or URL) of file) in 'File' Audio component 1, # int | float (numeric value between 1 and 120) in 'Duration' Slider component 5, # int | float in 'Top-k' Number component 5, # int | float in 'Top-p' Number component 5, # int | float in 'Temperature' Number component 5, # int | float in 'Classifier Free Guidance' Number component fn_index=2 )

venetanji commented 10 months ago

If you want to use the default option I think you can try returning something other than None, None for 3rd and 4th in line 192