Practical overview
When it fits
Use it when you want an implementation to experiment with molecular graph inputs in PyTorch or to study transformer behavior on graph-structured data.
Who it is for
- Researchers prototyping transformer approaches to molecular machine learning.
- Developers exploring graph-structured inputs with PyTorch.
- Learners studying transformer limitations and attention mechanisms for molecular data.
Documented uses
- Create a MAT model with configurable dimensions, depth and attention weights.
- Provide atom features, a mask, adjacency and distance matrices to obtain a model output tensor.
- Explore how graph, distance and self-attention contributions interact in a molecular transformer.
Requirements & limits
The repository documents installation through pip and lists an MIT license.
- The model expects atom features, a mask, adjacency matrices and distance matrices as separate inputs.
- The documented configuration exposes relative weights for adjacency, distance and ordinary self-attention.
- The author describes the implementation as work in progress and notes that tuning these weights may be needed for good results.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Install the library and prepare a MAT example
Set up the documented Python import and shape the model inputs shown in the README.
Before you start
- Python environment with pip
- PyTorch
- Atom features, a mask, an adjacency matrix and a distance matrix
Steps
Install the package with the command below.
pip install molecule-attention-transformerImport
torchandMATfrommolecule_attention_transformer.Construct a MAT model by specifying input, model and output dimensions, depth, attention weights and a distance kernel.
Prepare atom, mask, adjacency and distance tensors, then pass them to the model as shown in the usage example.
Expected outcome
The documented example produces an output tensor with shape `(2, 1)` from a batch of two molecular inputs.
Guide limitations
- The repository describes the implementation as work in progress.
- The example does not document how to prepare real molecular data or evaluate predictions.
- The README notes that good results may require hyperparameter sweeps over distance, adjacency and self-attention weights.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 18 October 2026
- Original website title
- lucidrains/molecule-attention-transformer · Official homepage title · retained in its source language

