我们目前公开了以下版本的Lawyer LLaMA:
- lawyer-llama-13b-beta1.0: 以Chinese-LLaMA-13B为底座,未经过法律语料continual training,使用通用instruction和法律instruction进行SFT,配有婚姻相关法律检索模块。
我们计划公开:
- 以ChatGLM为底座训练的模型
- 经过法律语料continual training的版本
建议使用Python 3.8及以上版本。
主要依赖库如下:
transformers>= 4.28.0sentencepiece>= 0.1.97gradio
为了符合LLaMA的使用规范,我们发布的Lawyer LLaMA权重需要使用原始LLaMA权重文件进行解码(相关代码来自point-alpaca)。
-
通过官方途径获取LLaMA原始模型。
-
通过Hugging Face或者百度网盘(提取码:lwhx)获取Lawyer LLaMA权重。
-
利用原始LLaMA文件中的
7B/consolidated.00.pth文件,运行以下bash命令,使用decrypt.py对Lawyer LLaMA模型文件进行解码。
for f in "/path/to/model/pytorch_model"*".enc"; \
do if [ -f "$f" ]; then \
python3 decrypt.py "$f" "/path/to_original_llama/7B/consolidated.00.pth" "/path/to/model"; \
fi; \
done将以上命令中的/path/to/model/替换成下载后的Lawyer LLaMA所在路径。
- 从百度网盘(提取码:jxqh)下载法条检索模块,并运行其中的
python server.py启动法条检索服务,默认挂在9098端口。
python demo_cmd.py \
--checkpoint /path/to/model \
--classifier_url "http://127.0.0.1:9098/check_hunyin" \
--use_chat_mode运行以下命令启动交互网页,访问http://127.0.0.1:7863。
python demo_web.py \
--port 7863 \
--checkpoint /path/to/model \
--classifier_url "http://127.0.0.1:9098/check_hunyin"如需使用nginx反向代理访问此服务,可参考https://github.com/LeetJoe/lawyer-llama/blob/main/demo/nginx_proxy.md (Credit to @LeetJoe)