🚀 GP-MoLFormer-Uniq
GP-MoLFormer是一類在來自ZINC和PubChem的0.65 - 11億個分子的SMILES字符串表示上進行預訓練的模型。本倉庫中的模型是在這兩個數據集中所有“唯一”分子上進行預訓練的。
🚀 快速開始
使用以下代碼開始使用該模型:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("ibm-research/GP-MoLFormer-Uniq", trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained("ibm-research/MoLFormer-XL-both-10pct", trust_remote_code=True)
outputs = model.generate(do_sample=True, top_k=None, max_length=202, num_return_sequences=3)
tokenizer.batch_decode(outputs, skip_special_tokens=True)
✨ 主要特性
- GP-MoLFormer是一個大規模自迴歸化學語言模型,旨在用於分子生成任務。
- 採用與MoLFormer - XL相同的架構,包括線性注意力和旋轉位置嵌入,但使用僅解碼器的Transformer塊,並通過因果語言建模目標進行訓練。
- 可用於無條件的從頭分子生成,也可以使用部分SMILES字符串進行支架完成/修飾。
- 可以在特定數據集上進行微調,以改變輸出分佈(例如,生成更具藥物特性的分子),或使用“配對微調”進行分子優化。
📦 安裝指南
文檔未提及安裝步驟,故跳過該章節。
💻 使用示例
基礎用法
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("ibm-research/GP-MoLFormer-Uniq", trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained("ibm-research/MoLFormer-XL-both-10pct", trust_remote_code=True)
outputs = model.generate(do_sample=True, top_k=None, max_length=202, num_return_sequences=3)
tokenizer.batch_decode(outputs, skip_special_tokens=True)
📚 詳細文檔
模型詳情
GP-MoLFormer是一個大規模自迴歸化學語言模型,用於分子生成任務。它採用與MoLFormer - XL相同的架構,包括線性注意力和旋轉位置嵌入,使用僅解碼器的Transformer塊,並通過因果語言建模目標進行訓練。該模型在多達11億個SMILES表示的分子上進行訓練,並在從頭生成(大規模)、支架約束脩飾和分子屬性優化任務上進行了評估。
預期用途和限制
- 預訓練模型可直接用於無條件的從頭分子生成。
- 可以使用部分SMILES字符串進行支架完成/修飾。
- 可以在特定數據集上進行微調,以改變輸出分佈(例如,生成更具藥物特性的分子),或使用“配對微調”進行分子優化。
- 該模型未測試分類性能,也未測試大於約200個原子的分子(即大分子)。此外,使用無效或非規範的SMILES可能會導致性能下降。
訓練詳情
數據
我們在ZINC15和PubChem數據集的分子組合上訓練了GP-MoLFormer。本倉庫包含在兩個數據集中所有“唯一”分子上訓練的版本。在訓練前,使用RDKit對分子進行規範化處理,並去除異構體信息。此外,長度超過202個標記的分子被丟棄。
硬件
- 16 x NVIDIA A100 80GB GPU
評估
我們在各種生成指標上評估了GP-MoLFormer。下表顯示了GP-MoLFormer - Uniq與基線模型的性能比較:
|
有效性↑ |
10k唯一率↑ |
新穎性↑ |
片段率↑ |
支架率↑ |
SNN↑ |
內部多樣性↑ |
FCD↓ |
CharRNN |
0.975 |
0.999 |
0.842 |
0.9998 |
0.9242 |
0.6015 |
0.8562 |
0.0732 |
VAE |
0.977 |
0.998 |
0.695 |
0.9984 |
0.9386 |
0.6257 |
0.8558 |
0.0990 |
JT - VAE |
1.000 |
1.000 |
0.914 |
0.9965 |
0.8964 |
0.5477 |
0.8551 |
0.3954 |
LIMO |
1.000 |
0.976 |
1.000 |
0.6989 |
0.0079 |
0.2464 |
0.9039 |
26.78 |
MolGen - 7B |
1.000 |
1.000 |
0.934 |
0.9999 |
0.6538 |
0.5138 |
0.8617 |
0.0435 |
GP - MoLFormer - Uniq |
1.000 |
0.977 |
0.390 |
0.9998 |
0.7383 |
0.5045 |
0.8655 |
0.0591 |
我們使用典型的MOSES定義在每個模型的各自測試集上報告所有指標。注意:新穎性是相對於每個模型的各自訓練集而言的。
🔧 技術細節
數據
訓練數據來自ZINC15和PubChem數據集的分子組合。在訓練前,使用RDKit對分子進行規範化處理,去除異構體信息,並丟棄長度超過202個標記的分子。
硬件
使用16 x NVIDIA A100 80GB GPU進行訓練。
📄 許可證
本項目採用Apache - 2.0許可證。
引用
@misc{ross2025gpmolformerfoundationmodelmolecular,
title={GP-MoLFormer: A Foundation Model For Molecular Generation},
author={Jerret Ross and Brian Belgodere and Samuel C. Hoffman and Vijil Chenthamarakshan and Jiri Navratil and Youssef Mroueh and Payel Das},
year={2025},
eprint={2405.04912},
archivePrefix={arXiv},
primaryClass={q-bio.BM},
url={https://arxiv.org/abs/2405.04912},
}