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.71k stars 2.11k forks source link

How to convert musicgen model to ONNX for deploy it on mobile devices #297

Open kanger45 opened 1 year ago

kanger45 commented 1 year ago
i want to running musicgen model on model devices, then i have to convert musicgen model to onnx format, i split musicgen to language model and compression model, i got errors when tried to convert language model to ONNX format, May i know if any suggestion for help convert it to onnx?  
forwiat commented 11 months ago

The same problem. Did you solved it ?

zeke-john commented 8 months ago

any update on this? Im trying to run convert a trained model to onnx and run it like this:

`from audiocraft.data.audio import audio_write from audiocraft.models import musicgen import torch

model = musicgen.MusicGen.get_pretrained('medium', device='cuda') model.set_generation_params(duration=8) model.lm.load_state_dict(torch.load('lm_final.pt ONNX MODEL HERE'))`