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.17k stars 2.01k forks source link

Using musicgen-melody model in Transformers library #413

Open ukemamaster opened 5 months ago

ukemamaster commented 5 months ago

Is it possible to use the musicgen-melody model in the Transformers library like the musicgen-small model ?

I gave it a try :

from transformers import AutoProcessor, MusicgenForConditionalGeneration

processor = AutoProcessor.from_pretrained("facebook/musicgen-melody")
model = MusicgenForConditionalGeneration.from_pretrained("facebook/musicgen-melody)

inputs = processor(
    text=["80s pop track with bassy drums and synth", "90s rock song with loud guitars and heavy drums"],
    padding=True,
    return_tensors="pt",
)

audio_values = model.generate(**inputs, max_new_tokens=256)

But it seems like the musicgen-melody model is not supported by the Transformers library, and i get the following error:

raise EnvironmentError(
OSError: facebook/musicgen-melody does not appear to have a file named config.json. 
Checkout 'https://huggingface.co/facebook/musicgen-melody/main' for available files.
xinyueli2896 commented 3 months ago

hi friend did you find out