Views
No views yet
| 测试反应 | 输入 | 预测产物 | 准确性 |
|---|---|---|---|
| 酯水解 | CCOC(=O)c1ccccc1 | O=C(O)c1ccccc1 (苯甲酸) | ✅ 正确 |
| 酯化反应 | CC(=O)O.CCO | CCOC(C)=O (乙酸乙酯) | ✅ 正确 |
| 亲核取代 | 氯苯 + 硫醇 | 硫醚产物 | ✅ 正确 |
1pip install torch torch-geometric rdkit pandas numpy
2
3使用方法
4
5import pickle
6import torch
7from rdkit import Chem
8
9# 1. 加载模板库
10with open("reaction_templates.pkl", "rb") as f:
11 templates = pickle.load(f)
12
13# 2. 加载模型(需要模型类定义,见代码)
14from model import WorkingPredictor
15
16predictor = WorkingPredictor(
17 templates=templates,
18 center_model_path="reaction_center_model.pt"
19)
20
21# 3. 预测反应产物
22reactants = "CCOC(=O)c1ccccc1" # 苯甲酸乙酯
23results = predictor.predict_products(reactants, top_k=5)
24
25for i, pred in enumerate(results, 1):
26 print(f"产物 {i}: {pred['product_smiles']}")
27 print(f" 置信度: {pred['confidence']:.3f}")
28
29文件说明
30
31- reaction_templates.pkl: 反应模板库(2,115个模板)
32- reaction_center_model.pt: 反应中心预测GAT模型
33- config.json: 模型配置信息
34- predictor.py: 完整的预测器代码
35
36模型架构
37
38反应中心预测(GAT)
39
40- 输入维度: 4 (原子编号, 度, 电荷, 芳香性)
41- 隐藏层: 128维
42- GAT层数: 3层
43- 注意力头: 4个
44
45模板匹配
46
47- 基于SMARTS的反应模板
48- 保留atom mapping用于反应引导
49- 支持多反应物排列组合
50
51引用
52
53如果使用本模型,请引用:
54
55@software{chemical_reaction_predictor_2025,
56 title={Chemical Reaction Product Predictor},
57 author={Sheming Du},
58 year={2025},
59 url={https://huggingface.co/AI-follower99/chemical-reaction-predictor}
60}
61
62许可证
63
64MIT License
65
66联系方式
67
68- Hugging Face: https://huggingface.co/AI-follower99
69- 问题反馈: https://huggingface.co/AI-follower99/chemical-reaction-predictor/discussions