Open adityarajsahu opened 3 months ago
I tried getting the inference using this code snippet from the MAGNeT small model ` import torchaudio from audiocraft.models import MAGNeT from audiocraft.data.audio import audio_write
model = MAGNeT.get_pretrained('facebook/magnet-small-10secs') descriptions = ['disco beat', 'energetic EDM', 'funky groove'] wav = model.generate(descriptions) # generates 3 samples.
for idx, one_wav in enumerate(wav): # Will save under {idx}.wav, with loudness normalization at -14 db LUFS. audio_write(f'{idx}', one_wav.cpu(), model.sample_rate, strategy="loudness", loudness_compressor=True) `
But, I am getting the following error
ImportError: cannot import name 'MAGNeT' from 'audiocraft.models' (/usr/local/lib/python3.10/dist-packages/audiocraft/models/__init__.py)
The MAGNeT model is present inside the audiocraft/models directory. I have no idea why it is not getting imported. How to resolve this error?
Try to install audiocraft with: python -m pip install -e . # or if you cloned the repo locally (mandatory if you want to train).
It works out for me
I tried getting the inference using this code snippet from the MAGNeT small model ` import torchaudio from audiocraft.models import MAGNeT from audiocraft.data.audio import audio_write
model = MAGNeT.get_pretrained('facebook/magnet-small-10secs') descriptions = ['disco beat', 'energetic EDM', 'funky groove'] wav = model.generate(descriptions) # generates 3 samples.
for idx, one_wav in enumerate(wav):
Will save under {idx}.wav, with loudness normalization at -14 db LUFS.
`
But, I am getting the following error
ImportError: cannot import name 'MAGNeT' from 'audiocraft.models' (/usr/local/lib/python3.10/dist-packages/audiocraft/models/__init__.py)
The MAGNeT model is present inside the audiocraft/models directory. I have no idea why it is not getting imported. How to resolve this error?