本项目为基于 LLaMA-7B 经过 中文数据集增量预训练 产生的 中文大语言模型基座。
Meta 官方发布的 LLaMA 未开源权重,为了遵守相关许可,本次发布的模型为 补丁(Patch) 类型,须配合原始官方权重才可以使用。
我们提供了 补丁(Patch) 的安装脚本,在通过正规渠道获得官方权重后,可以通过以下方式安装补丁:
python tools/patch_model.py --base_model <path_or_name_to_original_model> --patch_model openlmlab/open-chinese-llama-7b-patch --base_model_format <hf_or_raw>
提示:本补丁的安装方式为原地安装,即安装后的补丁即为完整版 huggingface 版本的本模型权重,您可以使用 transformers加载模型。
为了方便快速测试模型效果,我们提供了命令行版本的 Demo,在您根据 使用须知 成功安装补丁之后,可以使用脚本启动交互式界面:
python cli_demo.py --model openlmlab/open-chinese-llama-7b-patch --devices 0 --max_length 1024 --do_sample true --top_k 40 --top_p 0.8 --temperature 0.7 --penalty 1.02
左侧为 Open-Chinese-LLaMA-7B,右侧为原版 LLaMA:
文本续写Open-Chinese-LLaMA-7B 在中英文数据集的多种任务上的表现都远超原版 LLaMA,下面给出本模型在部分数据集上的评测结果(以下指标均为 Accuracy,越大越好):
数据集 LLAMA 7B Open-Chinese-LLaMA-7B OCNLI 31.5 45.5 CHID 25.87 71.47 TNEWS 8.70 26.78 CMRC 11.89 34.48 PIQA 79.8 77.31 HumanEval 10.5 14.63 MBPP 17.7 17.2 平均值 26.57 41.05注:完整结果见 Benchmark.md。
本项目中 patch_model.py
工具生成的模型为 transformers可加载的 hf 格式。为了方便,我们同时提供了官方版本模型(raw)和 hf 的相互转换工具:
python convert_model.py --model_path <path_or_name_to_your_hf_or_raw_model> --source_format hf --target_format raw --target_path <path_you_want_to_save_the_converted_model> --raw_parallel_degree 2 --raw_parallel_devices 0,1
提示:当转换成 raw 格式的模型时,需要指定张量并行的大小和对应设备,并且只能在拥有对应数量的显卡的机器上转换。
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4