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.

TypeError while trying to run ./run_DGCNN.sh

See original GitHub issue

While trying to run ./run_DGCNN.sh I get the same error each time I run for different datasets: TypeError: new(): data must be a sequence (got dict_values)

>> ./run_DGCNN.sh

====== begin of s2v configuration ======
| msg_average = 0
======   end of s2v configuration ======
Namespace(batch_size=50, data='DD', dropout=True, extract_features=False, feat_dim=0, fold=1, gm='DGCNN', hidden=128, latent_dim=[32, 32, 32, 1], learning_rate=1e-05, max_lv=4, mode='cpu', num_class=0, num_epochs=200, out_dim=0, printAUC=False, seed=1, sortpooling_k=0.6, test_number=0)
loading data
# classes: 2
# maximum node tag: 82
# train: 1061, # test: 117
k used in SortPooling is: 291
Initializing DGCNN
  0%|                                                                                                                                                                 | 0/21 [00:00<?, ?batch/s]Traceback (most recent call last):
  File "main.py", line 187, in <module>
    avg_loss = loop_dataset(train_graphs, classifier, train_idxes, optimizer=optimizer)
  File "main.py", line 131, in loop_dataset
    logits, loss, acc = classifier(batch_graph)
  File "/home/egorc/.local/lib/python3.5/site-packages/torch/nn/modules/module.py", line 477, in __call__
    result = self.forward(*input, **kwargs)
  File "main.py", line 107, in forward
    embed = self.s2v(batch_graph, node_feat, None)
  File "/home/egorc/.local/lib/python3.5/site-packages/torch/nn/modules/module.py", line 477, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/egorc/pytorch_DGCNN/DGCNN_embedding.py", line 53, in forward
    node_degs = [torch.Tensor(graph_list[i].degs) + 1 for i in range(len(graph_list))]
  File "/home/egorc/pytorch_DGCNN/DGCNN_embedding.py", line 53, in <listcomp>
    node_degs = [torch.Tensor(graph_list[i].degs) + 1 for i in range(len(graph_list))]
TypeError: new(): data must be a sequence (got dict_values)

Steps to reproduce:

  • Install DGCNN:
    • Clone repository
    • unzip pytorch_structure2vec-master.zip
    • cd pytorch_structure2vec-master/s2vlib/
    • make -j4
    • cd ../..
  • Change python to python3 in run_DGCNN.sh
  • Change gpu_or_cpu=gpu to gpu_or_cpu=cpu in run_DGCNN.sh
  • Comment import cPickle as cp
  • Uncomment import _pickle as cp # python3 compatability in util.py
  • Run ./run_DGCNN.sh

Environment: Distributor ID: Ubuntu Description: Ubuntu 16.04.5 LTS Release: 16.04 Codename: xenial Python version: Python 3.5.2 Packages: absl-py (0.5.0) astor (0.7.1) autokeras (0.2.18) blinker (1.3) boto (2.38.0) chardet (2.3.0) cloud-init (18.3) command-not-found (0.3) configobj (5.0.6) cryptography (1.2.3) decorator (4.3.0) gast (0.2.0) google-compute-engine (2.8.2) grpcio (1.15.0) h5py (2.8.0) idna (2.0) Jinja2 (2.8) jsonpatch (1.10) jsonpointer (1.9) Keras (2.2.2) Keras-Applications (1.0.4) Keras-Preprocessing (1.0.2) language-selector (0.1) Markdown (3.0.1) MarkupSafe (0.23) networkx (2.2) numpy (1.15.2) oauthlib (1.0.3) Pillow (5.3.0) pip (8.1.1) prettytable (0.7.2) protobuf (3.6.1) pyasn1 (0.1.9) pycurl (7.43.0) pygobject (3.20.0) PyJWT (1.3.0) pyserial (3.0.1) python-apt (1.1.0b1+ubuntu0.16.4.2) python-debian (0.1.27) python-systemd (231) PyYAML (3.13) requests (2.9.1) scikit-learn (0.20.0) scipy (1.1.0) setuptools (39.1.0) six (1.11.0) sklearn (0.0) ssh-import-id (5.5) tensorboard (1.11.0) tensorflow (1.11.0) termcolor (1.1.0) torch (0.4.1) torchvision (0.2.1) tqdm (4.25.0) ufw (0.35) unattended-upgrades (0.1) urllib3 (1.13.1) Werkzeug (0.14.1) wheel (0.32.1)

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
muhanzhangcommented, Dec 1, 2018

Hi, have you tried updating your networkx to the latest version? After that, can you construct a toy graph and call “g.degree” and “g.degree()” to see what happens?

1reaction
muhanzhangcommented, Oct 9, 2018

Please change the line 51 of util.py from “self.degs = dict(g.degree).values()” to “self.degs = list(dict(g.degree).values())”. The issue is because python3 returns a dict_values type instead of list when you call dict.values().

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

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