pytorch的模型load
torch.load()可以loadpth结尾的训练好的模型类似:
voicecraft_path="/llm/nankai/chenyang_space/projects/VoiceCraft/pretrained_models/giga330M.pth"
ckpt_path = voicecraft_path
ckpt = torch.load(ckpt_path, map_location=device)
model = voicecraft.VoiceCraft(ckpt["config"])
model.load_state_dict(ckpt["model"])
model.to(device)
而 model = voicecraft.VoiceCraft.from_pretrained(f"pyp1/VoiceCraft_{voicecraft_name.replace('.pth', '')}")
这种使用huggingface的from_pretrain的函数的,就需要从huggingface上下载safetensors来跑