bread-good111 commited on
Commit
097e9e6
·
verified ·
1 Parent(s): f38d93f

Delete 快速使用指南.md

Browse files
Files changed (1) hide show
  1. 快速使用指南.md +0 -209
快速使用指南.md DELETED
@@ -1,209 +0,0 @@
1
- # 🚀 LongEmotion 比赛文件 - 快速使用指南
2
-
3
- **最后更新**: 2025-10-27
4
- **状态**: ✅ 已完成推理,可提交
5
-
6
- ---
7
-
8
- ## 📁 文件说明
9
-
10
- ```
11
- COMPETITION_FILES/
12
- ├── model/
13
- │ └── best_model.pt # 训练好的模型(91.47%准确率)
14
-
15
- ├── test_data/
16
- │ └── test.jsonl # 测试集(136个样本)
17
-
18
- ├── scripts/
19
- │ ├── run_inference_final.py # 主运行脚本
20
- │ ├── inference_longemotion.py # 推理核心逻辑
21
- │ ├── convert_submission_format.py # 格式转换
22
- │ └── detection_model.py # 模型定义
23
-
24
- ├── submission/
25
- │ └── Emotion_Detection_Result.jsonl # 📤 提交文件
26
-
27
- └── reports/
28
- ├── 项目最终进度报告.md # 完整报告
29
- └── 项目自查报告.md # 自查报告
30
- ```
31
-
32
- ---
33
-
34
- ## 🎯 提交文件
35
-
36
- ### 📤 立即提交
37
- **文件路径**: `submission/Emotion_Detection_Result.jsonl`
38
-
39
- **格式**:
40
- ```json
41
- {"id": 0, "predicted_index": 24}
42
- {"id": 1, "predicted_index": 4}
43
- {"id": 2, "predicted_index": 11}
44
- ...
45
- ```
46
-
47
- **统计信息**:
48
- - ✅ 样本数: 136
49
- - ✅ 平均置信度: 89.27%
50
- - ✅ 格式正确
51
-
52
- ---
53
-
54
- ## 🔄 重新运行推理(如需要)
55
-
56
- ### 步骤1: 激活虚拟环境
57
- ```bash
58
- # 从项目根目录运行
59
- .\venv\Scripts\activate
60
- ```
61
-
62
- ### 步骤2: 进入Detection文件夹并运行推理
63
- ```bash
64
- cd Detection
65
- python scripts/run_inference_final.py
66
- ```
67
-
68
- **输出**: 新的预测结果将保存到 `submission/predictions.jsonl`
69
-
70
- ### 步骤3: 转换格式(如需要)
71
- ```bash
72
- # 在Detection/scripts文件夹内运行
73
- cd scripts
74
- python convert_submission_format.py
75
- ```
76
-
77
- **输出**: 提交格式文件 `submission/Emotion_Detection_Result.jsonl`
78
-
79
- ---
80
-
81
- ## 📊 模型性能
82
-
83
- | 指标 | 值 |
84
- |------|-----|
85
- | 验证准确率 | 91.47% |
86
- | 平均置信度 | 89.27% |
87
- | 推理时间 | 5-10分钟 |
88
- | 测试样本 | 136个 |
89
-
90
- ### 情感分布
91
- - love: 40.4%
92
- - surprise: 22.8%
93
- - fear: 13.2%
94
- - anger: 11.8%
95
- - sadness: 10.3%
96
- - joy: 1.5%
97
-
98
- ---
99
-
100
- ## 🔍 文件详解
101
-
102
- ### model/best_model.pt
103
- - **类型**: PyTorch模型权重
104
- - **结构**: BERT-base-chinese + Linear分类器
105
- - **训练数据**: 12,800条短文本
106
- - **性能**: 91.47%验证准确率
107
- - **位置**: `Detection/model/best_model.pt`
108
-
109
- ### test_data/test.jsonl
110
- - **格式**: LongEmotion标准格式
111
- - **样本**: 136个长文本
112
- - **特点**: 每个样本30-34个段落
113
- - **位置**: `Detection/test_data/test.jsonl`
114
-
115
- ### submission/Emotion_Detection_Result.jsonl
116
- - **格式**: `{"id": int, "predicted_index": int}`
117
- - **说明**:
118
- - `id`: 样本编号 (0-135)
119
- - `predicted_index`: 预测的独特情感段落索引
120
- - **位置**: `Detection/submission/Emotion_Detection_Result.jsonl`
121
-
122
- ---
123
-
124
- ## ⚙️ 技术细节
125
-
126
- ### 推理流程
127
- 1. 加载训练好的BERT模型(从 `model/best_model.pt`)
128
- 2. 读取测试集(从 `test_data/test.jsonl`,136个长文本样本)
129
- 3. 对每个样本的所有段落预测情感
130
- 4. 统计情感分布,找出只出现1次的(独特)
131
- 5. 输出该段落的索引到 `submission/` 文件夹
132
-
133
- ### 情感类别(6类)
134
- - 0: sadness
135
- - 1: joy
136
- - 2: love
137
- - 3: anger
138
- - 4: fear
139
- - 5: surprise
140
-
141
- ---
142
-
143
- ## 🐛 故障排除
144
-
145
- ### 问题1: 模型加载失败
146
- **解决**:
147
- - 确保在Detection文件夹内运行脚本
148
- - 脚本会自动使用相对路径定位文件
149
- - 检查 `model/best_model.pt` 文件是否存在
150
-
151
- ### 问题2: 依赖缺失
152
- **解决**:
153
- ```bash
154
- # 激活虚拟环境后安装依赖
155
- pip install torch transformers tqdm
156
- ```
157
-
158
- ### 问题3: 内存不足
159
- **解决**: 脚本默认使用CPU,内存需求较低(约2-4GB)
160
-
161
- ### 问题4: 找不到文件
162
- **解决**:
163
- - 确保当前目录在 `Detection` 文件夹
164
- - 使用 `cd Detection` 进入文件夹
165
- - 检查文件结构是否完整
166
-
167
- ---
168
-
169
- ## 📝 注意事项
170
-
171
- 1. ✅ 提交文件已生成在 `submission/Emotion_Detection_Result.jsonl`
172
- 2. ⚠️ 运行脚本时必须在 `Detection` 文件夹内(或其子文件夹)
173
- 3. ⚠️ 如需重新推理,确保虚拟环境已激活
174
- 4. ⚠️ 模型文件较大(~400MB),请勿删除 `model/best_model.pt`
175
- 5. ✅ 所有路径已更新为Detection文件夹内的相对路径
176
-
177
- ---
178
-
179
- ## 🎓 学习资源
180
-
181
- - **模型架构**: scripts/detection_model.py
182
- - **推理逻辑**: scripts/inference_longemotion.py
183
- - **完整报告**: reports/项目最终进度报告.md
184
-
185
- ---
186
-
187
- ## ✅ 检查清单
188
-
189
- 提交前确认:
190
- - [ ] 文件格式正确(每行一个JSON对象)
191
- - [ ] 包含136行(对应136个测试样本)
192
- - [ ] `id`字段从0到135
193
- - [ ] `predicted_index`是整数
194
- - [ ] 文件编码UTF-8
195
-
196
- ---
197
-
198
- ## 🆘 需要帮助?
199
-
200
- 查看:
201
- 1. `reports/项目最终进度报告.md` - 完整��术报告
202
- 2. `reports/项目自查报告.md` - 项目自查说明
203
- 3. `README.md` - 快速概览
204
- 4. `scripts/` - 查看源代码了解实现细节
205
-
206
- ---
207
-
208
- **祝您比赛顺利!** 🎉
209
-