Bug of chemical Property Tutorial

I used the tutorial code from [Tutorial] (https://www.dgl.ai/release/2019/08/28/release.htm]l)
and run this code.

from dgl.data.chem import Tox21
from dgl import model_zoo

dataset = Tox21()
model = model_zoo.chem.load_pretrained('GCN_Tox21') # Pretrained model loaded
model.eval()

smiles, g, label, mask = dataset[0]
feats = g.ndata.pop('h')
label_pred = model(g, feats)
print(smiles)                   # CCOc1ccc2nc(S(N)(=O)=O)sc2c1
print(label_pred[:, mask != 0]) # Mask non-existing labels
# tensor([[-0.7956,  0.4054,  0.4288, -0.5565, -0.0911,  
# 0.9981, -0.1663,  0.2311, -0.2376,  0.9196]])

However, it doesn’t work.

Loading previously saved dgl graphs…
Pretrained model loaded
Traceback (most recent call last):
File “mini_batch_tutorial.py”, line 9, in
feats = g.ndata.pop(‘h’)
File “/home/yoshida/.dotfiles/.pyenv/versions/anaconda3-5.0.0/envs/dgl/lib/python3.7/_collections_abc.py”, line 795, in pop
value = self[key]
File “/home/yoshida/.dotfiles/.pyenv/versions/anaconda3-5.0.0/envs/dgl/lib/python3.7/site-packages/dgl/view.py”, line 60, in getitem
return self._graph.get_n_repr(self._nodes)[key]
KeyError: ‘h’
Blockquote

How should I solve this?

Hi,

We’ve recently updated the chemistry part. Could you refer to this one https://github.com/dmlc/dgl/tree/master/apps/life_sci?

Thank you for correct link…
But, I got another error related with dgl.nn.pytorch.conv

I tried this link and reinstall the dgl latest version.It doesn’t work
I use conda and version is mentioned below.

platform : linux-64
conda version : 4.3.27

python -c ‘from dgl.nn.pytorch.conv import CFConv’
Traceback (most recent call last):
File “”, line 1, in
ImportError: cannot import name ‘CFConv’ from ‘dgl.nn.pytorch.conv’ (/**/.pyenv/versions/anaconda3-5.0.0/envs/dg2/lib/python3.7/site-packages/dgl/nn/pytorch/conv/init.py)

How do I treat with this problem?

Hi, sorry for the inconvenience. The first error was due to a deprecation. For the second error, installing the nightly-built version of DGL or simply building from source should solve the problem. See the instructions in README.