Introduction to IBM's Foundation Models for Materials
Welcome to IBM's series of large foundation models for sustainable materials. Our models span a variety of representations and modalities, including SMILES, SELFIES, 3D atom positions, 3D density grids, molecular graphs, and other formats. These models are designed to support and advance research in materials science and chemistry.
This repository provides PyTorch source code associated with our publication, "A Large Encoder-Decoder Family of Foundation Models for Chemical Language".
We present a large encoder-decoder chemical foundation model, SMILES-based Transformer Encoder-Decoder (SMI-TED), pre-trained on a curated dataset of 91 million SMILES samples sourced from PubChem, equivalent to 4 billion molecular tokens. SMI-TED supports various complex tasks, including quantum property prediction, with two main variants (289M and 8X289M). Our experiments across multiple benchmark datasets demonstrate state-of-the-art performance for various tasks. For more information contact:
[email protected]
or
[email protected]
.
This code and environment have been tested on Nvidia V100s and Nvidia A100s
Pretrained Models and Training Logs
We provide checkpoints of the SMI-TED model pre-trained on a dataset of ~91M molecules curated from PubChem. The pre-trained model shows competitive performance on classification and regression benchmarks from MoleculeNet.
Add the SMI-TED
pre-trained weights.pt
to the
inference/
or
finetune/
directory according to your needs. The directory structure should look like the following:
For pretraining, we use two strategies: the masked language model method to train the encoder part and an encoder-decoder strategy to refine SMILES reconstruction and improve the generated latent space.
SMI-TED is pre-trained on canonicalized and curated 91M SMILES from PubChem with the following constraints:
Compounds are filtered to a maximum length of 202 tokens during preprocessing.
A 95/5/0 split is used for encoder training, with 5% of the data for decoder pretraining.
A 100/0/0 split is also used to train the encoder and decoder directly, enhancing model performance.
The pretraining code provides examples of data processing and model training on a smaller dataset, requiring 8 A100 GPUs.
To pre-train the two variants of the SMI-TED model, run:
bash training/run_model_light_training.sh
or
bash training/run_model_large_training.sh
Use
train_model_D.py
to train only the decoder or
train_model_ED.py
to train both the encoder and decoder.
Finetuning
The finetuning datasets and environment can be found in the
finetune
directory. After setting up the environment, you can run a finetuning task with:
Finetuning training/checkpointing resources will be available in directories named
checkpoint_<measure_name>
.
Feature Extraction
The example notebook
smi_ted_encoder_decoder_example.ipynb
contains code to load checkpoint files and use the pre-trained model for encoder and decoder tasks. It also includes examples of classification and regression tasks.
To load smi-ted, you can simply use:
model = load_smi_ted(
folder='../inference/smi_ted_light',
ckpt_filename='smi_ted_light.pt'
)
or
withopen('model_weights.bin', 'rb') as f:
state_dict = torch.load(f)
model.load_state_dict(state_dict)
)
To encode SMILES into embeddings, you can use:
with torch.no_grad():
encoded_embeddings = model.encode(df['SMILES'], return_torch=True)
For decoder, you can use the function, so you can return from embeddings to SMILES strings:
with torch.no_grad():
decoded_smiles = model.decode(encoded_embeddings)
Citations
@misc{soares2024largeencoderdecoderfamilyfoundation,
title={A Large Encoder-Decoder Family of Foundation Models For Chemical Language},
author={Eduardo Soares and Victor Shirasuna and Emilio Vital Brazil and Renato Cerqueira and Dmitry Zubarev and Kristin Schmidt},
year={2024},
eprint={2407.20267},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2407.20267},
}
Runs of ibm materials.smi-ted on huggingface.co
52.7K
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs
More Information About materials.smi-ted huggingface.co Model
materials.smi-ted huggingface.co is an AI model on huggingface.co that provides materials.smi-ted's model effect (), which can be used instantly with this ibm materials.smi-ted model. huggingface.co supports a free trial of the materials.smi-ted model, and also provides paid use of the materials.smi-ted. Support call materials.smi-ted model through api, including Node.js, Python, http.
materials.smi-ted huggingface.co is an online trial and call api platform, which integrates materials.smi-ted's modeling effects, including api services, and provides a free online trial of materials.smi-ted, you can try materials.smi-ted online for free by clicking the link below.
ibm materials.smi-ted online free url in huggingface.co:
materials.smi-ted is an open source model from GitHub that offers a free installation service, and any user can find materials.smi-ted on GitHub to install. At the same time, huggingface.co provides the effect of materials.smi-ted install, users can directly use materials.smi-ted installed effect in huggingface.co for debugging and trial. It also supports api for free installation.