--- license: apache-2.0 language: - zh pipeline_tag: text-generation --- 1. 获取Chinese-LLaMA-Alpaca的基座模型 - 首先,获得[Chinese-LLaMA-Alpaca的GitHub页面](https://github.com/ymcui/Chinese-LLaMA-Alpaca)上的基座模型。 - 我们的GuwenLLAMA基于Chinese-Alpaca-Pro-1python scripts/merge_llama_with_chinese_lora.py --base_model Chinese-Alpaca-Pro-13B --lora_model lora_from_this_page --output_type huggingface --output_dir path_to_output_dir3B进行了微调,以下是具体的获取方法: 1. 获取原生的13B LLaMA模型,由于版权原因,我们这里不提供下载链接。 2. 在[Chinese-LLaMA-Alpaca项目的推荐模型下载部分](https://github.com/ymcui/Chinese-LLaMA-Alpaca)中,选择下载`Chinese-LLaMA-Plus-13B`和`Chinese-Alpaca-Pro-13B`这两个模型。 3. 在[Chinese-LLaMA-Alpaca项目的合并模型部分](https://github.com/ymcui/Chinese-LLaMA-Alpaca/wiki/%E6%89%8B%E5%8A%A8%E6%A8%A1%E5%9E%8B%E5%90%88%E5%B9%B6%E4%B8%8E%E8%BD%AC%E6%8D%A2), 将刚才下载的原生LLaMA-13B、Chinese-LLaMA-Plus-13B和Chinese-Alpaca-Pro-13B这三个模型进行合并。合并方法请参考上述链接。 a. 将原版LLaMA模型转换为Hugging Face (HF)格式(如果您下载的原生LLaMA-13B不是HF格式)。 b. 合并LoRA权重,生成全量模型权重,这里同样需要合并成HF格式。 ``` python scripts/merge_llama_with_chinese_lora.py \ --base_model 原生LLaMA-13B \ --lora_model Chinese-LLaMA-Plus-13B , Chinese-Alpaca-Pro-13B \ --output_type huggingface \ --output_dir path_to_output_dir ``` 2. 通过上述步骤,您已经获得了Chinese-Alpaca-Pro-13B模型,这就是我们任务所使用的基座模型。 3. 接下来,需要将GuwenLLAMA的LoRA模型与Chinese-Alpaca-Pro-13B合并。 ``` python scripts/merge_llama_with_chinese_lora.py --base_model Chinese-Alpaca-Pro-13B --lora_model lora_from_this_page --output_type huggingface --output_dir path_to_output_dir ``` 通过这一步,您就获得了可使用的GuwenLLAMA模型。 4. 现在,您可以开始使用GuwenLLAMA进行推理。有关推理方法,请参考项目的相关描述:[GuwenLLAMA GitHub页面](https://github.com/TianRuiHe/GuwenLLAMA)