UMA
Model Introduction
UMA (Universal Materials Interaction Model) is a general-purpose machine-learning interatomic potential for materials and catalytic systems. Built on an equivariant graph neural network, it predicts the energies and forces of atomic structures.
Model Description
UMA uses an equivariant graph neural network architecture trained on multiple materials and catalysis datasets, including OC20, OC22, OC25, OMat, OMOL, ODAC, and OMC. It supports energy and force prediction and structure optimization for catalytic adsorption, inorganic materials, molecular systems, and MOFs.
Use Cases
| Use case | Description |
|---|---|
| OC20 energy/force fine-tuning | Read OC20 fine-tuning data with the standard configuration and train a UMA model |
| OC22 oxide-catalysis fine-tuning | Fine-tune on OC22 with the standard configuration (1P2 only) |
| OC25 (electro)catalysis fine-tuning | Fine-tune on OC25 with the standard configuration (1P2 only) |
| OMat inorganic-material fine-tuning | Fine-tune on OMat with the standard configuration |
| OMOL molecule/polymer fine-tuning | Fine-tune on OMOL with the standard configuration |
| ODAC MOF fine-tuning | Fine-tune on ODAC with the standard configuration |
| OMC molecular-crystal fine-tuning | Fine-tune on OMC with the standard configuration |
| Training preflight | Check configurations, data paths, run scripts, and checkpoint locations |
| Catalytic adsorption modeling | Use OC20/OC22/OC25 tasks as references for training and inference on adsorption and catalytic-surface systems |
| Inference-script reference | Adapt upstream examples for crystal relaxation, adsorption-system relaxation, or molecular MD |
| Custom data migration | Convert ASE-readable structures into UMA fine-tuning data, then replace the training and validation paths |
Usage
1. Using OneCode
Try intelligent, one-click AI4S programming in the OneCode online environment:
Try intelligent, one-click AI4S programming
2. Manual Installation and Usage
Hardware requirements
- A GPU or DCU is recommended for fine-tuning.
- A CPU can be used to check configurations and data paths, but is not recommended for production UMA training.
- DCU users must install DTK in advance. DTK 25.04.2 or later, or the OneScience-recommended version matching the current cluster, is recommended.
Download the Model Package
hf download OneScience-Group/UMA
cd UMA
Install the Runtime Environment
DCU environment
# Activate DTK and conda first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
# uv installation is also supported
pip install onescience[matchem-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
GPU environment
# Activate conda first
conda create -n onescience311 python=3.11 -y libstdcxx-ng=12 libgcc-ng=12 gcc_linux-64=12 gxx_linux-64=12
conda activate onescience311
# uv installation is also supported
pip install onescience[matchem-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
Training Datasets
Training data is not bundled with this repository. The following example uses OC20 fine-tuning. OC22, OC25, OMat, OMOL, ODAC, and OMC follow the same workflow; only --uma-task and the data paths need to be changed.
hf download OneScience-Group/oc20 --repo-type dataset
Data conversion
The downloaded raw data usually consists of .extxyz files. Convert them to ASE-LMDB format with scripts/create_uma_finetune_dataset.py, which also computes elem_refs and normalizer_rmsd. The script supports these tasks:
| Task | Description |
|---|---|
oc20 |
Catalysis (example) |
oc22 |
Oxide catalysis (1P2 only) |
oc25 |
(Electro)catalysis (1P2 only) |
omat |
Inorganic materials |
omol |
Molecules and polymers |
odac |
MOFs |
omc |
Molecular crystals |
python scripts/create_uma_finetune_dataset.py \
--train-dir data/oc20/s2ef_200k_uncompressed \
--val-dir data/oc20/s2ef_val_id_uncompressed \
--uma-task oc20 \
--regression-tasks ef \
--output-dir data/oc20_finetune \
--num-workers 8
The conversion produces:
data/oc20_finetune/
├── train/ # ASE-LMDB training data
├── val/ # ASE-LMDB validation data
└── data/ # Generated data configuration YAML
└── uma_conserving_data_task_energy_force.yaml
Next, use scripts/update_demo_config.py to copy the generated elem_refs, normalizer_rmsd, and data paths into the demo configuration:
python scripts/update_demo_config.py --demo-config demo/configs/oc20_ef_4dcu.yaml
demo/run.sh automatically sets the repository root as ONESCIENCE_DATASETS_DIR, so relative paths in the configuration resolve automatically.
Trained Weights
This repository includes the rotation-basis file weight/Jd.pt. Download a pretrained UMA checkpoint, such as uma-s-1p1_converted.pt, from the official fairchem repository, convert it to UMA format, and place it at the following location (upload pending):
weight/uma-s-1p1_converted.pt
- Official fairchem repository: https://github.com/facebookresearch/fairchem
demo/run.sh and the example scripts under inference/ automatically detect weight/Jd.pt and set ONESCIENCE_UMA_JD_PATH.
Fine-Tuning
bash demo/run.sh --config demo/configs/oc20_ef_4dcu.yaml
Inference
python inference/run_molecular_md.py
Specify the path to the pretrained weights before running inference.
Official OneScience Resources
| Platform | OneScience Main Repository | Skills Repository |
|---|---|---|
| Gitee | https://gitee.com/onescience-ai/onescience | https://gitee.com/onescience-ai/oneskills |
| GitHub | https://github.com/onescience-ai/OneScience | https://github.com/onescience-ai/oneskills |
Citation and License
- The UMA example code comes from the MatChem examples in the OneScience project and refers to the upstream fairchem project (https://github.com/facebookresearch/fairchem). The upstream fairchem software is released under the MIT License. Individual fairchem model checkpoints and datasets may have separate licenses; follow the applicable terms.
- If you use UMA fine-tuning or inference results in research, please cite UMA or the relevant universal materials interaction model method, the fairchem and OneScience projects, and the datasets used.
中文说明
模型简介
UMA(Universal Materials Interaction Model)是面向材料与催化体系的通用原子间机器学习势函数(machine learning potential)。它基于等变图神经网络,预测原子结构的能量和力。
模型描述
UMA 采用在多个材料与催化数据集上训练的等变图神经网络架构,包括 OC20、OC22、OC25、OMat、OMOL、ODAC 和 OMC。它支持催化吸附、无机材料、分子体系和 MOFs 的能量和力预测及结构优化。
使用场景
| 使用场景 | 说明 |
|---|---|
| OC20 能量/力微调(fine-tuning) | 使用标准配置读取 OC20 微调数据并训练 UMA 模型 |
| OC22 氧化物催化微调 | 使用标准配置在 OC22 上微调(仅 1P2) |
| OC25(电)催化微调 | 使用标准配置在 OC25 上微调(仅 1P2) |
| OMat 无机材料微调 | 使用标准配置在 OMat 上微调 |
| OMOL 分子/聚合物微调 | 使用标准配置在 OMOL 上微调 |
| ODAC MOF 微调 | 使用标准配置在 ODAC 上微调 |
| OMC 分子晶体微调 | 使用标准配置在 OMC 上微调 |
| 训练前置检查 | 检查配置、数据路径、运行脚本和模型权重(检查点)(checkpoint)位置 |
| 催化吸附建模 | 以 OC20/OC22/OC25 任务为参照,对吸附及催化表面体系进行训练和推理(inference) |
| 推理脚本参考 | 适配上游示例以进行晶体弛豫、吸附体系弛豫或分子 MD |
| 自定义数据迁移 | 将 ASE 可读取的结构转换为 UMA 微调数据,然后替换训练与验证路径 |
使用方法
1. 使用 OneCode
在 OneCode 在线环境中体验智能一键 AI4S 编程。
2. 手动安装与使用
硬件要求
- 建议使用 GPU 或 DCU 进行微调。
- 可使用 CPU 检查配置和数据路径,但不建议用于生产 UMA 训练。
- DCU 用户必须提前安装 DTK。建议使用 DTK 25.04.2 或更高版本,或使用 OneScience 推荐的与当前集群匹配的版本。
下载模型包
hf download OneScience-Group/UMA
cd UMA
安装运行环境
DCU 环境
# Activate DTK and conda first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
# uv installation is also supported
pip install onescience[matchem-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
GPU 环境
# Activate conda first
conda create -n onescience311 python=3.11 -y libstdcxx-ng=12 libgcc-ng=12 gcc_linux-64=12 gxx_linux-64=12
conda activate onescience311
# uv installation is also supported
pip install onescience[matchem-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
训练数据集
本仓库未随附训练数据。以下示例使用 OC20 微调。OC22、OC25、OMat、OMOL、ODAC 和 OMC 遵循同一流程,仅需修改 --uma-task 及数据路径。
hf download OneScience-Group/oc20 --repo-type dataset
数据转换
下载的原始数据一般为 .extxyz 文件。使用 scripts/create_uma_finetune_dataset.py 转换为 ASE-LMDB 格式,脚本还计算 elem_refs 和 normalizer_rmsd。脚本支持以下任务。
| 任务 | 说明 |
|---|---|
oc20 |
催化(示例) |
oc22 |
氧化物催化(仅 1P2) |
oc25 |
(电)催化(仅 1P2) |
omat |
无机材料 |
omol |
分子与聚合物 |
odac |
MOFs |
omc |
分子晶体 |
python scripts/create_uma_finetune_dataset.py \
--train-dir data/oc20/s2ef_200k_uncompressed \
--val-dir data/oc20/s2ef_val_id_uncompressed \
--uma-task oc20 \
--regression-tasks ef \
--output-dir data/oc20_finetune \
--num-workers 8
转换生成以下内容。
data/oc20_finetune/
├── train/ # ASE-LMDB training data
├── val/ # ASE-LMDB validation data
└── data/ # Generated data configuration YAML
└── uma_conserving_data_task_energy_force.yaml
接下来,使用 scripts/update_demo_config.py 将生成的 elem_refs、normalizer_rmsd 和数据路径复制到示例配置。
python scripts/update_demo_config.py --demo-config demo/configs/oc20_ef_4dcu.yaml
demo/run.sh 自动将仓库根目录设为 ONESCIENCE_DATASETS_DIR,因此配置中的相对路径可自动解析。
训练权重
本仓库包含旋转基文件 weight/Jd.pt。从 fairchem 官方仓库下载 UMA 预训练模型权重(检查点),例如 uma-s-1p1_converted.pt,将其转换为 UMA 格式并放在以下位置(待上传)。
weight/uma-s-1p1_converted.pt
- fairchem 官方仓库 https://github.com/facebookresearch/fairchem
demo/run.sh 与 inference/ 下的示例脚本会自动检测 weight/Jd.pt 并设置 ONESCIENCE_UMA_JD_PATH。
微调
bash demo/run.sh --config demo/configs/oc20_ef_4dcu.yaml
推理
python inference/run_molecular_md.py
运行推理前,请指定预训练权重的路径。
OneScience 官方资源
| 平台 | OneScience 主仓库 | Skills 仓库 |
|---|---|---|
| Gitee | https://gitee.com/onescience-ai/onescience | https://gitee.com/onescience-ai/oneskills |
| GitHub | https://github.com/onescience-ai/OneScience | https://github.com/onescience-ai/oneskills |
引用与许可证
- UMA 示例代码来自 OneScience 项目的 MatChem 示例,并参考上游 fairchem 项目 (https://github.com/facebookresearch/fairchem)。上游 fairchem 软件按 MIT 许可证发布。各个 fairchem 模型权重(检查点)和数据集可能采用单独许可证,请遵守相应条款。
- 如果在研究中使用 UMA 微调或推理结果,请引用 UMA 或相关的通用材料相互作用模型方法、fairchem 和 OneScience 项目及所用数据集。
- Downloads last month
- 11