szagoruyko/functional-zoo

Error in visualize code

elbamos opened this issue · 9 comments

I'm seeing this:

TypeError: Don't know how to create Python object for N5torch8autograd8VariableE

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 15, in add_nodes
  File "<stdin>", line 15, in add_nodes
  File "<stdin>", line 15, in add_nodes
  File "<stdin>", line 15, in add_nodes
  File "<stdin>", line 11, in add_nodes

For reference with line numbers, I have the function as:

>>> def add_nodes(var):
...         print(var)
...         print("didthatone")
...         if var not in seen:
...             if isinstance(var, Variable):
...                 value = '('+(', ').join(['%d'% v for v in var.size()])+')'
...                 dot.node(str(id(var)), str(value), fillcolor='lightblue')
...             else:
...                 dot.node(str(id(var)), str(type(var).__name__))
...             seen.add(var)
...             if hasattr(var, 'previous_functions'):
...                 for u in var.previous_functions:
...                     print(u)
...                     dot.edge(str(id(u[0])), str(id(var)))
...                     add_nodes(u[0])

hm that's weird. is this py2 or py3? can you post the network definition?

I haven't tested with py3, that might be the ussue. Do the notebooks run well for you? You can copy paste model definition code here or in gist

I have the same error and I am using Python 2

@apaszke do you have an idea maybe ?

Yeah I think I know what's happening. We'll push a fix soon.

Actually it should be fixed once pytorch/pytorch#881 is merged.

@szagoruyko My python version is 2.7. It works well. your visualize is very cool. thanks.

fixed now, hopefully