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来跑
原文地址:https://blog.csdn.net/chenziang1/article/details/143861845
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!