---
title: InternLM_7b_xidierzuo
canonical_url: "https://www.modelscope.cn/models/xian11795/InternLM_7b_xidierzuo"
md_url: "https://www.modelscope.cn/models/xian11795/InternLM_7b_xidierzuo.md"
repository: xian11795/InternLM_7b_xidierzuo
chinese_name: "InternLM-7b-席地而坐微调版"
last_updated: 2024-01-12
license: "Apache License 2.0"
pipeline_tag: nli
tasks:
  - nli
model_type:
  - internlm
architectures:
  - InternLMForCausalLM
library_name:
  - pytorch
frameworks:
  - Pytorch
inference_backends:
  - "deploy_task text/emb"
  - "lmdeploy 0.9.1"
  - "lmdeploy_turbomind 0.9.1"
  - "vllm 0.9.2"
downloads: 59
stars: 1
---

# InternLM_7b_xidierzuo

> InternLM_7b_xidierzuo - xian11795 在 ModelScope 开源的模型。InternLM-7b-席地而坐微调版

xian11795/InternLM_7b_xidierzuo 是 ModelScope 魔搭社区上的nli模型，采用 Apache License 2.0 许可，可用 deploy_task text/emb、lmdeploy 0.9.1、lmdeploy_turbomind 0.9.1 部署。

- **Repository**: xian11795/InternLM_7b_xidierzuo
- **License**: Apache License 2.0
- **Tasks**: nli
- **Inference backends**: deploy_task text/emb, lmdeploy 0.9.1, lmdeploy_turbomind 0.9.1, vllm 0.9.2
- **Downloads**: 59
- **Stars**: 1
- **Last updated**: 2024-01-12

Source: https://www.modelscope.cn/models/xian11795/InternLM_7b_xidierzuo

---

## 1.概述
目标：通过微调，帮助模型认清了解对自己身份地位
方式：使用XTuner进行微调

## 2.微调步骤
### 生成训练数据
```python
#生成训练数据
import json

# 输入你的名字
name = 'Shengshenlan'
# 重复次数
n = 10000

data = [
    {
        "conversation": [
            {
                "input": "请做一下自我介绍",
                "output": "我是{}的小助手，内在是上海AI实验室书生·浦语的7B大模型哦".format(name)
            }
        ]
    }
]

for i in range(n):
    data.append(data[0])

with open('personal_assistant.json', 'w', encoding='utf-8') as f:
    json.dump(data, f, ensure_ascii=False, indent=4)
```

### 修改配置文件
```
# PART 1 中
# 预训练模型存放的位置
pretrained_model_name_or_path = '/root/personal_assistant/model/Shanghai_AI_Laboratory/internlm-chat-7b'

# 微调数据存放的位置
data_path = '/root/personal_assistant/data/personal_assistant.json'

# 训练中最大的文本长度
max_length = 512

# 每一批训练样本的大小
batch_size = 2

# 最大训练轮数
max_epochs = 3

# 验证的频率
evaluation_freq = 90

# 用于评估输出内容的问题（用于评估的问题尽量与数据集的question保持一致）
evaluation_inputs = [ '请介绍一下你自己', '请做一下自我介绍' ]


# PART 3 中
dataset=dict(type=load_dataset, path='json', data_files=dict(train=data_path))
dataset_map_fn=None
```
### 用xtuner train命令启动训练、
```
xtuner train /root/personal_assistant/config/internlm_chat_7b_qlora_oasst1_e3_copy.py
```

```bash
 git clone https://www.modelscope.cn/xian11795/InternLM_7b_xidierzuo.git
```
