question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Description:

  • DeepChem Version: 2.1.1
  • Platform: MacOS 10.14.2

Encountered a dimensionality error when the model tried to reshape pair features. My sample code:

import deepchem 
from deepchem.molnet.load_function.hiv_datasets import load_hiv

hiv_tasks, (train_wv, valid_wv, test_wv), transformers = load_hiv(featurizer='Weave')
model = deepchem.models.MPNNModel(
		len(hiv_tasks),
		mode="classification")
model.fit(train_wv)

The error I got:

2019-02-05 23:02:55.096153: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
/Users/iron4dam/anaconda3/envs/rdkit/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py:112: UserWarning: Converting sparse IndexedSlices to a dense Tensor of unknown shape. This may consume a large amount of memory.
  "Converting sparse IndexedSlices to a dense Tensor of unknown shape. "
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/Users/iron4dam/anaconda3/envs/rdkit/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/Users/iron4dam/anaconda3/envs/rdkit/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/iron4dam/anaconda3/envs/rdkit/lib/python3.6/site-packages/deepchem/models/tensorgraph/tensor_graph.py", line 1373, in _enqueue_batch
    for feed_dict in generator:
  File "/Users/iron4dam/anaconda3/envs/rdkit/lib/python3.6/site-packages/deepchem/models/tensorgraph/models/graph_models.py", line 954, in default_generator
    (n_atoms * n_atoms, self.n_pair_feat)))
  File "/Users/iron4dam/anaconda3/envs/rdkit/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 279, in reshape
    return _wrapfunc(a, 'reshape', newshape, order=order)
  File "/Users/iron4dam/anaconda3/envs/rdkit/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 51, in _wrapfunc
    return getattr(obj, method)(*args, **kwds)
ValueError: cannot reshape array of size 36414 into shape (2601,8)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
vsomnathcommented, Feb 12, 2019

The script below ran on my laptop with no errors, but I was able to train with only a single sample, otherwise my TensorFlow was getting killed.

import deepchem
from deepchem.molnet.load_function.hiv_datasets import load_hiv
import numpy as np

hiv_tasks, (train_wv, valid_wv, test_wv), transformers = load_hiv(featurizer='Weave')

X = train_wv.X[:1]
y = train_wv.y[:1]

new_dataset = deepchem.data.NumpyDataset(X, y)
model = deepchem.models.MPNNModel(
  len(hiv_tasks),
  n_pair_feat=14,
  n_atom_feat=75,
  n_hidden=75,
  T=1, M=1,
  mode="classification")

metric = deepchem.metrics.Metric(deepchem.metrics.roc_auc_score, np.mean, mode="classification")
model.fit(new_dataset, nb_epoch=10)

scores = model.evaluate(test_wv, [metric], transformers)
print(scores['mean-roc_auc_score'])
0reactions
vsomnathcommented, Mar 29, 2019

Nope, I have never used the MPNN model before. To be honest, I haven’t gone through its paper as well. Also, could you close this issue? - Feel free to reopen if necessary?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix: Incorrect product identifier [mpn] - Google Help
Use a valid Manufacturer Part Number (MPN). Submit a valid value or remove the current invalid value for this attribute and resubmit your...
Read more >
How To Fix Identifier-related Errors (GTIN/MPN/Brand) on the ...
1. If you resell old or custom items without GTIN, or MPN, set identifierexists to NO (or FALSE). 2. If you resell items...
Read more >
Value Error while running neural network code - Stack Overflow
The error message simply states that you are feeding the wrong dimensions to the placeholder y while running the optimization algorithm and ...
Read more >
Message-passing neural network (MPNN) for molecular ...
In this tutorial, we will implement a type of graph neural network (GNN) known as _ message passing neural network_ (MPNN) to predict...
Read more >
Breaking the Limits of Message Passing Graph Neural Networks
with an arbitrary large receptive field, the MPNN ... values and by masking the convolution support with desired length of receptive field.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found