Unverified Commit 0ee9f56e authored by Mufei Li's avatar Mufei Li Committed by GitHub
Browse files

[DGL-LifeSci] Final release preparation for 0.2.1

parent 00efec60
...@@ -24,16 +24,21 @@ DGL is an easy-to-use, high performance and scalable Python package for deep lea ...@@ -24,16 +24,21 @@ DGL is an easy-to-use, high performance and scalable Python package for deep lea
**A data scientist** may want to apply a pre-trained model to your data right away. For this you can use DGL's [Application packages, formally *Model Zoo*](https://github.com/dmlc/dgl/tree/master/apps). Application packages are developed for domain applications, as is the case for [DGL-LifeScience](https://github.com/dmlc/dgl/tree/master/apps/life_sci). We will soon add model zoo for knowledge graph embedding learning and recommender systems. Here's how you will use a pretrained model: **A data scientist** may want to apply a pre-trained model to your data right away. For this you can use DGL's [Application packages, formally *Model Zoo*](https://github.com/dmlc/dgl/tree/master/apps). Application packages are developed for domain applications, as is the case for [DGL-LifeScience](https://github.com/dmlc/dgl/tree/master/apps/life_sci). We will soon add model zoo for knowledge graph embedding learning and recommender systems. Here's how you will use a pretrained model:
```python ```python
from dgl.data.chem import Tox21, smiles_to_bigraph, CanonicalAtomFeaturizer from dgllife.data import Tox21
from dgl import model_zoo from dgllife.model import load_pretrained
from dgllife.utils import smiles_to_bigraph, CanonicalAtomFeaturizer
dataset = Tox21(smiles_to_bigraph, CanonicalAtomFeaturizer()) dataset = Tox21(smiles_to_bigraph, CanonicalAtomFeaturizer())
model = model_zoo.chem.load_pretrained('GCN_Tox21') # Pretrained model loaded model = load_pretrained('GCN_Tox21') # Pretrained model loaded
model.eval() model.eval()
smiles, g, label, mask = dataset[0] smiles, g, label, mask = dataset[0]
feats = g.ndata.pop('h') feats = g.ndata.pop('h')
label_pred = model(g, feats) label_pred = model(g, feats)
print(smiles) # CCOc1ccc2nc(S(N)(=O)=O)sc2c1
print(label_pred[:, mask != 0]) # Mask non-existing labels
# tensor([[ 1.4190, -0.1820, 1.2974, 1.4416, 0.6914,
# 2.0957, 0.5919, 0.7715, 1.7273, 0.2070]])
``` ```
**Further reading**: DGL is released as a managed service on AWS SageMaker, see the medium posts for an easy trip to DGL on SageMaker([part1](https://medium.com/@julsimon/a-primer-on-graph-neural-networks-with-amazon-neptune-and-the-deep-graph-library-5ce64984a276) and [part2](https://medium.com/@julsimon/deep-graph-library-part-2-training-on-amazon-sagemaker-54d318dfc814)). **Further reading**: DGL is released as a managed service on AWS SageMaker, see the medium posts for an easy trip to DGL on SageMaker([part1](https://medium.com/@julsimon/a-primer-on-graph-neural-networks-with-amazon-neptune-and-the-deep-graph-library-5ce64984a276) and [part2](https://medium.com/@julsimon/deep-graph-library-part-2-training-on-amazon-sagemaker-54d318dfc814)).
......
...@@ -12,6 +12,68 @@ featurization, and evaluation, model architectures, training scripts and pre-tra ...@@ -12,6 +12,68 @@ featurization, and evaluation, model architectures, training scripts and pre-tra
**For a full list of work implemented in DGL-LifeSci, see [here](examples/README.md).** **For a full list of work implemented in DGL-LifeSci, see [here](examples/README.md).**
## Installation
### Requirements
DGL-LifeSci should work on
* all Linux distributions no earlier than Ubuntu 16.04
* macOS X
* Windows 10
DGL-LifeSci requires python 3.6+, DGL 0.4.3+ and PyTorch 1.2.0+.
Additionally, we require `RDKit 2018.09.3` for cheminformatics. We recommend installing it with
```
conda install -c conda-forge rdkit==2018.09.3
```
For other installation recipes for RDKit, see the [official documentation](https://www.rdkit.org/docs/Install.html).
### Pip installation for DGL-LifeSci
```
pip install dgllife
```
### Conda installation for DGL-LifeSci
```
conda install -c dglteam dgllife
```
### Installation from source
If you want to try experimental features, you can install from source as follows:
```
git clone https://github.com/dmlc/dgl.git
cd apps/life_sci/python
python setup.py install
```
### Verifying successful installation
Once you have installed the package, you can verify the success of installation with
```python
import dgllife
print(dgllife.__version__)
# 0.2.1
```
If you are new to DGL, the first time you import dgl a message will pop up as below:
```
DGL does not detect a valid backend option. Which backend would you like to work with?
Backend choice (pytorch, mxnet or tensorflow):
```
and you need to enter `pytorch`.
## Example Usage ## Example Usage
To apply graph neural networks to molecules with DGL, we need to first construct `DGLGraph` -- To apply graph neural networks to molecules with DGL, we need to first construct `DGLGraph` --
...@@ -78,7 +140,8 @@ print(label_pred[:, mask != 0]) # Mask non-existing labels ...@@ -78,7 +140,8 @@ print(label_pred[:, mask != 0]) # Mask non-existing labels
# 2.0957, 0.5919, 0.7715, 1.7273, 0.2070]]) # 2.0957, 0.5919, 0.7715, 1.7273, 0.2070]])
``` ```
Similarly, we can load a pre-trained model for generating molecules. Similarly, we can load a pre-trained model for generating molecules. If possible, we recommend running
the code block below with Jupyter notebook.
```python ```python
from dgllife.model import load_pretrained from dgllife.model import load_pretrained
...@@ -109,30 +172,6 @@ SVG(Draw.MolsToGridImage(mols, molsPerRow=4, subImgSize=(180, 150), useSVG=True) ...@@ -109,30 +172,6 @@ SVG(Draw.MolsToGridImage(mols, molsPerRow=4, subImgSize=(180, 150), useSVG=True)
![](https://data.dgl.ai/dgllife/dgmg/dgmg_model_zoo_example2.png) ![](https://data.dgl.ai/dgllife/dgmg/dgmg_model_zoo_example2.png)
## Installation
DGL-LifeSci requires python 3.5+, DGL 0.4.3+ and PyTorch 1.2.0+.
Additionally, we require `RDKit 2018.09.3` for cheminformatics. We recommend installing it with
`conda install -c conda-forge rdkit==2018.09.3`. For other installation recipes,
see the [official documentation](https://www.rdkit.org/docs/Install.html).
We provide installation of `DGL-LifeSci` with pip. Once you have installed the package,
verify the success of installation with
```python
import dgllife
print(dgllife.__version__)
# 0.2.0
```
### Using pip
```
pip install dgllife
```
## Speed Reference ## Speed Reference
Below we provide some reference numbers to show how DGL improves the speed of training models per epoch in seconds. Below we provide some reference numbers to show how DGL improves the speed of training models per epoch in seconds.
......
git submodule init $PYTHON setup.py install --single-version-externally-managed --record=record.txt # Python command to install the script.
git submodule update --recursive \ No newline at end of file
cd python
$PYTHON setup.py install --single-version-externally-managed --record=record.txt
\ No newline at end of file
python: python:
- 3.5
- 3.6 - 3.6
- 3.7 - 3.7
\ No newline at end of file
package: package:
name: dgllife{{ environ.get('APP_PACKAGE_SUFFIX', '') }} name: dgllife{{ environ.get('APP_PACKAGE_SUFFIX', '') }}
version: "0.2.0" version: "0.2.1"
source: source:
git_rev: 0.2.0 url: https://files.pythonhosted.org/packages/7d/ca/543802eca0e8d263a73309379f79a054b3bb7e7377ead0b69d2451728465/dgllife-0.2.1.tar.gz
git_url: https://github.com/dmlc/dgl/tree/master/apps/dgllife sha256: 11a1622ba587f7ff67f42ad8bc88d238faaa459ab554cf59e1b69a10079d41c0
requirements: requirements:
build: build:
...@@ -19,12 +19,9 @@ requirements: ...@@ -19,12 +19,9 @@ requirements:
- scikit-learn - scikit-learn
- pandas - pandas
- tqdm - tqdm
- numpy
test: - scipy
imports: - networkx
- dgllife
about: about:
home: https://github.com/dmlc/dgl/tree/master/apps/dgllife
license_file: {{ environ.get('SRC_DIR') }}/LICENSE
license: Apache license: Apache
\ No newline at end of file
"""Information for the library.""" """Information for the library."""
__version__ = '0.2.0'
# current version
__version__ = '0.2.1'
...@@ -31,16 +31,17 @@ setup( ...@@ -31,16 +31,17 @@ setup(
'life-science', 'life-science',
'drug-discovery' 'drug-discovery'
], ],
zip_safe=False,
maintainer='DGL Team', maintainer='DGL Team',
packages=[package for package in find_packages() packages=[package for package in find_packages()
if package.startswith('dgllife')], if package.startswith('dgllife')],
install_requires=[ install_requires=[
'torch>=1.1'
'scikit-learn>=0.22.2', 'scikit-learn>=0.22.2',
'pandas>=0.24.2', 'pandas',
'requests>=2.22.0', 'requests>=2.22.0',
'tqdm' 'tqdm',
'numpy>=1.14.0',
'scipy>=1.1.0',
'networkx>=2.1',
], ],
url='https://github.com/dmlc/dgl/tree/master/apps/life_sci', url='https://github.com/dmlc/dgl/tree/master/apps/life_sci',
classifiers=[ classifiers=[
......
...@@ -8,7 +8,7 @@ List of affected files: ...@@ -8,7 +8,7 @@ List of affected files:
import os import os
import re import re
__version__ = "0.2.0" __version__ = "0.2.1"
print(__version__) print(__version__)
# Implementations # Implementations
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment