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

AttributeError: module 'tensorflow' has no attribute 'unpack' #35

Closed gitathrun closed 7 years ago

gitathrun commented 7 years ago

Hi, I just download the code and try to make it running the demo code:

model = Model() text = ['demo!'] text_features = model.transform(text)

But I got an error:

AttributeError Traceback (most recent call last)

in () ----> 1 model = Model() 2 text = ['demo!'] 3 text_features = model.transform(text) 4 C:\Users\teng.fu\OneDrive - TeleWare Plc\Desktop\Development\Data\May_2017_Sentiment_anlaysis_pre\sentiment_neuro\generating-reviews-discovering-sentiment-master\encoder.py in __init__(self, nbatch, nsteps) 141 M = tf.placeholder(tf.float32, [None, hps.nsteps, 1]) 142 S = tf.placeholder(tf.float32, [hps.nstates, None, hps.nhidden]) --> 143 cells, states, logits = model(X, S, M, reuse=False) 144 145 sess = tf.Session() C:\Users\teng.fu\OneDrive - TeleWare Plc\Desktop\Development\Data\May_2017_Sentiment_anlaysis_pre\sentiment_neuro\generating-reviews-discovering-sentiment-master\encoder.py in model(X, S, M, reuse) 88 def model(X, S, M=None, reuse=False): 89 nsteps = X.get_shape()[1] ---> 90 cstart, hstart = tf.unpack(S, num=hps.nstates) 91 with tf.variable_scope('model', reuse=reuse): 92 words = embd(X, hps.nembd) AttributeError: module 'tensorflow' has no attribute 'unpack' Is it because tensorflow has rename the unpack function to unstack? or any other functions? Any update on the code?
ahirner commented 7 years ago

Can you check your tensorflow version? If it's >= 1.0, #4 references a PR that should solve your issues.

yg37 commented 7 years ago

“It seems that it is because tf.unpack has been renamed to tf.unstack” Source: https://github.com/fchollet/keras/issues/5226

Newmu commented 7 years ago

We've upgraded code to tf v1+ https://github.com/openai/generating-reviews-discovering-sentiment/commit/83d940d132fbd585deb63b8e3fcb523ea9557683