Closed jiafuz closed 10 months ago
Having the same problem. I can not load local models with translater function either. It always throw a ValueError like name
must be a valid filename when I include slash in the string.
Having the same problem, the model pt file is over 10GB, and there is no demo about how to launch with local pt file
Check my comment
How to use local checkpoint for inference? #99
see the topic closed #99
@jiafuz
After downloading all the files, you should load model and vocoder retrieve_card and save them in the desired path:
import fairseq2, joblib
model_retrieve_card = fairseq2.assets.asset_store.retrieve_card('seamlessM4T_large') vocoder_retrieve_card = fairseq2.assets.asset_store.retrieve_card('vocoder_36langs') joblib.dump(model_retrieve_card, 'seamlessM4T_large_retrieve_card.pkl') joblib.dump(vocoder_retrieve_card, 'vocoder_36langs_retrieve_card.pkl')
Then do this to load the model and vocoder locally:
from seamless_communication.inference import Translator
model_retrieve_card = joblib.load('./seamlessM4T_large_retrieve_card.pkl') model_retrieve_card.metadata['checkpoint'] = './pretrained_models/seamless-m4t-large/multitask_unity_large.pt'
vocoder_retrieve_card = joblib.load('./vocoder_36langs_retrieve_card.pkl') vocoder_retrieve_card.metadata['checkpoint'] = './pretrained_models/vocoder/vocoder_36langs.pt'
translator = Translator(model_name_or_card=model_retrieve_card, vocoder_name_or_card=vocoder_retrieve_card, device=torch.device('cuda:0'), dtype=None)
已收到!
After downloading all the files listed in the Files and versions? How to load them locally? When passing the folder name, I got the error:
ValueError: name must be a valid filename, but is './pretrained_models/seamless-m4t-large' instead.
The code I used are:
model_path = './pretrained_models/seamless-m4t-large' vocoder_path = './pretrained_models/vocoder' translator = Translator(model_name_or_card=model_path, vocoder_name_or_card=vocoder_path, device=torch.device('cuda:0'), dtype=None)
I also tried the following code, but no luck: model_path = './pretrained_models/seamless-m4t-large/multitask_unity_large.pt' vocoder_path = './pretrained_models/vocoder/vocoder_36langs.pt' translator = Translator(model_name_or_card=model_path, vocoder_name_or_card=vocoder_path, device=torch.device('cuda:0'), dtype=None)