Bohrium
robot
新建

空间站广场

论文
Notebooks
比赛
课程
Apps
我的主页
我的Notebooks
我的论文库
我的足迹

我的工作空间

任务
节点
文件
数据集
镜像
项目
数据库
公开
Uni-Mol预测液流电池溶解度
AI4S经验分享
Uni-Mol
Hackathon
AI4S经验分享Uni-MolHackathon
zmz
AndyX
更新于 2024-10-31
推荐镜像 :Third-party software:Deprecated
推荐机型 :c3_m4_1 * NVIDIA T4
赞 9
6
13
液流电池溶解度(v2)

Uni-Mol预测液流电池溶解度

©️ Copyright 2023 @ Authors
作者: 谢启明 📨 张明正 📨
日期:2023-09-06
共享协议:本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可。
快速开始:点击上方的 开始连接 按钮,选择 unimol-qsar:v0.4镜像及任意GPU节点配置,稍等片刻即可运行。

代码
文本

AIMS:

  • 利用Uni-Mol进行液流电池溶解度预测的实战
  • 理解Uni-Mol的工作模块
  • 使用以SMILE字符串为输入的训练方法
  • 使用回归模型来预测连续数值
  • 使用训练出的模型预测一些水系液流电池电活性分子的溶解度
代码
文本

Overview

1.简介

水系有机液流电池 (AORFB)作为大规模储能技术,在实现可再生能源高效利用方面展现出良好的应用潜力。AORFB采用水溶性有机电活性分子作为电解质,这类有机电解质具备原料来源丰富、性能高度可调和动力学快速等优点,赋予液流电池更加广阔的应用前景。但是有机电活性分子溶解度有限、电解液凝固和反应动力学缓慢,低温下循环的水系有机液流电池性能难以保证[1]。

2.液流电池核心指标

液流电池最核心的性能指标为能量密度,RFB理论能量密度由下式得出[2]。

式中:W是能量密度,Wh·L-1;n是参与氧化还原反应的电子数;C是溶解在电解液中的电活性物质的最低浓度,mol·L-1;F是法拉第常数;V是电池电压,V;是体积因数,=1+(溶解度较低的活性物质浓度/溶解度较高的活性物质浓度),当浓度相等时,=2。

因此能量密度由电解液中的活性物质的溶解度、氧化还原电位和转移的电子数共同决定。故提高能量密度的方法主要从增大溶解度、提高电化学窗口和电子的得失数这3个方面着手。结合高通量计算方法筛选有机电活性分子,助力下一代氧化还原液流电池的成功开发。

3.RedDB数据库简介

本项目利用RedDB[3]数据库。RedDB具有31,618条分子数据,这些分子是通过52个不同核心分子的结构功能化而衍生的。内含OPT几何优化、SPE单点能两种DFT计算结果的结果和利用水溶性预测模型(AqSolPred v1.0)[4]预测的溶解度数据。REdDB中溶解度数值单位为mol/L的无量纲对数--LogS。

4.AqSolPred简介

AqSolPred集成三种ML方法,在一个含9982条实验溶解度数据的数据库——AqSolDB上进行训练。该模型的MAE为0.348。AqSolPred 模型之前已在基准溶解度数据集上进行了验证[6].该模型的平均绝对误差为0.348LogS,低于通常用于预测化学物质水溶性的传统化学信息学和机器学习方法[4]。分子的SMILES表示被用作AqSolPred的输入,其ML预测的溶解度数据已被纳入RedDB。

5.目标

1)使用以SMILE字符串为输入的训练方法;

2)使用Uni-Mol分子通用学习框架来预测连续数值;

3)使用训练出的模型预测一些水系液流电池电活性化合物溶解度。

代码
文本

Step1:导入Uni-Mol

导入Uni-Mol所需模块

代码
文本
[1]
# 导入Uni-Mol
from unimol import MolTrain, MolPredict
代码
文本

Step2:输入数据并训练(可跳过)

训练时间可能较长,训练好的数据(csv文件)均已上传至数据集,时间有限的朋友可以跳过此步。

代码
文本
[2]
clf = MolTrain(task='regression',
data_type='molecule',
epochs=50,
learning_rate=0.0004,
batch_size=32,
early_stopping=5,
metrics='r2',
split='random',
save_path='./best_exp',
)

clf.fit('/bohr/aorfb-7iz1/v2/RedDB_train.csv')
2023-09-04 15:51:18 | unimol/data/datareader.py | 138 | INFO | Uni-Mol(QSAR) | Anomaly clean with 3 sigma threshold: 25294 -> 25293
2023-09-04 15:51:22 | unimol/data/conformer.py | 62 | INFO | Uni-Mol(QSAR) | Start generating conformers...
25293it [02:46, 151.98it/s]
2023-09-04 15:54:09 | unimol/data/conformer.py | 66 | INFO | Uni-Mol(QSAR) | Failed to generate conformers for 0.00% of molecules.
2023-09-04 15:54:09 | unimol/data/conformer.py | 68 | INFO | Uni-Mol(QSAR) | Failed to generate 3d conformers for 0.03% of molecules.
2023-09-04 15:54:09 | unimol/train.py | 88 | INFO | Uni-Mol(QSAR) | Output directory already exists: ./best_exp
2023-09-04 15:54:09 | unimol/train.py | 89 | INFO | Uni-Mol(QSAR) | Warning: Overwrite output directory: ./best_exp
2023-09-04 15:54:10 | unimol/models/unimol.py | 114 | INFO | Uni-Mol(QSAR) | Loading pretrained weights from /opt/conda/lib/python3.8/site-packages/unimol-0.0.2-py3.8.egg/unimol/weights/mol_pre_all_h_220816.pt
2023-09-04 15:54:10 | unimol/models/nnmodel.py | 103 | INFO | Uni-Mol(QSAR) | start training Uni-Mol:unimolv1
2023-09-04 15:55:22 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [1/50] train_loss: 0.1694, val_loss: 0.0961, val_r2: 0.9043, lr: 0.000267, 69.2s
2023-09-04 15:56:27 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [2/50] train_loss: 0.0543, val_loss: 0.0285, val_r2: 0.9716, lr: 0.000396, 63.7s
2023-09-04 15:57:32 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [3/50] train_loss: 0.0273, val_loss: 0.0284, val_r2: 0.9716, lr: 0.000388, 64.2s
2023-09-04 15:58:36 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [4/50] train_loss: 0.0210, val_loss: 0.0169, val_r2: 0.9831, lr: 0.000379, 63.1s
2023-09-04 15:59:44 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [5/50] train_loss: 0.0184, val_loss: 0.0140, val_r2: 0.9860, lr: 0.000371, 67.6s
2023-09-04 16:00:56 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [6/50] train_loss: 0.0151, val_loss: 0.0165, val_r2: 0.9835, lr: 0.000363, 71.0s
2023-09-04 16:01:59 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [7/50] train_loss: 0.0144, val_loss: 0.0121, val_r2: 0.9879, lr: 0.000355, 63.4s
2023-09-04 16:03:03 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [8/50] train_loss: 0.0126, val_loss: 0.0121, val_r2: 0.9878, lr: 0.000346, 63.7s
2023-09-04 16:04:07 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [9/50] train_loss: 0.0115, val_loss: 0.0169, val_r2: 0.9831, lr: 0.000338, 63.7s
2023-09-04 16:05:13 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [10/50] train_loss: 0.0103, val_loss: 0.0141, val_r2: 0.9858, lr: 0.000330, 65.6s
2023-09-04 16:06:19 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [11/50] train_loss: 0.0102, val_loss: 0.0122, val_r2: 0.9877, lr: 0.000322, 66.1s
2023-09-04 16:07:21 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [12/50] train_loss: 0.0092, val_loss: 0.0084, val_r2: 0.9917, lr: 0.000313, 62.2s
2023-09-04 16:08:26 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [13/50] train_loss: 0.0084, val_loss: 0.0087, val_r2: 0.9913, lr: 0.000305, 64.6s
2023-09-04 16:09:37 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [14/50] train_loss: 0.0074, val_loss: 0.0092, val_r2: 0.9908, lr: 0.000297, 70.3s
2023-09-04 16:10:44 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [15/50] train_loss: 0.0081, val_loss: 0.0113, val_r2: 0.9887, lr: 0.000289, 67.2s
2023-09-04 16:11:53 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [16/50] train_loss: 0.0069, val_loss: 0.0080, val_r2: 0.9920, lr: 0.000280, 69.3s
2023-09-04 16:12:57 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [17/50] train_loss: 0.0064, val_loss: 0.0090, val_r2: 0.9909, lr: 0.000272, 62.8s
2023-09-04 16:14:08 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [18/50] train_loss: 0.0057, val_loss: 0.0069, val_r2: 0.9931, lr: 0.000264, 71.6s
2023-09-04 16:15:12 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [19/50] train_loss: 0.0054, val_loss: 0.0069, val_r2: 0.9931, lr: 0.000256, 63.6s
2023-09-04 16:16:19 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [20/50] train_loss: 0.0056, val_loss: 0.0074, val_r2: 0.9926, lr: 0.000247, 65.7s
2023-09-04 16:17:21 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [21/50] train_loss: 0.0050, val_loss: 0.0071, val_r2: 0.9929, lr: 0.000239, 61.8s
2023-09-04 16:18:24 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [22/50] train_loss: 0.0046, val_loss: 0.0085, val_r2: 0.9916, lr: 0.000231, 63.6s
2023-09-04 16:19:29 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [23/50] train_loss: 0.0041, val_loss: 0.0061, val_r2: 0.9939, lr: 0.000223, 64.9s
2023-09-04 16:20:37 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [24/50] train_loss: 0.0040, val_loss: 0.0062, val_r2: 0.9938, lr: 0.000214, 67.2s
2023-09-04 16:21:41 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [25/50] train_loss: 0.0043, val_loss: 0.0061, val_r2: 0.9939, lr: 0.000206, 64.2s
2023-09-04 16:22:45 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [26/50] train_loss: 0.0037, val_loss: 0.0056, val_r2: 0.9944, lr: 0.000198, 63.6s
2023-09-04 16:23:57 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [27/50] train_loss: 0.0035, val_loss: 0.0057, val_r2: 0.9943, lr: 0.000190, 71.6s
2023-09-04 16:25:01 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [28/50] train_loss: 0.0033, val_loss: 0.0058, val_r2: 0.9942, lr: 0.000181, 64.2s
2023-09-04 16:26:06 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [29/50] train_loss: 0.0031, val_loss: 0.0056, val_r2: 0.9944, lr: 0.000173, 65.1s
2023-09-04 16:27:19 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [30/50] train_loss: 0.0030, val_loss: 0.0055, val_r2: 0.9945, lr: 0.000165, 72.3s
2023-09-04 16:28:31 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [31/50] train_loss: 0.0029, val_loss: 0.0049, val_r2: 0.9950, lr: 0.000157, 72.2s
2023-09-04 16:29:40 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [32/50] train_loss: 0.0028, val_loss: 0.0051, val_r2: 0.9949, lr: 0.000148, 67.9s
2023-09-04 16:30:45 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [33/50] train_loss: 0.0026, val_loss: 0.0051, val_r2: 0.9949, lr: 0.000140, 65.1s
2023-09-04 16:31:48 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [34/50] train_loss: 0.0026, val_loss: 0.0050, val_r2: 0.9950, lr: 0.000132, 62.8s
2023-09-04 16:33:04 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [35/50] train_loss: 0.0023, val_loss: 0.0049, val_r2: 0.9951, lr: 0.000124, 76.5s
2023-09-04 16:34:22 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [36/50] train_loss: 0.0022, val_loss: 0.0048, val_r2: 0.9952, lr: 0.000115, 76.7s
2023-09-04 16:35:30 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [37/50] train_loss: 0.0021, val_loss: 0.0050, val_r2: 0.9950, lr: 0.000107, 67.9s
2023-09-04 16:36:41 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [38/50] train_loss: 0.0020, val_loss: 0.0048, val_r2: 0.9951, lr: 0.000099, 70.6s
2023-09-04 16:37:53 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [39/50] train_loss: 0.0019, val_loss: 0.0046, val_r2: 0.9954, lr: 0.000091, 72.5s
2023-09-04 16:38:59 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [40/50] train_loss: 0.0020, val_loss: 0.0045, val_r2: 0.9955, lr: 0.000082, 64.9s
2023-09-04 16:40:03 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [41/50] train_loss: 0.0018, val_loss: 0.0046, val_r2: 0.9954, lr: 0.000074, 63.6s
2023-09-04 16:41:07 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [42/50] train_loss: 0.0018, val_loss: 0.0046, val_r2: 0.9954, lr: 0.000066, 64.4s
2023-09-04 16:42:10 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [43/50] train_loss: 0.0018, val_loss: 0.0045, val_r2: 0.9955, lr: 0.000058, 62.9s
2023-09-04 16:43:14 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [44/50] train_loss: 0.0016, val_loss: 0.0046, val_r2: 0.9954, lr: 0.000049, 63.2s
2023-09-04 16:44:16 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [45/50] train_loss: 0.0015, val_loss: 0.0045, val_r2: 0.9954, lr: 0.000041, 62.2s
2023-09-04 16:45:20 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [46/50] train_loss: 0.0015, val_loss: 0.0044, val_r2: 0.9956, lr: 0.000033, 63.6s
2023-09-04 16:46:29 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [47/50] train_loss: 0.0014, val_loss: 0.0044, val_r2: 0.9956, lr: 0.000025, 68.4s
2023-09-04 16:47:33 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [48/50] train_loss: 0.0014, val_loss: 0.0044, val_r2: 0.9956, lr: 0.000016, 64.3s
2023-09-04 16:48:37 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [49/50] train_loss: 0.0014, val_loss: 0.0045, val_r2: 0.9955, lr: 0.000008, 63.3s
2023-09-04 16:49:40 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [50/50] train_loss: 0.0013, val_loss: 0.0044, val_r2: 0.9956, lr: 0.000000, 63.5s
2023-09-04 16:49:41 | unimol/tasks/trainer.py | 213 | INFO | Uni-Mol(QSAR) | load model success!
2023-09-04 16:49:46 | unimol/models/nnmodel.py | 129 | INFO | Uni-Mol(QSAR) | fold 0, result {'r2': 0.9956226848041148, 'mae': 0.05991403, 'pearsonr': 0.9978418748820779, 'spearmanr': 0.9973003817239617, 'mse': 0.0075112535}
2023-09-04 16:49:46 | unimol/models/unimol.py | 114 | INFO | Uni-Mol(QSAR) | Loading pretrained weights from /opt/conda/lib/python3.8/site-packages/unimol-0.0.2-py3.8.egg/unimol/weights/mol_pre_all_h_220816.pt
2023-09-04 16:50:51 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [1/50] train_loss: 0.1861, val_loss: 0.0841, val_r2: 0.9168, lr: 0.000267, 64.9s
2023-09-04 16:51:57 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [2/50] train_loss: 0.0599, val_loss: 0.0362, val_r2: 0.9642, lr: 0.000396, 64.7s
2023-09-04 16:53:06 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [3/50] train_loss: 0.0300, val_loss: 0.0262, val_r2: 0.9741, lr: 0.000388, 68.0s
2023-09-04 16:54:10 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [4/50] train_loss: 0.0227, val_loss: 0.0228, val_r2: 0.9774, lr: 0.000379, 63.1s
2023-09-04 16:55:22 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [5/50] train_loss: 0.0179, val_loss: 0.0199, val_r2: 0.9804, lr: 0.000371, 71.4s
2023-09-04 16:56:29 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [6/50] train_loss: 0.0166, val_loss: 0.0142, val_r2: 0.9859, lr: 0.000363, 66.7s
2023-09-04 16:57:33 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [7/50] train_loss: 0.0142, val_loss: 0.0163, val_r2: 0.9839, lr: 0.000355, 63.5s
2023-09-04 16:58:37 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [8/50] train_loss: 0.0136, val_loss: 0.0163, val_r2: 0.9839, lr: 0.000346, 64.0s
2023-09-04 16:59:43 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [9/50] train_loss: 0.0113, val_loss: 0.0192, val_r2: 0.9810, lr: 0.000338, 66.1s
2023-09-04 17:00:46 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [10/50] train_loss: 0.0119, val_loss: 0.0127, val_r2: 0.9874, lr: 0.000330, 62.6s
2023-09-04 17:01:50 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [11/50] train_loss: 0.0110, val_loss: 0.0165, val_r2: 0.9836, lr: 0.000322, 63.0s
2023-09-04 17:02:54 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [12/50] train_loss: 0.0105, val_loss: 0.0100, val_r2: 0.9901, lr: 0.000313, 64.6s
2023-09-04 17:04:02 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [13/50] train_loss: 0.0091, val_loss: 0.0092, val_r2: 0.9909, lr: 0.000305, 67.8s
2023-09-04 17:05:06 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [14/50] train_loss: 0.0097, val_loss: 0.0091, val_r2: 0.9910, lr: 0.000297, 63.1s
2023-09-04 17:06:11 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [15/50] train_loss: 0.0076, val_loss: 0.0077, val_r2: 0.9923, lr: 0.000289, 63.6s
2023-09-04 17:07:14 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [16/50] train_loss: 0.0072, val_loss: 0.0110, val_r2: 0.9891, lr: 0.000280, 62.7s
2023-09-04 17:08:17 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [17/50] train_loss: 0.0075, val_loss: 0.0071, val_r2: 0.9929, lr: 0.000272, 62.6s
2023-09-04 17:09:21 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [18/50] train_loss: 0.0065, val_loss: 0.0072, val_r2: 0.9929, lr: 0.000264, 63.8s
2023-09-04 17:10:27 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [19/50] train_loss: 0.0063, val_loss: 0.0086, val_r2: 0.9914, lr: 0.000256, 65.5s
2023-09-04 17:11:30 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [20/50] train_loss: 0.0064, val_loss: 0.0078, val_r2: 0.9922, lr: 0.000247, 63.8s
2023-09-04 17:12:33 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [21/50] train_loss: 0.0055, val_loss: 0.0058, val_r2: 0.9943, lr: 0.000239, 63.1s
2023-09-04 17:13:40 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [22/50] train_loss: 0.0052, val_loss: 0.0063, val_r2: 0.9938, lr: 0.000231, 66.2s
2023-09-04 17:14:49 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [23/50] train_loss: 0.0053, val_loss: 0.0090, val_r2: 0.9911, lr: 0.000223, 69.1s
2023-09-04 17:16:03 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [24/50] train_loss: 0.0051, val_loss: 0.0058, val_r2: 0.9943, lr: 0.000214, 73.9s
2023-09-04 17:17:08 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [25/50] train_loss: 0.0047, val_loss: 0.0053, val_r2: 0.9947, lr: 0.000206, 63.8s
2023-09-04 17:18:12 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [26/50] train_loss: 0.0040, val_loss: 0.0056, val_r2: 0.9945, lr: 0.000198, 63.4s
2023-09-04 17:19:18 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [27/50] train_loss: 0.0040, val_loss: 0.0060, val_r2: 0.9941, lr: 0.000190, 65.5s
2023-09-04 17:20:20 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [28/50] train_loss: 0.0039, val_loss: 0.0070, val_r2: 0.9931, lr: 0.000181, 62.9s
2023-09-04 17:21:35 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [29/50] train_loss: 0.0036, val_loss: 0.0080, val_r2: 0.9921, lr: 0.000173, 74.9s
2023-09-04 17:22:39 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [30/50] train_loss: 0.0036, val_loss: 0.0050, val_r2: 0.9950, lr: 0.000165, 64.1s
2023-09-04 17:23:44 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [31/50] train_loss: 0.0036, val_loss: 0.0060, val_r2: 0.9941, lr: 0.000157, 63.5s
2023-09-04 17:24:48 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [32/50] train_loss: 0.0033, val_loss: 0.0050, val_r2: 0.9950, lr: 0.000148, 64.0s
2023-09-04 17:25:51 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [33/50] train_loss: 0.0032, val_loss: 0.0044, val_r2: 0.9956, lr: 0.000140, 63.4s
2023-09-04 17:27:01 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [34/50] train_loss: 0.0028, val_loss: 0.0046, val_r2: 0.9954, lr: 0.000132, 69.0s
2023-09-04 17:28:11 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [35/50] train_loss: 0.0026, val_loss: 0.0043, val_r2: 0.9958, lr: 0.000124, 70.3s
2023-09-04 17:29:19 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [36/50] train_loss: 0.0025, val_loss: 0.0052, val_r2: 0.9949, lr: 0.000115, 67.5s
2023-09-04 17:30:25 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [37/50] train_loss: 0.0025, val_loss: 0.0046, val_r2: 0.9955, lr: 0.000107, 65.6s
2023-09-04 17:31:30 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [38/50] train_loss: 0.0024, val_loss: 0.0046, val_r2: 0.9955, lr: 0.000099, 65.2s
2023-09-04 17:32:34 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [39/50] train_loss: 0.0023, val_loss: 0.0042, val_r2: 0.9958, lr: 0.000091, 63.9s
2023-09-04 17:33:39 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [40/50] train_loss: 0.0022, val_loss: 0.0054, val_r2: 0.9947, lr: 0.000082, 64.3s
2023-09-04 17:34:44 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [41/50] train_loss: 0.0020, val_loss: 0.0043, val_r2: 0.9957, lr: 0.000074, 64.5s
2023-09-04 17:35:48 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [42/50] train_loss: 0.0020, val_loss: 0.0049, val_r2: 0.9951, lr: 0.000066, 64.6s
2023-09-04 17:36:56 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [43/50] train_loss: 0.0018, val_loss: 0.0047, val_r2: 0.9953, lr: 0.000058, 67.7s
2023-09-04 17:38:05 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [44/50] train_loss: 0.0018, val_loss: 0.0041, val_r2: 0.9959, lr: 0.000049, 68.6s
2023-09-04 17:39:14 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [45/50] train_loss: 0.0017, val_loss: 0.0042, val_r2: 0.9959, lr: 0.000041, 68.0s
2023-09-04 17:40:19 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [46/50] train_loss: 0.0017, val_loss: 0.0040, val_r2: 0.9960, lr: 0.000033, 65.3s
2023-09-04 17:41:23 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [47/50] train_loss: 0.0019, val_loss: 0.0043, val_r2: 0.9957, lr: 0.000025, 63.4s
2023-09-04 17:42:32 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [48/50] train_loss: 0.0019, val_loss: 0.0042, val_r2: 0.9959, lr: 0.000016, 68.8s
2023-09-04 17:43:37 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [49/50] train_loss: 0.0015, val_loss: 0.0040, val_r2: 0.9960, lr: 0.000008, 64.9s
2023-09-04 17:44:43 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [50/50] train_loss: 0.0015, val_loss: 0.0042, val_r2: 0.9959, lr: 0.000000, 66.0s
2023-09-04 17:44:45 | unimol/tasks/trainer.py | 213 | INFO | Uni-Mol(QSAR) | load model success!
2023-09-04 17:44:50 | unimol/models/nnmodel.py | 129 | INFO | Uni-Mol(QSAR) | fold 1, result {'r2': 0.9960434374756032, 'mae': 0.059422977, 'pearsonr': 0.9980879792930252, 'spearmanr': 0.997501112441128, 'mse': 0.0068540904}
2023-09-04 17:44:50 | unimol/models/unimol.py | 114 | INFO | Uni-Mol(QSAR) | Loading pretrained weights from /opt/conda/lib/python3.8/site-packages/unimol-0.0.2-py3.8.egg/unimol/weights/mol_pre_all_h_220816.pt
2023-09-04 17:45:54 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [1/50] train_loss: 0.1815, val_loss: 0.0471, val_r2: 0.9540, lr: 0.000267, 64.0s
2023-09-04 17:47:01 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [2/50] train_loss: 0.0518, val_loss: 0.0225, val_r2: 0.9778, lr: 0.000396, 65.7s
2023-09-04 17:48:20 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [3/50] train_loss: 0.0276, val_loss: 0.0249, val_r2: 0.9756, lr: 0.000388, 77.8s
2023-09-04 17:49:31 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [4/50] train_loss: 0.0196, val_loss: 0.0150, val_r2: 0.9852, lr: 0.000379, 71.6s
2023-09-04 17:50:45 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [5/50] train_loss: 0.0169, val_loss: 0.0158, val_r2: 0.9843, lr: 0.000371, 73.1s
2023-09-04 17:51:53 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [6/50] train_loss: 0.0153, val_loss: 0.0114, val_r2: 0.9888, lr: 0.000363, 68.1s
2023-09-04 17:52:59 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [7/50] train_loss: 0.0131, val_loss: 0.0123, val_r2: 0.9880, lr: 0.000355, 65.7s
2023-09-04 17:54:04 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [8/50] train_loss: 0.0123, val_loss: 0.0099, val_r2: 0.9902, lr: 0.000346, 64.8s
2023-09-04 17:55:10 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [9/50] train_loss: 0.0105, val_loss: 0.0110, val_r2: 0.9891, lr: 0.000338, 64.9s
2023-09-04 17:56:12 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [10/50] train_loss: 0.0101, val_loss: 0.0123, val_r2: 0.9878, lr: 0.000330, 62.7s
2023-09-04 17:57:16 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [11/50] train_loss: 0.0094, val_loss: 0.0116, val_r2: 0.9885, lr: 0.000322, 63.1s
2023-09-04 17:58:18 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [12/50] train_loss: 0.0089, val_loss: 0.0103, val_r2: 0.9899, lr: 0.000313, 62.9s
2023-09-04 17:59:22 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [13/50] train_loss: 0.0080, val_loss: 0.0082, val_r2: 0.9919, lr: 0.000305, 63.6s
2023-09-04 18:00:28 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [14/50] train_loss: 0.0081, val_loss: 0.0089, val_r2: 0.9912, lr: 0.000297, 65.5s
2023-09-04 18:01:31 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [15/50] train_loss: 0.0072, val_loss: 0.0107, val_r2: 0.9894, lr: 0.000289, 63.3s
2023-09-04 18:02:34 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [16/50] train_loss: 0.0068, val_loss: 0.0074, val_r2: 0.9927, lr: 0.000280, 62.6s
2023-09-04 18:03:38 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [17/50] train_loss: 0.0060, val_loss: 0.0069, val_r2: 0.9932, lr: 0.000272, 63.2s
2023-09-04 18:04:45 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [18/50] train_loss: 0.0055, val_loss: 0.0074, val_r2: 0.9927, lr: 0.000264, 66.7s
2023-09-04 18:05:56 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [19/50] train_loss: 0.0054, val_loss: 0.0067, val_r2: 0.9933, lr: 0.000256, 70.5s
2023-09-04 18:06:59 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [20/50] train_loss: 0.0053, val_loss: 0.0072, val_r2: 0.9929, lr: 0.000247, 62.5s
2023-09-04 18:08:01 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [21/50] train_loss: 0.0049, val_loss: 0.0074, val_r2: 0.9927, lr: 0.000239, 62.2s
2023-09-04 18:09:03 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [22/50] train_loss: 0.0044, val_loss: 0.0063, val_r2: 0.9938, lr: 0.000231, 62.6s
2023-09-04 18:10:10 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [23/50] train_loss: 0.0045, val_loss: 0.0072, val_r2: 0.9929, lr: 0.000223, 66.2s
2023-09-04 18:11:14 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [24/50] train_loss: 0.0041, val_loss: 0.0057, val_r2: 0.9943, lr: 0.000214, 64.2s
2023-09-04 18:12:19 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [25/50] train_loss: 0.0043, val_loss: 0.0069, val_r2: 0.9932, lr: 0.000206, 63.9s
2023-09-04 18:13:22 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [26/50] train_loss: 0.0038, val_loss: 0.0057, val_r2: 0.9944, lr: 0.000198, 63.1s
2023-09-04 18:14:27 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [27/50] train_loss: 0.0034, val_loss: 0.0054, val_r2: 0.9946, lr: 0.000190, 64.9s
2023-09-04 18:15:46 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [28/50] train_loss: 0.0034, val_loss: 0.0060, val_r2: 0.9941, lr: 0.000181, 78.0s
2023-09-04 18:17:04 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [29/50] train_loss: 0.0032, val_loss: 0.0054, val_r2: 0.9947, lr: 0.000173, 77.9s
2023-09-04 18:18:17 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [30/50] train_loss: 0.0029, val_loss: 0.0053, val_r2: 0.9947, lr: 0.000165, 72.7s
2023-09-04 18:19:21 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [31/50] train_loss: 0.0030, val_loss: 0.0053, val_r2: 0.9948, lr: 0.000157, 63.4s
2023-09-04 18:20:27 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [32/50] train_loss: 0.0026, val_loss: 0.0050, val_r2: 0.9951, lr: 0.000148, 64.5s
2023-09-04 18:21:32 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [33/50] train_loss: 0.0024, val_loss: 0.0053, val_r2: 0.9948, lr: 0.000140, 64.2s
2023-09-04 18:22:35 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [34/50] train_loss: 0.0025, val_loss: 0.0047, val_r2: 0.9954, lr: 0.000132, 63.0s
2023-09-04 18:23:42 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [35/50] train_loss: 0.0023, val_loss: 0.0047, val_r2: 0.9954, lr: 0.000124, 67.0s
2023-09-04 18:24:47 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [36/50] train_loss: 0.0022, val_loss: 0.0046, val_r2: 0.9954, lr: 0.000115, 64.3s
2023-09-04 18:25:58 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [37/50] train_loss: 0.0020, val_loss: 0.0045, val_r2: 0.9956, lr: 0.000107, 70.8s
2023-09-04 18:27:01 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [38/50] train_loss: 0.0020, val_loss: 0.0046, val_r2: 0.9955, lr: 0.000099, 62.5s
2023-09-04 18:28:05 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [39/50] train_loss: 0.0018, val_loss: 0.0046, val_r2: 0.9955, lr: 0.000091, 63.7s
2023-09-04 18:29:10 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [40/50] train_loss: 0.0018, val_loss: 0.0047, val_r2: 0.9953, lr: 0.000082, 64.7s
2023-09-04 18:30:12 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [41/50] train_loss: 0.0018, val_loss: 0.0043, val_r2: 0.9958, lr: 0.000074, 62.3s
2023-09-04 18:31:15 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [42/50] train_loss: 0.0017, val_loss: 0.0045, val_r2: 0.9956, lr: 0.000066, 62.5s
2023-09-04 18:32:19 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [43/50] train_loss: 0.0016, val_loss: 0.0043, val_r2: 0.9957, lr: 0.000058, 64.3s
2023-09-04 18:33:24 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [44/50] train_loss: 0.0016, val_loss: 0.0043, val_r2: 0.9958, lr: 0.000049, 65.1s
2023-09-04 18:34:29 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [45/50] train_loss: 0.0017, val_loss: 0.0043, val_r2: 0.9957, lr: 0.000041, 64.3s
2023-09-04 18:35:36 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [46/50] train_loss: 0.0014, val_loss: 0.0042, val_r2: 0.9958, lr: 0.000033, 67.2s
2023-09-04 18:36:47 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [47/50] train_loss: 0.0013, val_loss: 0.0044, val_r2: 0.9957, lr: 0.000025, 69.9s
2023-09-04 18:38:05 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [48/50] train_loss: 0.0013, val_loss: 0.0042, val_r2: 0.9958, lr: 0.000016, 78.2s
2023-09-04 18:39:19 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [49/50] train_loss: 0.0014, val_loss: 0.0042, val_r2: 0.9959, lr: 0.000008, 73.7s
2023-09-04 18:40:22 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [50/50] train_loss: 0.0013, val_loss: 0.0042, val_r2: 0.9959, lr: 0.000000, 62.9s
2023-09-04 18:40:23 | unimol/tasks/trainer.py | 213 | INFO | Uni-Mol(QSAR) | load model success!
2023-09-04 18:40:28 | unimol/models/nnmodel.py | 129 | INFO | Uni-Mol(QSAR) | fold 2, result {'r2': 0.9959009040119442, 'mae': 0.058838677, 'pearsonr': 0.9979535268752111, 'spearmanr': 0.9973975017714561, 'mse': 0.007119618}
2023-09-04 18:40:29 | unimol/models/unimol.py | 114 | INFO | Uni-Mol(QSAR) | Loading pretrained weights from /opt/conda/lib/python3.8/site-packages/unimol-0.0.2-py3.8.egg/unimol/weights/mol_pre_all_h_220816.pt
2023-09-04 18:41:33 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [1/50] train_loss: 0.1751, val_loss: 0.0821, val_r2: 0.9176, lr: 0.000267, 64.2s
2023-09-04 18:42:36 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [2/50] train_loss: 0.0520, val_loss: 0.0254, val_r2: 0.9746, lr: 0.000396, 62.4s
2023-09-04 18:43:42 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [3/50] train_loss: 0.0273, val_loss: 0.0234, val_r2: 0.9765, lr: 0.000388, 64.9s
2023-09-04 18:44:53 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [4/50] train_loss: 0.0211, val_loss: 0.0153, val_r2: 0.9847, lr: 0.000379, 71.2s
2023-09-04 18:46:04 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [5/50] train_loss: 0.0181, val_loss: 0.0128, val_r2: 0.9873, lr: 0.000371, 70.1s
2023-09-04 18:47:11 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [6/50] train_loss: 0.0152, val_loss: 0.0138, val_r2: 0.9861, lr: 0.000363, 66.3s
2023-09-04 18:48:15 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [7/50] train_loss: 0.0132, val_loss: 0.0132, val_r2: 0.9868, lr: 0.000355, 64.3s
2023-09-04 18:49:19 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [8/50] train_loss: 0.0130, val_loss: 0.0111, val_r2: 0.9889, lr: 0.000346, 64.0s
2023-09-04 18:50:27 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [9/50] train_loss: 0.0123, val_loss: 0.0120, val_r2: 0.9881, lr: 0.000338, 66.6s
2023-09-04 18:51:32 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [10/50] train_loss: 0.0108, val_loss: 0.0095, val_r2: 0.9904, lr: 0.000330, 65.3s
2023-09-04 18:52:35 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [11/50] train_loss: 0.0097, val_loss: 0.0084, val_r2: 0.9916, lr: 0.000322, 62.6s
2023-09-04 18:53:38 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [12/50] train_loss: 0.0087, val_loss: 0.0084, val_r2: 0.9916, lr: 0.000313, 62.6s
2023-09-04 18:54:42 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [13/50] train_loss: 0.0086, val_loss: 0.0099, val_r2: 0.9901, lr: 0.000305, 62.7s
2023-09-04 18:55:47 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [14/50] train_loss: 0.0076, val_loss: 0.0084, val_r2: 0.9916, lr: 0.000297, 65.1s
2023-09-04 18:56:52 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [15/50] train_loss: 0.0076, val_loss: 0.0079, val_r2: 0.9921, lr: 0.000289, 64.3s
2023-09-04 18:58:07 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [16/50] train_loss: 0.0068, val_loss: 0.0074, val_r2: 0.9926, lr: 0.000280, 74.5s
2023-09-04 18:59:26 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [17/50] train_loss: 0.0062, val_loss: 0.0077, val_r2: 0.9923, lr: 0.000272, 78.4s
2023-09-04 19:00:44 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [18/50] train_loss: 0.0060, val_loss: 0.0068, val_r2: 0.9931, lr: 0.000264, 78.2s
2023-09-04 19:02:03 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [19/50] train_loss: 0.0060, val_loss: 0.0065, val_r2: 0.9935, lr: 0.000256, 78.1s
2023-09-04 19:03:12 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [20/50] train_loss: 0.0056, val_loss: 0.0081, val_r2: 0.9919, lr: 0.000247, 67.9s
2023-09-04 19:04:17 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [21/50] train_loss: 0.0047, val_loss: 0.0073, val_r2: 0.9926, lr: 0.000239, 65.1s
2023-09-04 19:05:20 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [22/50] train_loss: 0.0053, val_loss: 0.0075, val_r2: 0.9924, lr: 0.000231, 63.3s
2023-09-04 19:06:23 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [23/50] train_loss: 0.0046, val_loss: 0.0060, val_r2: 0.9940, lr: 0.000223, 63.3s
2023-09-04 19:07:29 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [24/50] train_loss: 0.0040, val_loss: 0.0057, val_r2: 0.9943, lr: 0.000214, 65.0s
2023-09-04 19:08:36 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [25/50] train_loss: 0.0038, val_loss: 0.0068, val_r2: 0.9931, lr: 0.000206, 65.9s
2023-09-04 19:09:42 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [26/50] train_loss: 0.0039, val_loss: 0.0056, val_r2: 0.9944, lr: 0.000198, 66.0s
2023-09-04 19:10:49 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [27/50] train_loss: 0.0034, val_loss: 0.0055, val_r2: 0.9944, lr: 0.000190, 65.6s
2023-09-04 19:11:56 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [28/50] train_loss: 0.0035, val_loss: 0.0064, val_r2: 0.9936, lr: 0.000181, 66.5s
2023-09-04 19:12:58 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [29/50] train_loss: 0.0033, val_loss: 0.0067, val_r2: 0.9933, lr: 0.000173, 62.4s
2023-09-04 19:14:03 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [30/50] train_loss: 0.0031, val_loss: 0.0053, val_r2: 0.9947, lr: 0.000165, 64.5s
2023-09-04 19:15:07 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [31/50] train_loss: 0.0029, val_loss: 0.0048, val_r2: 0.9952, lr: 0.000157, 63.0s
2023-09-04 19:16:11 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [32/50] train_loss: 0.0027, val_loss: 0.0050, val_r2: 0.9950, lr: 0.000148, 63.7s
2023-09-04 19:17:29 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [33/50] train_loss: 0.0025, val_loss: 0.0050, val_r2: 0.9950, lr: 0.000140, 77.8s
2023-09-04 19:18:42 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [34/50] train_loss: 0.0026, val_loss: 0.0055, val_r2: 0.9945, lr: 0.000132, 72.9s
2023-09-04 19:19:55 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [35/50] train_loss: 0.0024, val_loss: 0.0048, val_r2: 0.9952, lr: 0.000124, 73.3s
2023-09-04 19:21:05 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [36/50] train_loss: 0.0023, val_loss: 0.0054, val_r2: 0.9946, lr: 0.000115, 70.1s
2023-09-04 19:22:11 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [37/50] train_loss: 0.0022, val_loss: 0.0046, val_r2: 0.9953, lr: 0.000107, 65.7s
2023-09-04 19:23:16 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [38/50] train_loss: 0.0021, val_loss: 0.0051, val_r2: 0.9949, lr: 0.000099, 65.0s
2023-09-04 19:24:25 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [39/50] train_loss: 0.0020, val_loss: 0.0047, val_r2: 0.9952, lr: 0.000091, 68.9s
2023-09-04 19:25:33 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [40/50] train_loss: 0.0021, val_loss: 0.0046, val_r2: 0.9954, lr: 0.000082, 67.2s
2023-09-04 19:26:39 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [41/50] train_loss: 0.0018, val_loss: 0.0050, val_r2: 0.9950, lr: 0.000074, 65.2s
2023-09-04 19:27:44 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [42/50] train_loss: 0.0017, val_loss: 0.0046, val_r2: 0.9953, lr: 0.000066, 65.2s
2023-09-04 19:28:50 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [43/50] train_loss: 0.0016, val_loss: 0.0043, val_r2: 0.9957, lr: 0.000058, 66.1s
2023-09-04 19:29:54 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [44/50] train_loss: 0.0016, val_loss: 0.0043, val_r2: 0.9957, lr: 0.000049, 63.2s
2023-09-04 19:31:00 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [45/50] train_loss: 0.0015, val_loss: 0.0044, val_r2: 0.9956, lr: 0.000041, 66.3s
2023-09-04 19:32:06 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [46/50] train_loss: 0.0016, val_loss: 0.0047, val_r2: 0.9953, lr: 0.000033, 65.5s
2023-09-04 19:33:12 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [47/50] train_loss: 0.0014, val_loss: 0.0047, val_r2: 0.9953, lr: 0.000025, 66.2s
2023-09-04 19:34:19 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [48/50] train_loss: 0.0013, val_loss: 0.0045, val_r2: 0.9954, lr: 0.000016, 66.8s
2023-09-04 19:35:24 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [49/50] train_loss: 0.0013, val_loss: 0.0042, val_r2: 0.9958, lr: 0.000008, 65.2s
2023-09-04 19:36:28 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [50/50] train_loss: 0.0013, val_loss: 0.0043, val_r2: 0.9957, lr: 0.000000, 64.0s
2023-09-04 19:36:30 | unimol/tasks/trainer.py | 213 | INFO | Uni-Mol(QSAR) | load model success!
2023-09-04 19:36:35 | unimol/models/nnmodel.py | 129 | INFO | Uni-Mol(QSAR) | fold 3, result {'r2': 0.9957527174453936, 'mae': 0.059466276, 'pearsonr': 0.9979272804072913, 'spearmanr': 0.9974385157147599, 'mse': 0.007279518}
2023-09-04 19:36:35 | unimol/models/unimol.py | 114 | INFO | Uni-Mol(QSAR) | Loading pretrained weights from /opt/conda/lib/python3.8/site-packages/unimol-0.0.2-py3.8.egg/unimol/weights/mol_pre_all_h_220816.pt
2023-09-04 19:37:41 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [1/50] train_loss: 0.1902, val_loss: 0.1165, val_r2: 0.8797, lr: 0.000267, 65.1s
2023-09-04 19:38:48 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [2/50] train_loss: 0.0543, val_loss: 0.0351, val_r2: 0.9634, lr: 0.000396, 66.5s
2023-09-04 19:39:52 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [3/50] train_loss: 0.0259, val_loss: 0.0187, val_r2: 0.9806, lr: 0.000388, 63.4s
2023-09-04 19:40:57 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [4/50] train_loss: 0.0194, val_loss: 0.0160, val_r2: 0.9834, lr: 0.000379, 63.8s
2023-09-04 19:42:02 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [5/50] train_loss: 0.0176, val_loss: 0.0225, val_r2: 0.9766, lr: 0.000371, 64.2s
2023-09-04 19:43:07 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [6/50] train_loss: 0.0151, val_loss: 0.0120, val_r2: 0.9876, lr: 0.000363, 65.4s
2023-09-04 19:44:19 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [7/50] train_loss: 0.0133, val_loss: 0.0108, val_r2: 0.9888, lr: 0.000355, 70.9s
2023-09-04 19:45:24 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [8/50] train_loss: 0.0129, val_loss: 0.0108, val_r2: 0.9888, lr: 0.000346, 65.0s
2023-09-04 19:46:31 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [9/50] train_loss: 0.0118, val_loss: 0.0100, val_r2: 0.9896, lr: 0.000338, 66.4s
2023-09-04 19:47:39 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [10/50] train_loss: 0.0100, val_loss: 0.0093, val_r2: 0.9904, lr: 0.000330, 67.6s
2023-09-04 19:48:43 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [11/50] train_loss: 0.0102, val_loss: 0.0106, val_r2: 0.9890, lr: 0.000322, 62.4s
2023-09-04 19:49:46 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [12/50] train_loss: 0.0094, val_loss: 0.0090, val_r2: 0.9907, lr: 0.000313, 62.7s
2023-09-04 19:50:53 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [13/50] train_loss: 0.0081, val_loss: 0.0093, val_r2: 0.9904, lr: 0.000305, 66.8s
2023-09-04 19:51:57 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [14/50] train_loss: 0.0079, val_loss: 0.0080, val_r2: 0.9917, lr: 0.000297, 64.3s
2023-09-04 19:53:04 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [15/50] train_loss: 0.0076, val_loss: 0.0078, val_r2: 0.9919, lr: 0.000289, 65.7s
2023-09-04 19:54:10 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [16/50] train_loss: 0.0068, val_loss: 0.0080, val_r2: 0.9918, lr: 0.000280, 65.2s
2023-09-04 19:55:15 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [17/50] train_loss: 0.0063, val_loss: 0.0078, val_r2: 0.9919, lr: 0.000272, 65.4s
2023-09-04 19:56:19 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [18/50] train_loss: 0.0067, val_loss: 0.0099, val_r2: 0.9898, lr: 0.000264, 62.9s
2023-09-04 19:57:21 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [19/50] train_loss: 0.0055, val_loss: 0.0080, val_r2: 0.9917, lr: 0.000256, 62.7s
2023-09-04 19:58:25 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [20/50] train_loss: 0.0055, val_loss: 0.0064, val_r2: 0.9934, lr: 0.000247, 64.2s
2023-09-04 20:02:46 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [24/50] train_loss: 0.0042, val_loss: 0.0056, val_r2: 0.9941, lr: 0.000214, 65.8s
2023-09-04 20:03:52 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [25/50] train_loss: 0.0040, val_loss: 0.0062, val_r2: 0.9936, lr: 0.000206, 65.2s
val:  14%|█▍        | 22/159 [00:00<00:04, 30.91it/s, Epoch=Epoch 26/50, loss=0.0053]              IOPub message rate exceeded.
The Jupyter server will temporarily stop sending output
to the client in order to avoid crashing it.
To change this limit, set the config variable
`--ServerApp.iopub_msg_rate_limit`.

Current values:
ServerApp.iopub_msg_rate_limit=1000.0 (msgs/sec)
ServerApp.rate_limit_window=3.0 (secs)

2023-09-04 20:07:06 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [28/50] train_loss: 0.0035, val_loss: 0.0053, val_r2: 0.9945, lr: 0.000181, 63.6s
2023-09-04 20:08:09 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [29/50] train_loss: 0.0034, val_loss: 0.0057, val_r2: 0.9941, lr: 0.000173, 62.9s
2023-09-04 20:09:18 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [30/50] train_loss: 0.0031, val_loss: 0.0051, val_r2: 0.9947, lr: 0.000165, 68.4s
2023-09-04 20:10:31 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [31/50] train_loss: 0.0030, val_loss: 0.0049, val_r2: 0.9950, lr: 0.000157, 72.6s
2023-09-04 20:11:42 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [32/50] train_loss: 0.0027, val_loss: 0.0057, val_r2: 0.9941, lr: 0.000148, 70.5s
2023-09-04 20:12:50 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [33/50] train_loss: 0.0032, val_loss: 0.0055, val_r2: 0.9943, lr: 0.000140, 67.8s
2023-09-04 20:13:53 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [34/50] train_loss: 0.0024, val_loss: 0.0048, val_r2: 0.9950, lr: 0.000132, 63.0s
2023-09-04 20:14:58 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [35/50] train_loss: 0.0024, val_loss: 0.0045, val_r2: 0.9953, lr: 0.000124, 64.7s
2023-09-04 20:16:03 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [36/50] train_loss: 0.0023, val_loss: 0.0054, val_r2: 0.9944, lr: 0.000115, 64.3s
2023-09-04 20:17:09 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [37/50] train_loss: 0.0021, val_loss: 0.0045, val_r2: 0.9953, lr: 0.000107, 65.6s
2023-09-04 20:18:15 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [38/50] train_loss: 0.0021, val_loss: 0.0047, val_r2: 0.9951, lr: 0.000099, 66.3s
2023-09-04 20:19:19 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [39/50] train_loss: 0.0021, val_loss: 0.0046, val_r2: 0.9952, lr: 0.000091, 63.6s
2023-09-04 20:20:23 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [40/50] train_loss: 0.0019, val_loss: 0.0051, val_r2: 0.9947, lr: 0.000082, 64.6s
2023-09-04 20:21:36 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [41/50] train_loss: 0.0018, val_loss: 0.0044, val_r2: 0.9955, lr: 0.000074, 72.3s
2023-09-04 20:22:41 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [42/50] train_loss: 0.0017, val_loss: 0.0042, val_r2: 0.9956, lr: 0.000066, 64.7s
2023-09-04 20:23:45 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [43/50] train_loss: 0.0016, val_loss: 0.0045, val_r2: 0.9953, lr: 0.000058, 63.4s
2023-09-04 20:24:49 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [44/50] train_loss: 0.0016, val_loss: 0.0043, val_r2: 0.9955, lr: 0.000049, 64.0s
2023-09-04 20:25:55 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [45/50] train_loss: 0.0016, val_loss: 0.0041, val_r2: 0.9957, lr: 0.000041, 65.8s
2023-09-04 20:27:01 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [46/50] train_loss: 0.0015, val_loss: 0.0042, val_r2: 0.9957, lr: 0.000033, 65.3s
2023-09-04 20:28:04 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [47/50] train_loss: 0.0014, val_loss: 0.0046, val_r2: 0.9953, lr: 0.000025, 63.3s
2023-09-04 20:29:07 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [48/50] train_loss: 0.0014, val_loss: 0.0042, val_r2: 0.9957, lr: 0.000016, 62.8s
2023-09-04 20:30:10 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [49/50] train_loss: 0.0013, val_loss: 0.0042, val_r2: 0.9956, lr: 0.000008, 63.1s
2023-09-04 20:31:21 | unimol/tasks/trainer.py | 169 | INFO | Uni-Mol(QSAR) | Epoch [50/50] train_loss: 0.0013, val_loss: 0.0041, val_r2: 0.9957, lr: 0.000000, 71.6s
2023-09-04 20:31:24 | unimol/tasks/trainer.py | 213 | INFO | Uni-Mol(QSAR) | load model success!
2023-09-04 20:31:29 | unimol/models/nnmodel.py | 129 | INFO | Uni-Mol(QSAR) | fold 4, result {'r2': 0.995722167871576, 'mae': 0.058697157, 'pearsonr': 0.997918921152862, 'spearmanr': 0.9975153439068033, 'mse': 0.007057018}
2023-09-04 20:31:29 | unimol/models/nnmodel.py | 144 | INFO | Uni-Mol(QSAR) | Uni-Mol metrics score: 
{'r2': 0.9958098504114381, 'mae': 0.05926784082913989, 'pearsonr': 0.9979403073106544, 'spearmanr': 0.997427024789587, 'mse': 0.0071642844934711545}
2023-09-04 20:31:29 | unimol/models/nnmodel.py | 145 | INFO | Uni-Mol(QSAR) | Uni-Mol & Metric result saved!
代码
文本

Step3:调参(可跳过)

按照bbbp的教程调参(链接:https://nb.bohrium.dp.tech/detail/1511053944)

最优超参为Lr=0.0004,Batch size=32。

代码
文本
[ ]
lr_ft = [1e-5,1e-4,4e-4,1e-3] # 学习率(们)

for i in range(len(lr_ft)): # 循环输入每个学习率
clf = MolTrain(task='regression',
data_type='molecule',
epochs=60,
batch_size=16,
early_stopping=5,
metrics='r2',
split='random',
save_path='./exp/learning_rate_'+str(lr_ft[i]),
learning_rate= lr_ft[i]
)
clf.fit("./datasets/RedDB_train.csv") # 训练模型

# Load the RedDB_train dataset
df_train = pd.read_csv("/bohr/aorfb-7iz1/v2/RedDB_train.csv")

# Convert the clf.data dict to a DataFrame
clf_data_df = pd.DataFrame({'pred':clf.cv_pred.flatten(),
'SMILES':clf.data['smiles']
})

# Join the datasets on the 'smiles' column
merged_df = pd.merge(df_train, clf_data_df, on='SMILES', how='inner')

# Save the merged data to a csv file, the name of the file will be learning rate + 'RedDB_train_with_predictions.csv'
merged_df.to_csv('./datasets/lr_'+str(lr_ft[i])+'_RedDB_train_with_predictions.csv', index=False)

代码
文本
[ ]
# 获取最低 R2 值对应的学习率
min_r2_lr = lr_ft[r2_ft.index(min(r2_ft))]

bs_ft = [8,16,32,64] # 学习率(们)
for i in range(len(lr_ft)): # 循环输入每个学习率
clf = MolTrain(task='regression',
data_type='molecule',
epochs=60,
batch_size=bs_ft[i],
early_stopping=5,
metrics='r2',
split='random',
save_path='./batch_size'+str(bs_ft[i]),
learning_rate= min_r2_lr # 使用最低 R2 值对应的学习率
)
clf.fit('./RedDB_train.csv') # 训练模型
# Load the RedDB_train dataset
df_train = pd.read_csv("/bohr/aorfb-7iz1/v2/RedDB_train.csv")

# Convert the clf.data dict to a DataFrame
clf_data_df = pd.DataFrame({'pred':clf.cv_pred.flatten(),
'SMILES':clf.data['smiles']
})

# Join the datasets on the 'smiles' column
merged_df = pd.merge(df_train, clf_data_df, on='SMILES', how='inner')

# Save the merged data to a csv file, the name of the file will be learning rate + 'RedDB_train_with_predictions.csv'
merged_df.to_csv('./bs_'+str(bs_ft[i])+'_RedDB_train_with_predictions.csv', index=False)

代码
文本

Step4:读入测试集用于预测溶解度

测试集的数据类型与训练集一致。最佳的训练权重已经提前保存到/bohr/aorfb-7iz1/v2/best_exp中,可以直接运行以下代码。

代码
文本
[2]
clf_ll = MolPredict(load_model='/bohr/aorfb-7iz1/v2/best_exp')
test_pred = clf_ll.predict('/bohr/aorfb-7iz1/v2/RedDB_test.csv')
2023-09-07 13:43:56 | unimol/data/conformer.py | 62 | INFO | Uni-Mol(QSAR) | Start generating conformers...
6324it [00:36, 174.39it/s]
2023-09-07 13:44:32 | unimol/data/conformer.py | 66 | INFO | Uni-Mol(QSAR) | Failed to generate conformers for 0.00% of molecules.
2023-09-07 13:44:32 | unimol/data/conformer.py | 68 | INFO | Uni-Mol(QSAR) | Failed to generate 3d conformers for 0.03% of molecules.
2023-09-07 13:44:33 | unimol/models/unimol.py | 114 | INFO | Uni-Mol(QSAR) | Loading pretrained weights from /opt/conda/lib/python3.8/site-packages/unimol-0.0.2-py3.8.egg/unimol/weights/mol_pre_all_h_220816.pt
2023-09-07 13:44:34 | unimol/models/nnmodel.py | 154 | INFO | Uni-Mol(QSAR) | start predict NNModel:unimolv1
2023-09-07 13:44:37 | unimol/tasks/trainer.py | 213 | INFO | Uni-Mol(QSAR) | load model success!
2023-09-07 13:44:54 | unimol/tasks/trainer.py | 213 | INFO | Uni-Mol(QSAR) | load model success!
2023-09-07 13:45:08 | unimol/tasks/trainer.py | 213 | INFO | Uni-Mol(QSAR) | load model success!
2023-09-07 13:45:23 | unimol/tasks/trainer.py | 213 | INFO | Uni-Mol(QSAR) | load model success!
2023-09-07 13:45:37 | unimol/tasks/trainer.py | 213 | INFO | Uni-Mol(QSAR) | load model success!
2023-09-07 13:45:51 | unimol/predict.py | 66 | INFO | Uni-Mol(QSAR) | final predict metrics score: 
{'r2': 0.996431347888573, 'mae': 0.05341669959421024, 'pearsonr': 0.9982373718024908, 'spearmanr': 0.99800209666078, 'mse': 0.006212046942459196}
代码
文本

Step5:保存训练及测试数据为CSV文件(可跳过)

可以直接采用/bohr/aorfb-7iz1/v2/RedDB_test_with_predictions.csv/bohr/aorfb-7iz1/v2/RedDB_train_with_predictions.csv

代码
文本
[3]
import pandas as pd
import numpy as np

# 加载数据集
df = pd.read_csv('/bohr/aorfb-7iz1/v2/RedDB_test.csv')

# 将 test_pred 数组添加为数据框的新列
df['test_pred'] = test_pred

# 将更新后的数据框保存为新的 CSV 文件
df.to_csv('./RedDB_test_with_predictions.csv', index=False)
代码
文本
[6]
# 将训练集预测结果与原TARGET值保存为csv文件
# 加载 RedDB_train 数据集
df_train = pd.read_csv("/bohr/aorfb-7iz1/v2/RedDB_train.csv")

# 将 clf.data 字典转化为 DataFrame
clf_data_df = pd.DataFrame({'pred':clf.cv_pred.flatten(),
'SMILES':clf.data['smiles']
})

# 通过 'smiles' 列合并数据集
merged_df = pd.merge(df_train, clf_data_df, on='SMILES', how='inner')

# 将合并后的数据框保存为新的 CSV 文件
merged_df.to_csv('./RedDB_train_with_predictions.csv', index=False)
代码
文本

Step6:可视化

通过画出实验值和预测值来可视化我们的模型训练结果,比对测试集的实验值和预测值,

代码
文本
[3]
import pandas as pd
import matplotlib.pyplot as plt

# 从CSV文件中读取数据
# train_data = pd.read_csv("./RedDB_train_with_predictions.csv")
# test_data = pd.read_csv("./RedDB_test_with_predictions.csv")
train_data = pd.read_csv("/bohr/aorfb-7iz1/v2/RedDB_train_with_predictions.csv")
test_data = pd.read_csv("/bohr/aorfb-7iz1/v2/RedDB_test_with_predictions.csv")

# 提取需要的列
y_true_train = train_data['TARGET']
y_predict_train = train_data['pred']

y_true_test = test_data['TARGET']
y_predict_test = test_data['test_pred']

# 创建散点图
plt.figure(figsize=(8, 8))

# train数据集的散点图
plt.scatter(y_true_train, y_predict_train, color='orange', label='Train Set')

# test数据集的散点图
plt.scatter(y_true_test, y_predict_test, color='blue', label='Test Set')

# 设置图例
plt.legend()

plt.xlabel('Actual Target Values of Electroactive Molecules')
plt.ylabel('Predicted Target Values of Electroactive Molecules')
plt.title('Actual vs Predicted Target Values of Electroactive Molecules')

# 设置x和y坐标范围
plt.xlim(-7.5, 7.5)
plt.ylim(-7.5, 7.5)

# 添加y=x的虚线
plt.plot([-7.5, 7.5], [-7.5, 7.5], 'k--')

plt.show()
代码
文本

Step7.基于Uni-Mol的原子向量表征可视化

原理:以下代码的目标是利用UniMolRepr中表示原子信息的高维向量,计算这个向量的L2范数能得到一个单一的数值,这个数值在某种程度上综合了这个原子的所有属性信息。L2范数是一个函数,可以从向量空间中的向量映射到非负实数,用来度量向量的长度或大小,公式如下:

然后,我们进一步利用rdkit中rdMolDraw2D将每个原子权重映射为颜色。

环境配置:注意,镜像首先需要完善环境配置:利用https://www.jianshu.com/p/3152bd92a1b8https://blog.csdn.net/weixin_42696356/article/details/104769746 两篇文章的方法,依次在命令行运行:

sudo apt-get update

sudo apt-get install libxrender-dev 

apt install libxext6

代码方可顺利运行。

代码
文本
[6]
!sudo apt-get update
!sudo apt-get install libxrender-dev -y
!apt install libxext6
Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease                         
Hit:2 http://security.ubuntu.com/ubuntu focal-security InRelease               
Hit:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease          
Hit:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease        
Hit:5 https://deb.nodesource.com/node_18.x focal InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libxrender-dev is already the newest version (1:0.9.10-1).
0 upgraded, 0 newly installed, 0 to remove and 172 not upgraded.
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  libxext6
0 upgraded, 1 newly installed, 0 to remove and 172 not upgraded.
Need to get 29.1 kB of archives.
After this operation, 113 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libxext6 amd64 2:1.3.4-0ubuntu1 [29.1 kB]
Fetched 29.1 kB in 6s (4681 B/s)                                               m
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76, <> line 1.)
debconf: falling back to frontend: Readline

78Selecting previously unselected package libxext6:amd64.
(Reading database ... 37487 files and directories currently installed.)
Preparing to unpack .../libxext6_2%3a1.3.4-0ubuntu1_amd64.deb ...
7Progress: [  0%] [..........................................................] 87Progress: [ 20%] [###########...............................................] 8Unpacking libxext6:amd64 (2:1.3.4-0ubuntu1) ...
7Progress: [ 40%] [#######################...................................] 8Setting up libxext6:amd64 (2:1.3.4-0ubuntu1) ...
7Progress: [ 60%] [##################################........................] 87Progress: [ 80%] [##############################################............] 8Processing triggers for libc-bin (2.31-0ubuntu9.7) ...
/sbin/ldconfig.real: File /lib/x86_64-linux-gnu/libcuda.so.525.89.02 is empty, not checked.
/sbin/ldconfig.real: File /lib/x86_64-linux-gnu/libnvidia-nvvm.so.525.89.02 is empty, not checked.
/sbin/ldconfig.real: File /lib/x86_64-linux-gnu/libnvcuvid.so.525.89.02 is empty, not checked.
/sbin/ldconfig.real: File /lib/x86_64-linux-gnu/libnvidia-cfg.so.525.89.02 is empty, not checked.
/sbin/ldconfig.real: File /lib/x86_64-linux-gnu/libnvidia-opencl.so.525.89.02 is empty, not checked.
/sbin/ldconfig.real: File /lib/x86_64-linux-gnu/libnvidia-allocator.so.525.89.02 is empty, not checked.
/sbin/ldconfig.real: File /lib/x86_64-linux-gnu/libnvidia-ml.so.525.89.02 is empty, not checked.
/sbin/ldconfig.real: File /lib/x86_64-linux-gnu/libnvidia-encode.so.525.89.02 is empty, not checked.
/sbin/ldconfig.real: File /lib/x86_64-linux-gnu/libnvidia-opticalflow.so.525.89.02 is empty, not checked.
/sbin/ldconfig.real: File /lib/x86_64-linux-gnu/libcudadebugger.so.1 is empty, not checked.
/sbin/ldconfig.real: File /lib/x86_64-linux-gnu/libnvidia-nvvm.so.4 is empty, not checked.
/sbin/ldconfig.real: File /lib/x86_64-linux-gnu/libcudadebugger.so.525.89.02 is empty, not checked.
/sbin/ldconfig.real: File /lib/x86_64-linux-gnu/libnvidia-ptxjitcompiler.so.525.89.02 is empty, not checked.
/sbin/ldconfig.real: File /lib/x86_64-linux-gnu/libvdpau_nvidia.so.525.89.02 is empty, not checked.
/sbin/ldconfig.real: File /lib/x86_64-linux-gnu/libnvidia-compiler.so.525.89.02 is empty, not checked.

78
代码
文本
[7]
# 1)导入必要的库
import torch as th
from unimol import UniMolRepr
import pandas as pd
from rdkit import Chem
from rdkit.Chem import Draw,rdMolDescriptors
from rdkit.Chem.Draw import SimilarityMaps,rdMolDraw2D
from matplotlib import cm
import matplotlib.pyplot as plt
import numpy as np
import os
import io
import torch.nn as nn
from PIL import Image as PILImage
from matplotlib.colorbar import ColorbarBase
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure

# 2)定义一个画原子的函数,数据路径作为输入
def draw_atom(data_path):
# 读取CSV数据,取出SMILES列的值
data = pd.read_csv(data_path,header=0)
smiles = data.SMILES.values.tolist()
# 实例化UniMolRepr对象
clf = UniMolRepr(data_type='molecule')
# 获取SMILES的分子表示
reprs = clf.get_repr(smiles)
# 获取原子表示
atomic_reprs = reprs['atomic_reprs']
# 计算每个原子表示的范数作为权重
atomic_weights = [th.norm(th.tensor(x), dim=1) for x in reprs["atomic_reprs"]]
# 将SMILES转换为分子对象
mols = [Chem.MolFromSmiles(smi) for smi in smiles]
# 创建一个Softmax对象
soft = nn.Softmax()
# 对于每个分子,按照原子权重绘制彩色的分子图像
for i, mol in enumerate(mols):
# 获取原子的权重,并将它们转换为0-1范围的值,以便后续转换为颜色
weights = atomic_weights[i]
weights = soft(weights).numpy().tolist()
# 创建一个原子到颜色的映射,*10000是为了所有的颜色都集中在plasma颜色映射的某一小部分范围内,造成颜色的差异不大,难以分辨;
# 通过乘以一个较大的缩放因子,可以把这些权重值分散到更大的范围内,从而使得颜色的差异更加明显。
atom_colors = {j: cm.plasma(weights[j]*10000) for j in range(mol.GetNumAtoms())}
# 使用rdkit库的函数绘制分子图像
d = rdMolDraw2D.MolDraw2DCairo(500, 500)
rdMolDraw2D.PrepareAndDrawMolecule(d, mol, highlightAtoms=range(mol.GetNumAtoms()),
highlightAtomColors=atom_colors)
d.FinishDrawing()
# 将绘制的图像转换为PNG数据
png_data = d.GetDrawingText()
stream = io.BytesIO(png_data)
# 使用PIL库打开图像数据并保存
image = PILImage.open(stream)
image.save(f'molecule_{i}.png')
# 生成并保存颜色条图像
fig, ax = plt.subplots(figsize=(0.15, 3.5))
plt.subplots_adjust(left=0.5, right=2)
norm = plt.Normalize(vmin=0, vmax=1)
cmap = cm.plasma
cb = ColorbarBase(ax, cmap=cmap, norm=norm, orientation='vertical')
cb.set_ticks([0, 1])
cb.set_ticklabels(['Low', 'High'])
for label in cb.ax.get_yticklabels():
label.set_family('sans-serif')
label.set_fontsize(15)
plt.savefig(f'colorbar_{i}.png', bbox_inches='tight')
plt.close(fig)

# 打开分子图像和颜色条图像
mol_image = PILImage.open(f'molecule_{i}.png')
cb_image = PILImage.open(f'colorbar_{i}.png')

# 裁剪分子图像以移除顶部的空白
bbox = mol_image.getbbox()
mol_image_cropped = mol_image.crop(bbox)
# 将裁剪后的分子图像和颜色条合并
combined = PILImage.new('RGBA', (mol_image_cropped.width + cb_image.width, max(mol_image_cropped.height, cb_image.height)))
combined.paste(mol_image_cropped, (0, 0))
combined.paste(cb_image, (mol_image_cropped.width, (mol_image_cropped.height - cb_image.height) // 2))

# 保存合并后的图像
combined.save(f'combined_{i}.png')

# 显示合并后的图像
display(combined)

# 在主函数中运行画原子的函数
if __name__ == "__main__":
data_path = "/bohr/aorfb-7iz1/v2/RedDB_small.csv"
draw_atom(data_path)
代码
文本

Step8:结果与讨论

从以上结果分析看到,Uni-Mol拟合效果良好,R2在0.996以上,说明Uni-Mol能够通过smiles文本数据较好地预测有机电活性分子的溶解度。进一步结合可视化分子图对官能团的种类、键合的位置和数量对原子权重的影响进行分析。发现Uni-Mol对于亲水性官能团如—OH、—NH2、—COOH 和 —SO3H等赋予的权重值相对较低。更为有趣的是,即便是相同类型的官能团,其在不同键合位置上的权重值也会有所不同。

代码
文本

参考文献

[1]Fei Ai, Zengyue Wang, Nien-Chu Lai,, et al. Heteropoly acid negolytes for high-power-density aqueous redox flow batteries at low temperatures, 2022, Nature Energy

[2]Hu B, DeBruler C, Rhodes Z, et al. Long-Cycling Aqueous Organic Redox Flow Battery (AORFB) toward Sustainable and Safe Energy Storage. 2017, Journal of the American Chemical Society.

[3]Sorkun, E., Zhang, Q., Khetan, A. et al. RedDB, a computational database of electroactive molecules for aqueous redox flow batteries. Sci Data 9, 718 (2022).

[4]Sorkun, M. C., Koelman, J. V. A. & Er, S. Pushing the limits of solubility prediction via quality-oriented data selection. iScience 24, 101961 (2021).

[5]Sorkun, M. C., Khetan, A. & Er, S. Aqsoldb, a curated reference set of aqueous solubility and 2d descriptors for a diverse set of compounds. Scientific data 6, 1–8 (2019).

[6]Huuskonen, J. Estimation of aqueous solubility for a diverse set of organic compounds based on molecular topology. Journal of Chemical Information and Computer Sciences 40, 773–777 (2000).

代码
文本
AI4S经验分享
Uni-Mol
Hackathon
AI4S经验分享Uni-MolHackathon
已赞9
本文被以下合集收录
电解液案例
Piloteye
更新于 2024-10-25
4 篇5 人关注
unimol
aki
更新于 2024-01-29
3 篇2 人关注
推荐阅读
公开
Uni-Mol Predicts Solubility of Flow Battery
Uni-Mol
Uni-Mol
Yani Guan
更新于 2024-10-18
公开
AI+电芯 | 基于LSTM模型和脉冲电信号的电芯EIS预测
AI4SEISAI4SCUP-EIS
AI4SEISAI4SCUP-EIS
JiaweiMiao
发布于 2023-10-22
5 赞40 转存文件
{/**/}