unimol-tools


Nameunimol-tools JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/deepmodeling/Uni-Mol/unimol_tools
Summaryunimol_tools is a Python package for property prediciton with Uni-Mol in molecule, materials and protein.
upload_time2024-11-21 07:49:28
maintainerNone
docs_urlNone
authorDP Technology
requires_python>=3.6
licenseThe MIT License
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Uni-Mol tools for various prediction and downstreams.

Documentation of Uni-Mol tools is available at https://unimol.readthedocs.io/en/latest/

## Details can be found in bohrium notebook
* [unimol property predict](https://bohrium.dp.tech/notebook/298bcead4f614971bb62fbeef2e9db16)
* [unimol representation](https://bohrium.dp.tech/notebook/f39a7a8836134cca8e22c099dc9654f8)

## 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)

```bash
pip install unimol_tools
```

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 UniMol models.

### Option 2: Installing from source

```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/b4/dd/2dc097f22fb68d777fa154aa69ae500036b0c9e9ec603df7942caa13cf18/unimol_tools-0.1.1.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## Details can be found in bohrium notebook\n* [unimol property predict](https://bohrium.dp.tech/notebook/298bcead4f614971bb62fbeef2e9db16)\n* [unimol representation](https://bohrium.dp.tech/notebook/f39a7a8836134cca8e22c099dc9654f8)\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)\n\n```bash\npip install unimol_tools\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 UniMol models.\n\n### Option 2: Installing from source\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.1",
    "project_urls": {
        "Homepage": "https://github.com/deepmodeling/Uni-Mol/unimol_tools"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b4dd2dc097f22fb68d777fa154aa69ae500036b0c9e9ec603df7942caa13cf18",
                "md5": "9b15dec1389c3809a16050c9115a449f",
                "sha256": "7add6707270ec50a3f49d50d4d5f748c7b213d9930748feeab7c4019107fd646"
            },
            "downloads": -1,
            "filename": "unimol_tools-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "9b15dec1389c3809a16050c9115a449f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 52019,
            "upload_time": "2024-11-21T07:49:28",
            "upload_time_iso_8601": "2024-11-21T07:49:28.514019Z",
            "url": "https://files.pythonhosted.org/packages/b4/dd/2dc097f22fb68d777fa154aa69ae500036b0c9e9ec603df7942caa13cf18/unimol_tools-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-21 07:49:28",
    "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"
}
        
Elapsed time: 1.03293s