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
21.02k stars 2.17k forks source link

Can't load tokenizer for 't5-base'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 't5-base' is the correct path to a directory containing all relevant files for a T5Tokenizer tokenizer. #457

Open qiuyuzhao opened 6 months ago

qiuyuzhao commented 6 months ago

to run this code :

import torchaudio from audiocraft.models import MusicGen from audiocraft.data.audio import audio_write

model = MusicGen.get_pretrained('facebook/musicgen-small') model.set_generation_params(duration=8) # generate 8 seconds. wav = model.generate_unconditional(4) # generates 4 unconditional audio samples descriptions = ['happy rock', 'energetic EDM', 'sad jazz'] wav = model.generate(descriptions) # generates 3 samples.

melody, sr = torchaudio.load('./assets/bach.mp3')

generates using the melody from the given audio and the provided descriptions.

wav = model.generate_with_chroma(descriptions, melody[None].expand(3, -1, -1), sr)

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)

Prompt error : OSError: Can't load tokenizer for 't5-base'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 't5-base' is the correct path to a directory containing all relevant files for a T5Tokenizer tokenizer.

XHB-ZMM commented 2 months ago

Excuse me, have you solved this problem? I encountered the same problem as you

qiuyuzhao commented 2 months ago

Excuse me, have you solved this problem? I encountered the same problem as you

to hugginface find the model, download to your local.

XHB-ZMM commented 2 months ago

al

Thank you very much. May I ask if you want to load a tokenizer separately, or if you want to put all the files of t5-base together with the files of musicgen

qiuyuzhao commented 2 months ago

I seem to have put the downloaded models in a separate folder

XHB-ZMM commented 2 months ago

I seem to have put the downloaded models in a separate folder

thanks,thanks

XHB-ZMM commented 2 months ago

Snipaste_2024-08-30_20-27-18 Hello, is my directory structure correct?