openai / generating-reviews-discovering-sentiment

Code for "Learning to Generate Reviews and Discovering Sentiment"
https://arxiv.org/abs/1704.01444
MIT License
1.51k stars 379 forks source link

python2.7 IndexError: list index out of range #14

Closed zhaoyingjun closed 7 years ago

zhaoyingjun commented 7 years ago

Traceback (most recent call last): File "demo.py", line 4, in model = Model() File "/Users/zhaoyingjun/Downloads/generating-reviews-discovering-sentiment-master/encoder.py", line 143, in init cells, states, logits = model(X, S, M, reuse=False) File "/Users/zhaoyingjun/Downloads/generating-reviews-discovering-sentiment-master/encoder.py", line 93, in model inputs = [tf.squeeze(v, [1]) for v in tf.split(1, nsteps, words)] File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py", line 1203, in split num = size_splits_shape.dims[0] IndexError: list index out of range who can tell me why please?

dthiagarajan commented 7 years ago

Their code is intended to be run on Python 3.4 or higher I think. If you want to run it on 2.6/7, you have to change some stuff - see #3

zhaoyingjun commented 7 years ago

python3.5 tensorflow-1.0.1

File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensorflow/python/ops/array_ops.py", line 1203, in split num = size_splits_shape.dims[0] IndexError: list index out of range

codypilot commented 7 years ago

@zhaoyingjun Try this repo and branch

mkdynamic commented 7 years ago

Suggestion by @codypilot works for me (using Python 3.6.1):

git remote add g3n1uss https://github.com/g3n1uss/generating-reviews-discovering-sentiment.git
git checkout g3n1uss/compatibleWithTF101
shenfanyi commented 7 years ago

I have the same error. @codypilot your code does not work for me. I have tried your code with environment including python 3.5.2 & tensorflow 1.0.1 and python 2.7.13 & tensorflow 1.0.1 ,but I got the same error: 'IndexError: list index out of range'. Could you tell me your environment please?

codypilot commented 7 years ago

@shenfanyi I've had success with Python 2.7, 3.4.3 and 3.6.1 + TensorFlow 1.0.1.

choukelly commented 7 years ago

@codypilot How did you have success with Python 2.7 and 3.6.1? Didn't you need to use Python 3.5 when you downloaded TensorFlow?

Newmu commented 7 years ago

This project only supports python 3 and TF 1.0+ as of https://github.com/openai/generating-reviews-discovering-sentiment/commit/83d940d132fbd585deb63b8e3fcb523ea9557683