Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

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

Open
user55449 opened this issue Jun 28, 2017 · 2 comments
Open

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

user55449 opened this issue Jun 28, 2017 · 2 comments

Comments

@user55449
Copy link

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, line_no, 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
Copy link

shirishr commented Jul 7, 2017

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

@hints
Copy link

hints commented Jul 13, 2017

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, line_no, method, _ in result._traceback:
ValueError: too many values to unpack

LiangShe added a commit to LiangShe/prettytensor that referenced this issue Jul 14, 2017
Resolve ValueError: too many values to unpack
issue google#53 google#56 from original repo
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants