对于LLama-2-70b、Bloom等模型,可能会经常遇到的问题是:如何将model.bin分割成多个子文件?
例如,在PyTorch中,状态字典会被分割。
model.bin = model-00001-of-00002.bin + model-00002-of-00002.bin
在我的具体情况下,即使LLama-70b的转换尚未实现,因为它们的注意力机制发生了变化,但在int8之后的转换大小约为65GB-70GB。由于这个较大的文件大小,许多服务(如Cloudflare、Huggingface)拒绝将模型作为单个文件上传。
这也将提高网络上的并行化/下载速度,例如,在Huggingface的Transformers库中,小于50GB的模型也会被分割成9GB的部分。
2条答案
按热度按时间wlp8pajw1#
顺便问一下,你是否成功地使用转换CT2脚本将较小的Llama2模型进行了转换?
编辑:在已关闭的问题中找到了讨论:#1351
roqulrg32#
同时,我认为你可以在CTranslate2之外完成这个操作。
在上传之前,将
model.bin
分成多个部分,例如:下载后,从多个部分重建
model.bin
。你可以使用Python来实现这个功能,例如:我没有测试过这段代码,但你应该能理解这个想法。