Downloads · 30 days
78
42% of all-time downloads
xuanxuanzl/BaoLuo-LawAssistant-sftglm-6b
BaoLuo-LawAssistant-sftglm-6b is a feature extraction model from xuanxuanzl. Use it when you need embeddings to search or compare text. It is set up for transformers. The card lists the license as apache-2.0.
<p align="center" 🌐 <a href="https://baoluo.dahole.com" target="blank"WEB</a • 💻 <a href="https://github.com/xuanxuanzl/BaoLuo-LawAssistant" target="blank"宝锣法律助理V1.0</a </p
Downloads · 30 days
78
42% of all-time downloads
All-time downloads
186
Public
Repo size
942 MB
Likes
1
Public
Click a slice to open those files.
.pt470 MB · 66%
From the Hugging Face model README
宝锣法律大模型 是一个基于Encoder-Decoder开源的中文法律对话语言模型,使用开源法律领域的数据进行精调,能够提供法律法规检索、法律咨询、案情分析、罪名预测等服务。基于 General Language Model (GLM) 架构,对chatglm进行了微调,用户可以在消费级的显卡上进行本地部署。 本项目不支持商用,可做研究使用。
pip install protobuf==3.20.0 transformers>=4.27.1 icetk cpm_kernels torch==2.0.1
可以通过如下代码调用 BaoLuo-LawAssistant-sftglm-6b 模型来生成对话:
>>> from transformers import AutoTokenizer, AutoModel, AutoConfig
>>> tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True)
>>> config = AutoConfig.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True, pre_seq_len=256)
>>> model = AutoModel.from_pretrained("THUDM/chatglm-6b", config=config, trust_remote_code=True).half().cuda()
>>> model = model.quantize(bits=8, kernel_file="xuanxuanzl/BaoLuo-LawAssistant-sftglm-6b/quantization_kernels.so")
>>> prefix_state_dict = torch.load(os.path.join("xuanxuanzl/BaoLuo-LawAssistant-sftglm-6b", "pytorch_model.bin"))
>>> new_prefix_state_dict = {}
>>> for k, v in prefix_state_dict.items():
>>> if k.startswith("transformer.prefix_encoder."):
>>> new_prefix_state_dict[k[len("transformer.prefix_encoder."):]] = v
>>> model.transformer.prefix_encoder.load_state_dict(new_prefix_state_dict)
>>> model.transformer.prefix_encoder.float()
>>> model = model.eval()
>>> response, history = model.chat(tokenizer, "你好", history=[])
>>> print(response)
本仓库的代码依照 Apache-2.0 协议开源,ChatGLM-6B 模型的权重的使用则需要遵循 Model License。