# Emotion Summary Model (mT5-small) ## 模型描述 这是一个基于 mT5-small 微调的情感总结模型,用于从心理咨询案例中提取和总结关键信息。 ## 模型信息 - **基础模型**: google/mt5-small - **任务**: 长文本情感信息提取与总结 - **训练数据**: 8000条心理咨询对话 - **验证数据**: 800条 - **输出字段**: - predicted_cause: 病因分析 - predicted_symptoms: 症状描述 - predicted_treatment_process: 治疗过程 - predicted_illness_Characteristics: 疾病特征 - predicted_treatment_effect: 治疗效果 ## 使用方法 ```python from transformers import MT5ForConditionalGeneration, MT5Tokenizer # 加载模型和tokenizer model = MT5ForConditionalGeneration.from_pretrained("./emotion_summary") tokenizer = MT5Tokenizer.from_pretrained("./emotion_summary") # 准备输入 case_text = "..." # 输入的案例文本 input_text = f"Summarize case: {case_text}" # 编码 input_ids = tokenizer.encode(input_text, return_tensors="pt", max_length=512, truncation=True) # 生成 output_ids = model.generate( input_ids, max_length=256, num_beams=4, early_stopping=True ) # 解码 output_text = tokenizer.decode(output_ids[0], skip_special_tokens=True) print(output_text) ``` ## 训练参数 - **Epochs**: 1 - **Batch Size**: 4 - **Learning Rate**: 1e-4 - **Max Input Length**: 128 tokens - **Max Output Length**: 128 tokens - **Gradient Accumulation Steps**: 2 ## 性能 - 训练损失: ~2.5 - 验证损失: ~2.8 - 推理速度: ~2-3秒/样本 ## 注意事项 1. 输入文本需要包含完整的案例描述、咨询过程和反思内容 2. 模型针对心理咨询领域文本优化 3. 建议输入长度控制在512 tokens以内以获得最佳效果 ## 文件清单 - `config.json`: 模型配置 - `generation_config.json`: 生成配置 - `model.safetensors`: 模型权重 - `tokenizer配置文件`: 用于文本编码/解码 - `spiece.model`: SentencePiece词表 ## 许可证 MIT License ## 引用 如果使用本模型,请引用: ``` @model{emotion_summary_mt5, title={Emotion Summary Model based on mT5-small}, year={2025}, author={Your Team} } ```