sjvasquez / handwriting-synthesis

Handwriting Synthesis with RNNs ✏️
4.21k stars 561 forks source link

AttributeError: 'module' object has no attribute 'in_graph_mode' #17

Open johnnyrevell opened 6 years ago

johnnyrevell commented 6 years ago

Any idea about this error? I get it when running python demo.py 18.04 Ubuntu running stock Python 2.7.15rc1 Have installed: apt install python-tk pip install numpy svgwrite matplotlib scipy tensorflow pandas sklearn

Full error: Traceback (most recent call last): File "demo.py", line 153, in <module> hand = Hand() File "demo.py", line 37, in __init__ attention_mixture_components=10 File "/home/john/handwriting-synthesis/rnn.py", line 85, in __init__ super(rnn, self).__init__(**kwargs) File "/home/john/handwriting-synthesis/tf_base_model.py", line 108, in __init__ self.graph = self.build_graph() File "/home/john/handwriting-synthesis/tf_base_model.py", line 399, in build_graph self.loss = self.calculate_loss() File "/home/john/handwriting-synthesis/rnn.py", line 204, in calculate_loss lambda: self.sample(cell) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/util/deprecation.py", line 432, in new_func return func(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/control_flow_ops.py", line 2063, in cond orig_res_t, res_t = context_t.BuildCondBranch(true_fn) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/control_flow_ops.py", line 1913, in BuildCondBranch original_result = fn() File "/home/john/handwriting-synthesis/rnn.py", line 203, in <lambda> lambda: self.primed_sample(cell), File "/home/john/handwriting-synthesis/rnn.py", line 162, in primed_sample scope='rnn' File "/home/john/handwriting-synthesis/rnn_ops.py", line 246, in rnn_free_run states, outputs, final_state = raw_rnn(cell, loop_fn, scope=scope) File "/home/john/handwriting-synthesis/rnn_ops.py", line 40, in raw_rnn if context.in_graph_mode(): AttributeError: 'module' object has no attribute 'in_graph_mode'

ssell commented 5 years ago

I had the same issue and udnaan's commit fixed it for me.

System:

samvatsar commented 4 years ago

I had the same issue and udnaan's commit fixed it for me.

System:

  • Windows 10 1803
  • Python 3.6.2
  • TensorFlow 1.11.0

Hi @ssell , please let me know how did u solve the issue. I was getting the error: https://github.com/sjvasquez/handwriting-synthesis/issues/22. but, when i removed the lines 9, 29 and 30 as suggested by you, i am getting the 'in_graph_mode' error. Kindly help me.

I got it! ChenXiaoTemp's pull request has the solution.