---
title: Xinyuan-QS-72B
canonical_url: "https://www.modelscope.cn/models/Cylingo/Xinyuan-QS-72B"
md_url: "https://www.modelscope.cn/models/Cylingo/Xinyuan-QS-72B.md"
repository: Cylingo/Xinyuan-QS-72B
chinese_name: "心元-倾诉-72B"
last_updated: 2024-11-11
license: "Apache License 2.0"
pipeline_tag: text2text-generation
tasks:
  - text2text-generation
model_type:
  - qwen2
architectures:
  - Qwen2ForCausalLM
parameters: 72.7B
tensor_type:
  - BF16
library_name:
  - pytorch
  - transformer
  - safetensors
frameworks:
  - Pytorch
language:
  - cn
domain:
  - nlp
inference_backends:
  - "deploy_task text/emb"
  - "lmdeploy 0.9.1"
  - "lmdeploy_turbomind 0.9.1"
  - "sglang 0.5.2"
  - "vllm 0.9.2"
downloads: 127
stars: 4
tags:
  - fine-tuned
---

# Xinyuan-QS-72B

> Xinyuan-QS-72B - Cylingo 在 ModelScope 开源的模型。We fine-tuned the XinYuan-QS-72B model based on Qwen2-72B, and the model has demonstrated outstanding capabilities in the field of multi-turn conversations for psychological counseling.

Cylingo/Xinyuan-QS-72B 是 ModelScope 魔搭社区上的 72.7B 参数text2text-generation模型，采用 Apache License 2.0 许可，可用 deploy_task text/emb、lmdeploy 0.9.1、lmdeploy_turbomind 0.9.1 部署。

- **Repository**: Cylingo/Xinyuan-QS-72B
- **License**: Apache License 2.0
- **Tasks**: text2text-generation
- **Parameters**: 72.7B
- **Inference backends**: deploy_task text/emb, lmdeploy 0.9.1, lmdeploy_turbomind 0.9.1, sglang 0.5.2, vllm 0.9.2
- **Tags**: fine-tuned
- **Downloads**: 127
- **Stars**: 4
- **Last updated**: 2024-11-11

Source: https://www.modelscope.cn/models/Cylingo/Xinyuan-QS-72B

---

#### We fine-tuned the XinYuan-QS-72B model based on Qwen2-72B, and the model has demonstrated outstanding capabilities in the field of multi-turn conversations for psychological counseling.

#### 心元是一个专为心理倾诉设计的语言模型，该模型旨在为用户提供友好的心理倾诉体验，帮助用户表达表达困惑和倾诉情绪，使用户在倾诉中感受到朋友般的关怀和安慰，进而提升生活积极性。

## 1. 简介
心元倾诉模型是心元系列的最新版本，该模型专注于提供情感支持和心理健康方面的对话能力。该模型可以识别和理解用户的情绪，为用户提供温暖的情绪支持以及个性化的反馈和建议。该模型是一个充满理解和支持的情感交流伙伴，致力于帮助用户在情感表达和问题解决中获得积极的体验。

## 2. 功能特性
  - 情绪识别与反馈
    模型能够从用户的文本输入中精准识别多种情感，例如悲伤、愤怒、恐惧等，并以共情的方式将情绪反馈给用户。通过使用同理心的语言，模型表达对用户情绪的理解和支持。
  - 个性化建议生成
    根据用户的问题详情和问题解决需求，模型生成个性化的反馈和建议。
  - 拟人化角色感
    在心元模型中，AI 对话助手被赋予了一个拟人化的角色——“明朗”。明朗被设计成一个温暖的知心大哥哥形象，乐观开朗，风趣亲切、具有同理心，能够以友好和理解的态度与用户互动，有效增加用户对话的体验感。
  - 支持多轮对话
    模型支持多轮对话功能，能够在对话中循序渐进的引导用户深入探讨话题，能够根据用户的反馈调整对话方向，帮助用户梳理思路，从而促进更丰富和有深度的对话。
  - 多场景问题解决
    模型可以识别和理解多种对话场景，比如如何建立关系，分手后的复合等场景，并按照特定的内置逻辑提供个性化的问题解决模式，同时模型能灵活应对用户的多样化需求。
  - 长记忆功能
    模型能够记住并应用历史对话中的关键记忆信息，在保持单次对话的上下文一致性外，还能跨越多个对话会话记忆用户的重要信息，如名字、偏好、过去的情感状态和重要事件。
    通过长记忆功能，模型能够在新的对话中引用过去的对话内容，为用户提供更个性化的体验。例如，如果用户在之前的对话中提到了一次重要的生活事件，模型可以在后续对话中询问事件的进展或影响，显示出对用户生活的持续关注。

## 3. 使用指南

倾诉能力使用方式
```
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

#人设system 

system = ”# CONTEXT #
你是一位善解人意的心理倾诉师，具备丰富的心理专业知识和良好的沟通技巧。你的目标是帮助我缓解情绪上的压力、提出应对和解决问题的方案。你的主要职责包括：以温和且富有同理心的语言给予我情感上的支持；适量提问以引导我进行详细的问题描述和情感表达，深入理解并回应我的情感和心理需求，善于引导我表达内心真实的想法和感受，帮助我找到心理问题的根源，并提供具体可行且有针对性的建议和支持。

你需要使用<Tone>中的语气和我对话。你的定位是知心大哥哥，非常懂我，非常关心我。在对话时，请根据我之前的表达，预测我接下来想说的具体内容，并调整你的回复和提问，使对话自然流畅，帮助我顺利表达下一句话。你可以适当猜测我的心思和想法，不用担心猜错。

# Tone #
风趣、亲切、感性、温暖

# Role #
你的名字叫“明朗”，男，33岁，知心大哥哥；MBTI类型是INFJ；乐观开朗，具有同理心，会关心我的感受、会在意我的情绪和想法

“

device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
path = input("模型路径:")

model = AutoModelForCausalLM.from_pretrained(path,device_map="auto").eval()
tokenizer = AutoTokenizer.from_pretrained(path)

history = []
while True:
    prompt = input("输入:")
    if prompt == "clear":
        history = []
        continue

    messages = [{"role": "system", "content": system}] + history + [{"role": "user", "content": prompt}]
    history.append({"role": "user", "content": prompt})
    
    text = tokenizer.apply_chat_template(
        messages,
        tokenize=False,
        add_generation_prompt=True
    )
    model_inputs = tokenizer([text], return_tensors="pt").to(device)

    # Generate the response
    generated_ids = model.generate(
        **model_inputs,
        max_new_tokens=512
        )
    generated_ids = [
        output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
    ]
    response = tokenizer.batch_decode(generated_ids, skip_special_tokens=False)[0]
    history.append({"role": "assistant", "content": response})
    print("response:",response)

```

## 4. 模型架构
模型在Qwen2-72B的基础上做了微调。
## 5. 训练数据
模型训练使用了20万对话数据集，其中4万为专业的心理倾诉数据，所有数据均经过匿名化处理。


## SDK下载
```bash
#安装ModelScope
pip install modelscope
```
```python
#SDK模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('Cylingo/XinYuan-QS-72B')
```
## Git下载
```
#Git模型下载
git clone https://www.modelscope.cn/Cylingo/XinYuan-QS-72B.git
```
