CTranslate2 支持白川2?

kuhbmx9i  于 2个月前  发布在  其他
关注(0)|答案(7)|浏览(42)

Baichuan2 是一个类似于llama的生成模型,我发现了以下两个不同点:

    1. qkv合并为W_pack,所以我修改了文件/ctranslate2/converters/transformers.py

    1. rotary更改为alibi,所以我修改了文件/ctranslate2/converters/transformers.py

但是我发现转换只适用于简单的句子,复杂的句子无法正常工作。你能帮助我吗?或者有计划支持Baichuan2吗?

3hvapo4f

3hvapo4f1#

Baichuan2-13b与baichuan1在位置嵌入的证人位置上有所不同,并且它对lm_head权重进行了归一化。因此,您可能需要像他们在github页面上提到的那样对'lm_head.weight'进行归一化:
https://github.com/baichuan-inc/Baichuan2#关于baichuan-1的说明文档和位置编码器的区别-baichuan-2

syqv5f0l

syqv5f0l2#

感谢您的帮助。我已成功转换它。

5fjcxozz

5fjcxozz3#

@lx0126z
你好,对这个baichuan2进行加速后,具体的流程是什么?转换这个链接:https://github.com/baichuan-inc/Baichuan2#%E5%AF%B9-baichuan-1-%E7%9A%84%E6%8E%A8%E7%90%86%E4%BC%98%E5%8C%96%E8%BF%81%E7%A7%BB%E5%88%B0-baichuan-2后,还需要修改哪些代码才能完成加速呢?我想用baichun2官方的github代码进行加速,如何修改代码呢?小白一个,感谢指导

70gysomp

70gysomp4#

你好,要对baichuan2进行加速,具体的流程是什么?在转换这个链接:https://github.com/baichuan-inc/Baichuan2#%E5%AF%B9-baichuan-1-%E7%9A%84%E6%8E%A8%E7%90%86%E4%BC%98%E5%8C%96%E8%BF%81%E7%A7%BB%E5%88%B0-baichuan-2后,还需要修改哪些代码才能完成加速呢?我想用baichun2官方的github代码进行加速,如何修改代码呢?小白一个,感谢指导。

需要找到你的安装ct2路径,例如:/path/to/ctranslate2/converters/transformers.py,在这个文件中修改。

gajydyqb

gajydyqb5#

@lx0126z
你好,这个大概加速多少倍?

vddsk6oq

vddsk6oq6#

你能为这个问题创建一个拉取请求吗?

pn9klfpd

pn9klfpd7#

@lx0126z 请问修改文件后如何将百川2转成 ct2的模型? 我用 ct2-transformers-converter --model Baichuan2-13B-Chat-4bits/ --output_dir Baichuan2-13B-Chat-4bits/ct2_model --force --trust_remote_code 后报错显示 No conversion is registered for the model configuration BaichuanConfig (supported configurations are: BartConfig, BertConfig ...

相关问题