# Uni-Mol tools for various prediction and downstreams.
Documentation of Uni-Mol tools is available at https://unimol.readthedocs.io/en/latest/
## Install
- pytorch is required, please install pytorch according to your environment. if you are using cuda, please install pytorch with cuda. More details can be found at https://pytorch.org/get-started/locally/
- currently, rdkit needs with numpy<2.0.0, please install rdkit with numpy<2.0.0.
### Option 1: Installing from PyPi (Recommended, for stable version)
```bash
pip install unimol_tools --upgrade
```
We recommend installing ```huggingface_hub``` so that the required unimol models can be automatically downloaded at runtime! It can be install by
```bash
pip install huggingface_hub
```
`huggingface_hub` allows you to easily download and manage models from the Hugging Face Hub, which is key for using Uni-Mol models.
### Option 2: Installing from source (for latest version)
```python
## Dependencies installation
pip install -r requirements.txt
## Clone repository
git clone https://github.com/deepmodeling/Uni-Mol.git
cd Uni-Mol/unimol_tools
## Install
python setup.py install
```
### Models in Huggingface
The UniMol pretrained models can be found at [dptech/Uni-Mol-Models](https://huggingface.co/dptech/Uni-Mol-Models/tree/main).
If the download is slow, you can use other mirrors, such as:
```bash
export HF_ENDPOINT=https://hf-mirror.com
```
Setting the `HF_ENDPOINT` environment variable specifies the mirror address for the Hugging Face Hub to use when downloading models.
### Modify the default directory for weights
Setting the `UNIMOL_WEIGHT_DIR` environment variable specifies the directory for pre-trained weights if the weights have been downloaded from another source.
```bash
export UNIMOL_WEIGHT_DIR=/path/to/your/weights/dir/
```
## News
- 2024-07-23: User experience improvements: Add `UNIMOL_WEIGHT_DIR`.
- 2024-06-25: unimol_tools has been publish to pypi! Huggingface has been used to manage the pretrain models.
- 2024-06-20: unimol_tools v0.1.0 released, we remove the dependency of Uni-Core. And we will publish to pypi soon.
- 2024-03-20: unimol_tools documents is available at https://unimol.readthedocs.io/en/latest/
## molecule property prediction
```python
from unimol_tools import MolTrain, MolPredict
clf = MolTrain(task='classification',
data_type='molecule',
epochs=10,
batch_size=16,
metrics='auc',
)
pred = clf.fit(data = data)
# currently support data with smiles based csv/txt file, and
# custom dict of {'atoms':[['C','C],['C','H','O']], 'coordinates':[coordinates_1,coordinates_2]}
clf = MolPredict(load_model='../exp')
res = clf.predict(data = data)
```
## unimol molecule and atoms level representation
```python
import numpy as np
from unimol_tools import UniMolRepr
# single smiles unimol representation
clf = UniMolRepr(data_type='molecule', remove_hs=False)
smiles = 'c1ccc(cc1)C2=NCC(=O)Nc3c2cc(cc3)[N+](=O)[O]'
smiles_list = [smiles]
unimol_repr = clf.get_repr(smiles_list, return_atomic_reprs=True)
# CLS token repr
print(np.array(unimol_repr['cls_repr']).shape)
# atomic level repr, align with rdkit mol.GetAtoms()
print(np.array(unimol_repr['atomic_reprs']).shape)
```
Please kindly cite our papers if you use the data/code/model.
```
@inproceedings{
zhou2023unimol,
title={Uni-Mol: A Universal 3D Molecular Representation Learning Framework},
author={Gengmo Zhou and Zhifeng Gao and Qiankun Ding and Hang Zheng and Hongteng Xu and Zhewei Wei and Linfeng Zhang and Guolin Ke},
booktitle={The Eleventh International Conference on Learning Representations },
year={2023},
url={https://openreview.net/forum?id=6K2RM6wVqKu}
}
@article{gao2023uni,
title={Uni-qsar: an auto-ml tool for molecular property prediction},
author={Gao, Zhifeng and Ji, Xiaohong and Zhao, Guojiang and Wang, Hongshuai and Zheng, Hang and Ke, Guolin and Zhang, Linfeng},
journal={arXiv preprint arXiv:2304.12239},
year={2023}
}
```
License
-------
This project is licensed under the terms of the MIT license. See LICENSE for additional details.
Raw data
{
"_id": null,
"home_page": "https://github.com/deepmodeling/Uni-Mol/unimol_tools",
"name": "unimol-tools",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "DP Technology",
"author_email": "unimol@dp.tech",
"download_url": "https://files.pythonhosted.org/packages/52/e8/062430ead949a4de4fe8edef72975a2fbc9f0b14510f5c4695f84a33108e/unimol_tools-0.1.2.post2.tar.gz",
"platform": null,
"description": "# Uni-Mol tools for various prediction and downstreams.\n\nDocumentation of Uni-Mol tools is available at https://unimol.readthedocs.io/en/latest/\n\n## Install\n- pytorch is required, please install pytorch according to your environment. if you are using cuda, please install pytorch with cuda. More details can be found at https://pytorch.org/get-started/locally/\n- currently, rdkit needs with numpy<2.0.0, please install rdkit with numpy<2.0.0.\n\n### Option 1: Installing from PyPi (Recommended, for stable version)\n\n```bash\npip install unimol_tools --upgrade\n```\n\nWe recommend installing ```huggingface_hub``` so that the required unimol models can be automatically downloaded at runtime! It can be install by\n\n```bash\npip install huggingface_hub\n```\n\n`huggingface_hub` allows you to easily download and manage models from the Hugging Face Hub, which is key for using Uni-Mol models.\n\n### Option 2: Installing from source (for latest version)\n\n```python\n## Dependencies installation\npip install -r requirements.txt\n\n## Clone repository\ngit clone https://github.com/deepmodeling/Uni-Mol.git\ncd Uni-Mol/unimol_tools\n\n## Install\npython setup.py install\n```\n\n### Models in Huggingface\n\nThe UniMol pretrained models can be found at [dptech/Uni-Mol-Models](https://huggingface.co/dptech/Uni-Mol-Models/tree/main).\n\nIf the download is slow, you can use other mirrors, such as:\n\n```bash\nexport HF_ENDPOINT=https://hf-mirror.com\n```\n\nSetting the `HF_ENDPOINT` environment variable specifies the mirror address for the Hugging Face Hub to use when downloading models.\n\n### Modify the default directory for weights\n\nSetting the `UNIMOL_WEIGHT_DIR` environment variable specifies the directory for pre-trained weights if the weights have been downloaded from another source.\n\n```bash\nexport UNIMOL_WEIGHT_DIR=/path/to/your/weights/dir/\n```\n\n## News\n- 2024-07-23: User experience improvements: Add `UNIMOL_WEIGHT_DIR`.\n- 2024-06-25: unimol_tools has been publish to pypi! Huggingface has been used to manage the pretrain models.\n- 2024-06-20: unimol_tools v0.1.0 released, we remove the dependency of Uni-Core. And we will publish to pypi soon.\n- 2024-03-20: unimol_tools documents is available at https://unimol.readthedocs.io/en/latest/\n\n## molecule property prediction\n```python\nfrom unimol_tools import MolTrain, MolPredict\nclf = MolTrain(task='classification', \n data_type='molecule', \n epochs=10, \n batch_size=16, \n metrics='auc',\n )\npred = clf.fit(data = data)\n# currently support data with smiles based csv/txt file, and\n# custom dict of {'atoms':[['C','C],['C','H','O']], 'coordinates':[coordinates_1,coordinates_2]}\n\nclf = MolPredict(load_model='../exp')\nres = clf.predict(data = data)\n```\n## unimol molecule and atoms level representation\n```python\nimport numpy as np\nfrom unimol_tools import UniMolRepr\n# single smiles unimol representation\nclf = UniMolRepr(data_type='molecule', remove_hs=False)\nsmiles = 'c1ccc(cc1)C2=NCC(=O)Nc3c2cc(cc3)[N+](=O)[O]'\nsmiles_list = [smiles]\nunimol_repr = clf.get_repr(smiles_list, return_atomic_reprs=True)\n# CLS token repr\nprint(np.array(unimol_repr['cls_repr']).shape)\n# atomic level repr, align with rdkit mol.GetAtoms()\nprint(np.array(unimol_repr['atomic_reprs']).shape)\n```\n\nPlease kindly cite our papers if you use the data/code/model.\n```\n@inproceedings{\n zhou2023unimol,\n title={Uni-Mol: A Universal 3D Molecular Representation Learning Framework},\n author={Gengmo Zhou and Zhifeng Gao and Qiankun Ding and Hang Zheng and Hongteng Xu and Zhewei Wei and Linfeng Zhang and Guolin Ke},\n booktitle={The Eleventh International Conference on Learning Representations },\n year={2023},\n url={https://openreview.net/forum?id=6K2RM6wVqKu}\n}\n@article{gao2023uni,\n title={Uni-qsar: an auto-ml tool for molecular property prediction},\n author={Gao, Zhifeng and Ji, Xiaohong and Zhao, Guojiang and Wang, Hongshuai and Zheng, Hang and Ke, Guolin and Zhang, Linfeng},\n journal={arXiv preprint arXiv:2304.12239},\n year={2023}\n}\n```\n\nLicense\n-------\n\nThis project is licensed under the terms of the MIT license. See LICENSE for additional details.\n",
"bugtrack_url": null,
"license": "The MIT License",
"summary": "unimol_tools is a Python package for property prediciton with Uni-Mol in molecule, materials and protein.",
"version": "0.1.2.post2",
"project_urls": {
"Homepage": "https://github.com/deepmodeling/Uni-Mol/unimol_tools"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "52e8062430ead949a4de4fe8edef72975a2fbc9f0b14510f5c4695f84a33108e",
"md5": "413a31cc20b1eca8402e64734af24fae",
"sha256": "caec716741126ce6c49b040b1f18efb11d7474e405896b46df73adb11e8d2506"
},
"downloads": -1,
"filename": "unimol_tools-0.1.2.post2.tar.gz",
"has_sig": false,
"md5_digest": "413a31cc20b1eca8402e64734af24fae",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 53223,
"upload_time": "2025-01-06T03:23:47",
"upload_time_iso_8601": "2025-01-06T03:23:47.144587Z",
"url": "https://files.pythonhosted.org/packages/52/e8/062430ead949a4de4fe8edef72975a2fbc9f0b14510f5c4695f84a33108e/unimol_tools-0.1.2.post2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-06 03:23:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "deepmodeling",
"github_project": "Uni-Mol",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "unimol-tools"
}