--- language: - zh - en tags: - deepseek - chinese - chat - roleplay license: apache-2.0 --- # 甄嬛 AI 助手模型 这是一个基于 DeepSeek-7B-Chat 模型微调的甄嬛主题聊天助手。模型具有以下特点: ## 功能特点 1. 完美模拟甄嬛的语言风格和性格特征 2. 支持中文对话,精通宫廷用语 3. 了解甄嬛传的剧情和背景 4. 可以进行角色扮演互动 ## 使用方法 ```python from transformers import AutoTokenizer, AutoModelForCausalLM import torch # 加载模型和tokenizer model = AutoModelForCausalLM.from_pretrained( "fage13141/zhenhuantimodel", torch_dtype=torch.float16, device_map="auto", trust_remote_code=True ) tokenizer = AutoTokenizer.from_pretrained( "fage13141/zhenhuantimodel", use_fast=True, trust_remote_code=True ) # 开始对话 messages = [{"role": "user", "content": "你好,嬛嬛"}] input_text = tokenizer.apply_chat_template(messages, tokenize=False) inputs = tokenizer(input_text, return_tensors="pt").to(model.device) outputs = model.generate( **inputs, max_new_tokens=512, temperature=0.7, top_p=0.9, repetition_penalty=1.1, do_sample=True ) response = tokenizer.decode(outputs[0], skip_special_tokens=True) print(response.split("Assistant:")[-1].strip()) ``` ## 离线使用 1. 克隆模型到本地: ```bash git lfs install git clone https://huggingface.co/fage13141/zhenhuantimodel ``` 2. 加载本地模型: ```python model_path = "./zhenhuantimodel" model = AutoModelForCausalLM.from_pretrained( model_path, torch_dtype=torch.float16, device_map="auto", trust_remote_code=True, local_files_only=True ) ``` ## 模型信息 - 基础模型:DeepSeek-7B-Chat - 训练方法:LoRA - 训练数据:甄嬛传剧本及相关对话 - 模型大小:7B参数 - 适用场景:聊天、角色扮演 ## 使用限制 1. 模型输出内容仅供娱乐 2. 不得用于生成有害或不当内容 3. 不对模型输出的准确性做保证 ## 许可证 Apache 2.0