@lzhzzzzwill/cofos 1.0.1 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,313 @@
1
+ # COF-ROS-Reasoner 配置文件
2
+
3
+ project_name: COF-ROS-Reasoner
4
+ version: 1.0.0
5
+
6
+ paths:
7
+ # 原始数据路径
8
+ raw_pdfs: data/raw_pdfs
9
+ raw_json: data/raw_json
10
+ raw_wos: data/raw_wos/wos_abstracts.xlsx
11
+
12
+ # 处理后数据路径
13
+ processed_dir: data/processed
14
+ sft_dir: data/sft
15
+ kg_dir: data/kg
16
+ eval_dir: data/eval
17
+
18
+ # 检索库路径
19
+ retrieval_store: retrieval_store/embedding
20
+ bm25_store: retrieval_store/bm25
21
+
22
+ # 模型和输出路径
23
+ checkpoints_dir: checkpoints
24
+ outputs_dir: outputs
25
+ logs_dir: outputs/logs
26
+
27
+ models:
28
+ # fwdemo 的 QA 学生模型默认从 Hugging Face 加载:Willlzh/COFOS。
29
+ # 以下 teacher/student Ollama 名称只用于完整 COFOS 项目的抽取、蒸馏等离线流程;
30
+ # 独立 npx QA 不会调用这些内网 Ollama 模型。
31
+ teacher_model: qwen3.6:35b
32
+ student_model: qwen3.5:4b
33
+
34
+ # 如需启用 FAISS 向量检索,可改成本地 embedding 模型目录。
35
+ embedding_model: ""
36
+ reranker_model: ""
37
+
38
+ # 本地/内网 LLM 调用配置。fwdemo 独立 QA 路径不使用该配置;
39
+ # 它只保留给完整项目里的 Silver 抽取、教师蒸馏、KG-RAG 教师回答等流程。
40
+ llm:
41
+ provider: ollama
42
+ generate_url: http://10.161.138.150:11434/api/generate
43
+ teacher_model: qwen3.6:35b
44
+ student_model: qwen3.5:4b
45
+ extraction_model: qwen3.6:35b
46
+ inference_model: qwen3.6:35b
47
+ student_inference_model: qwen3.5:4b
48
+ timeout: 120
49
+ stream: false
50
+ temperature: 0.2
51
+ top_p: 0.9
52
+
53
+ extraction:
54
+ only_ros_related_chunks: true
55
+ resume: true
56
+ save_every: 10
57
+ progress_every: 1
58
+ max_chunks: null
59
+
60
+ distillation:
61
+ input_file: data/sft/cofros_train.jsonl
62
+ output_file: data/sft/cofros_teacher_distill.jsonl
63
+ progress_file: data/sft/teacher_distillation_progress.json
64
+ resume: true
65
+ save_every: 10
66
+ max_samples: null
67
+
68
+ rag_sft:
69
+ output_file: data/sft/cofros_rag_sft.jsonl
70
+ max_records: null
71
+ max_evidence_items: 5
72
+ skip_generic_material: true
73
+ include_support_status:
74
+ - supported
75
+ - partially_supported
76
+ include_gold: true
77
+
78
+ # 训练配置
79
+ # Linux服务器 Qwen3.5 系列优化配置
80
+ training:
81
+ target_model: qwen3.5:4b
82
+ # QLoRA 训练需要 Transformers 格式的本地基础模型目录。
83
+ # 这里不要填 Ollama tag;请在服务器上改成实际模型目录,例如 /models/qwen3.5-4b-instruct。
84
+ base_model_path: ""
85
+ # 主训练集仍然是教师蒸馏数据;辅助集补充 RAG 输入格式、氧化还原基础和自然问答风格。
86
+ train_file: data/sft/cofros_teacher_distill.jsonl
87
+ aux_train_files:
88
+ - data/sft/cofros_rag_sft.jsonl
89
+ - data/sft/chem_redox_sft.jsonl
90
+ - data/sft/style_correction_sft.jsonl
91
+ output_dir: checkpoints/lora_adapter_natural_redox_mix
92
+ max_seq_length: 4096
93
+ learning_rate: 2.0e-4
94
+ num_train_epochs: 3
95
+ per_device_train_batch_size: 1
96
+ gradient_accumulation_steps: 8
97
+ lora_r: 32
98
+ lora_alpha: 64
99
+ lora_dropout: 0.05
100
+ load_in_4bit: true
101
+ bf16: true
102
+ fp16: false # Qwen3.5 推荐使用 bf16
103
+ seed: 42
104
+ logging_steps: 10
105
+ save_steps: 500
106
+ save_total_limit: 3
107
+ resume_from_checkpoint: auto
108
+ warmup_ratio: 0.03
109
+ weight_decay: 0.0
110
+ max_grad_norm: 0.3
111
+ local_files_only: true
112
+ trust_remote_code: true
113
+ gradient_checkpointing: true
114
+ target_modules:
115
+ - q_proj
116
+ - k_proj
117
+ - v_proj
118
+ - o_proj
119
+ - gate_proj
120
+ - up_proj
121
+ - down_proj
122
+
123
+ # Qwen3.5 专用配置
124
+ model_type: qwen3 # qwen, qwen2, qwen3
125
+ use_flash_attn: true # 启用 FlashAttention 加速
126
+
127
+ # 学生模型推理与部署路径。脚本参数可覆盖这些值。
128
+ student_inference:
129
+ # 独立 fwdemo 默认使用 Hugging Face 模型;若本地已有 merged checkpoint,可在 CLI 中传 --model 覆盖。
130
+ base_model_path: ""
131
+ adapter_path: ""
132
+ merged_model_path: Willlzh/COFOS
133
+
134
+ # 检索配置
135
+ retrieval:
136
+ enable_faiss: false
137
+ enable_bm25: true
138
+ vector_top_k: 20
139
+ bm25_top_k: 20
140
+ rerank_top_k: 5
141
+ # 无结果优于错误结果:低于阈值时不向模型注入 RAG 上下文。
142
+ min_bm25_score: 7.0
143
+ min_vector_score: 0.35
144
+ min_kg_confidence: 2.0
145
+ source_priority:
146
+ gold_silver_json: 4
147
+ gold_json: 4
148
+ silver_json: 3
149
+ pdf: 2
150
+ pdf_fulltext: 2
151
+ wos: 1
152
+ wos_abstract: 1
153
+
154
+ # 生成配置
155
+ generation:
156
+ temperature: 0.2
157
+ top_p: 0.9
158
+ max_new_tokens: 1024
159
+ do_sample: true
160
+ repetition_penalty: 1.08
161
+ num_beams: 1
162
+ no_repeat_ngram_size: 0
163
+ min_new_tokens: 0
164
+ history_max_turns: 4
165
+ refine_answers: true
166
+ refinement_max_new_tokens: 512
167
+
168
+ # 数据处理配置
169
+ data_processing:
170
+ # PDF chunk 配置
171
+ chunk_size: 768
172
+ chunk_overlap: 50
173
+
174
+ # ROS 物种标准化
175
+ ros_normalization:
176
+ "center dot OH": "·OH"
177
+ "OH·": "·OH"
178
+ "•OH": "·OH"
179
+ "⋅OH": "·OH"
180
+ "hydroxyl radical": "·OH"
181
+
182
+ "O2 center dot-": "O2·-"
183
+ "O2•−": "O2·-"
184
+ "•O2-": "O2·-"
185
+ "superoxide": "O2·-"
186
+ "superoxide radical": "O2·-"
187
+
188
+ "1O2": "1O2"
189
+ "¹O₂": "1O2"
190
+ "singlet oxygen": "1O2"
191
+
192
+ "H2O2": "H2O2"
193
+ "hydrogen peroxide": "H2O2"
194
+
195
+ "SO4·-": "SO4·-"
196
+ "SO4•−": "SO4·-"
197
+ "sulfate radical": "SO4·-"
198
+
199
+ "*O2": "*O2"
200
+ "*OOH": "*OOH"
201
+ "*HOOH": "*HOOH"
202
+
203
+ "OH": "·OH"
204
+ "O2-": "O2·-"
205
+ "O2*": "*O2"
206
+ "OOH*": "*OOH"
207
+ "HOOH*": "*HOOH"
208
+
209
+ # ROS 关键词(用于段落筛选)
210
+ ros_keywords:
211
+ - "ROS"
212
+ - "reactive oxygen species"
213
+ - "H2O2"
214
+ - "hydrogen peroxide"
215
+ - "2e- ORR"
216
+ - "oxygen reduction reaction"
217
+ - "superoxide"
218
+ - "O2·-"
219
+ - "singlet oxygen"
220
+ - "1O2"
221
+ - "hydroxyl radical"
222
+ - "·OH"
223
+ - "sulfate radical"
224
+ - "SO4·-"
225
+ - "PMS"
226
+ - "PDS"
227
+ - "EPR"
228
+ - "ESR"
229
+ - "DMPO"
230
+ - "TEMP"
231
+ - "TEMPO"
232
+ - "scavenger"
233
+ - "quenching"
234
+ - "probe"
235
+ - "photocatalysis"
236
+ - "photodynamic"
237
+ - "donor-acceptor"
238
+ - "COF"
239
+ - "covalent organic framework"
240
+
241
+ # 证据方法关键词
242
+ evidence_methods:
243
+ - "EPR"
244
+ - "ESR"
245
+ - "DMPO"
246
+ - "TEMP"
247
+ - "TEMPO"
248
+ - "scavenger"
249
+ - "quenching"
250
+ - "probe"
251
+ - "in situ"
252
+ - "DRIFTS"
253
+ - "DFT"
254
+ - "calculation"
255
+
256
+ # KG 构建配置
257
+ kg:
258
+ progress_every: 100
259
+ node_types:
260
+ - Material
261
+ - Reaction_Condition
262
+ - Driving_Force
263
+ - Oxidant_Source
264
+ - ROS_or_Product
265
+ - Intermediate
266
+ - Evidence_Method
267
+ - Application
268
+ - Target
269
+ - Paper
270
+ relation_types:
271
+ - dominantly_generates
272
+ - secondarily_generates
273
+ - has_intermediate
274
+ - under_condition
275
+ - driven_by
276
+ - uses_oxidant
277
+ - evidenced_by
278
+ - reported_in
279
+ - applied_to
280
+ - targets
281
+
282
+ # 推理配置
283
+ inference:
284
+ # KG-RAG 配置
285
+ kg_rag:
286
+ top_k_facts: 10
287
+ top_k_evidence: 5
288
+ evidence_weight: 0.7
289
+ kg_weight: 0.3
290
+
291
+ # 幻觉检测配置
292
+ hallucination_detection:
293
+ check_ros_speices: true
294
+ check_evidence_methods: true
295
+ check_conditions: true
296
+ check_sources: true
297
+
298
+ # 评测配置
299
+ evaluation:
300
+ # 评测样本数量
301
+ num_samples: 100
302
+
303
+ # 幻觉类型
304
+ hallucination_types:
305
+ - fabricated_ros
306
+ - wrong_dominant_species
307
+ - h2o2_as_radical
308
+ - so4_for_pms_absent
309
+ - epr_fabricated
310
+ - condition_omitted
311
+ - abstract_as_evidence
312
+ - overconfident
313
+ - cross_cof_misattribution