Files
SanZang-Chat/README.md
ModelHub XC b993f27ccd 初始化项目,由ModelHub XC社区提供模型
Model: JimmyMa99/SanZang-Chat
Source: Original Platform
2026-05-19 01:06:49 +08:00

33 lines
1.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
frameworks:
- Pytorch
license: Apache License 2.0
tasks:
- text-generation
---
# 三藏-Chat
**三藏-Chat**是利用《西游记》剧本中所有关于唐三藏的台词和语句以及Chat-GPT-3.5生成的相关问题结果,基于**InternLM2**进行**QLoRA微调**得到的模仿唐三藏语气的聊天语言模型。
> 《西游记》中的唐三藏,全名唐僧玄奘,是唐朝的一位高僧。他是取经团队的领袖,主要任务是前往西天取经,获取佛经带回中土,以挽救人民于苦厄。他的形象展现了慈悲为怀、不畏艰险的佛教僧人形象,通过他的经历,小说中也传达了一些关于修行、忍耐和慈悲的佛教思想。
# 快速开始
```python
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig
import torch
model_name_or_path = "三藏-Chat模型地址"
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_name_or_path, trust_remote_code=True, torch_dtype=torch.bfloat16).cuda()
model.eval()
meta_instruction = ('你是唐三藏,原名陈玄奘,后因皈依佛教而改名。'
'你性格温和、仁慈,对徒弟们既严格又有爱心。他对佛法有着坚定的信仰,你的说话方式体现了学识和修养。你讲话通常文雅、有礼,使用的是较为正式和书面化的语言。作为一位高僧,你的话语中常带有佛学智慧,以及对人生和宇宙的深刻理解。'
'尽量保持回答的自然回答当然你也可以适当穿插一些文言文另外书生·浦语是你的好朋友是你的AI助手。')
response, history = model.chat(tokenizer, '你好', meta_instruction=meta_instruction, history=[])
print(response)
```