---
title: wisdomInterrogatory
canonical_url: "https://www.modelscope.cn/models/wisdomOcean/wisdomInterrogatory"
md_url: "https://www.modelscope.cn/models/wisdomOcean/wisdomInterrogatory.md"
repository: wisdomOcean/wisdomInterrogatory
chinese_name: "智海-录问"
last_updated: 2023-10-27
license: other
pipeline_tag: text-generation
tasks:
  - text-generation
model_type:
  - baichuan
architectures:
  - BaiChuanForCausalLM
library_name:
  - pytorch
frameworks:
  - pytorch
language:
  - en
  - zh
inference_backends:
  - "deploy_task text/emb"
  - "lmdeploy 0.9.1"
  - "lmdeploy_turbomind 0.9.1"
  - "vllm 0.9.2"
downloads: 10398
stars: 41
---

# wisdomInterrogatory

> wisdomInterrogatory - wisdomOcean 在 ModelScope 开源的模型。智海-录问(wisdomInterrogatory)是由浙江大学、阿里巴巴达摩院以及华院计算三家单位共同设计研发的法律大模型。核心思想：以“普法共享和司法效能提升”为目标，从推动法律智能化体系入司法实践、数字化案例建设、虚拟法律咨询服务赋能等方面提供支持，形成数字化和智能化的司法基座能力。

wisdomOcean/wisdomInterrogatory 是 ModelScope 魔搭社区上的text-generation模型，采用 other 许可，可用 deploy_task text/emb、lmdeploy 0.9.1、lmdeploy_turbomind 0.9.1 部署。

- **Repository**: wisdomOcean/wisdomInterrogatory
- **License**: other
- **Tasks**: text-generation
- **Inference backends**: deploy_task text/emb, lmdeploy 0.9.1, lmdeploy_turbomind 0.9.1, vllm 0.9.2
- **Downloads**: 10398
- **Stars**: 41
- **Last updated**: 2023-10-27

Source: https://www.modelscope.cn/models/wisdomOcean/wisdomInterrogatory

---

# 智海-录问

## 项目背景
智海-录问(wisdomInterrogatory)是由浙江大学、阿里巴巴达摩院以及华院计算三家单位共同设计研发的法律大模型。核心思想：以“普法共享和司法效能提升”为目标，从推动法律智能化体系入司法实践、数字化案例建设、虚拟法律咨询服务赋能等方面提供支持，形成数字化和智能化的司法基座能力。

## 模型训练

我们的模型基座是[Baichuan-7B](https://github.com/baichuan-inc/baichuan-7B)，在此基础上，进行了二次预训练以及指令微调训练。

### 二次预训练

二次预训练的目的是给通用的大模型注入法律领域的知识。预训练的数据包括法律文书、司法案例以及法律问答数据，共40G。

### 指令微调训练

经过了二次预训练之后，在指令微调阶段，我们使用了100k的指微调训练，其目的是让大模型具备问答的能力，能够直接与用户进行交流。



## 推理代码

#### 推理环境安装
```shell
transformers<4.34
accelerate>=0.20.1
torch>=2.0.1
modelscope>=1.8.3
sentencepiece==0.1.99
```

#### 推理代码调用
```python
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
from modelscope import AutoModelForCausalLM, AutoTokenizer, snapshot_download
import torch


model_id = "wisdomOcean/wisdomInterrogatory"
revision = 'v1.0.0'
model_dir = snapshot_download(model_id, revision)

def generate_response(prompt: str) -> str:
    inputs = tokenizer(f'</s>Human:{prompt} </s>Assistant: ', return_tensors='pt')
    inputs = inputs.to('cuda')
    pred = model.generate(**inputs, max_new_tokens=800, 
                          repetition_penalty=1.2)
    response = tokenizer.decode(pred.cpu()[0], skip_special_tokens=True)
    return response.split("Assistant: ")[1]

tokenizer = AutoTokenizer.from_pretrained(model_dir, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_dir, device_map="auto", 
                                             torch_dtype=torch.float16,
                                             trust_remote_code=True)
prompt = "如果喝了两斤白酒后开车，会有什么后果？"
resp = generate_response(prompt)
print(resp)
```

## 免责声明

本模型仅供学术研究之目的而提供，不保证结果的准确性、完整性或适用性。在使用模型生成的内容时，您应自行判断其适用性，并自担风险。
