google / prettytensor

Pretty Tensor: Fluent Networks in TensorFlow
1.24k stars 151 forks source link

PrettyTensor's template.construct() yielding ValueError #56

Open user55449 opened 7 years ago

user55449 commented 7 years ago

For almost any call to a template's construct() method, I get

ValueError: too many values to unpack When I run the template test file from https://github.com/google/prettytensor/blob/master/prettytensor/templated_pretty_tensor_test.py, 14 tests fail with this error. For example:

====================================================================== ERROR: testAttach (main.TemplatedPrettyTensorTest)

Traceback (most recent call last): File "unit_test.py", line 81, in testAttach out = self.RunTensor(input_pt.attach_template(template, 'input')) File "/opt/conda/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 750, in attach_template return _template.as_layer().construct(**unbound_var_values) File "/opt/conda/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1248, in construct return self._construct(context) File "/opt/conda/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct method_args = self._replace_deferred(self._method_args, context) File "/opt/conda/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred return [self._replace_deferred(x, context) for x in arg] File "/opt/conda/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred return arg._construct(context) File "/opt/conda/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct method_args = self._replace_deferred(self._method_args, context) File "/opt/conda/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred return [self._replace_deferred(x, context) for x in arg] File "/opt/conda/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred return arg._construct(context) File "/opt/conda/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1176, in _construct _strip_unnecessary_contents_from_stack(result, set()) File "/opt/conda/lib/python2.7/site-packages/prettytensor/pretty_tensor_class.py", line 1335, in _strip_unnecessary_contents_from_stack for f, lineno, method, in result._traceback: ValueError: too many values to unpack As a simpler example, the code from here does the same thing.

I'm using Tensorflow 1.2.0 and Python 2.7.1.

I've tried

pip uninstall prettytensor pip install prettytensor pip install prettytensor --upgrade but the problem persists.

Context: I'm trying to use hanzhanggit's StackGAN implementation. I haven't worked with TensorFlow before.

I believe this is related to issue 53.

shirishr commented 7 years ago

Same issue in running Shakespeare.py with Tensorflow 1.2.1 and Python 3.5.2

hints commented 7 years ago

This is the output from shakespeare.py, @eiderman ?

python shakespeare.py Starting Shakespeare Traceback (most recent call last): File "shakespeare.py", line 253, in tf.app.run() File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "shakespeare.py", line 173, in main training_logits = create_model(inp, TIMESTEPS, pt.Phase.train) File "shakespeare.py", line 70, in create_model .sequence_lstm(LOWER) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1972, in method result = func(non_seq_layer, *args, *kwargs) File "/usr/local/lib/python2.7/dist-packages/prettytensor/recurrent_networks.py", line 125, in call input_layer, name, state_shapes, self.template, lengths) File "/usr/local/lib/python2.7/dist-packages/prettytensor/recurrent_networks.py", line 383, in unroll_state_saver out, prev_states = template(layer, prev_states) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 493, in func return self.construct(values) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 461, in construct return self.build_from_flattened(construct_all(self.flatten(), bindings)) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 403, in construct_all result[i] = x._construct(context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct method_args = self._replace_deferred(self._method_args, context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred return [self._replace_deferred(x, context) for x in arg] File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred return arg._construct(context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct method_args = self._replace_deferred(self._method_args, context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred return [self._replace_deferred(x, context) for x in arg] File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred return arg._construct(context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct method_args = self._replace_deferred(self._method_args, context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred return [self._replace_deferred(x, context) for x in arg] File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred return arg._construct(context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct method_args = self._replace_deferred(self._method_args, context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred return [self._replace_deferred(x, context) for x in arg] File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred return arg._construct(context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1176, in _construct _strip_unnecessary_contents_from_stack(result, set()) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1335, in _strip_unnecessary_contents_from_stack for f, lineno, method, in result._traceback: ValueError: too many values to unpack