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

model is runnable but output vector is zeros #7

Closed lampts closed 7 years ago

lampts commented 7 years ago

I modified some lines of codes and can run it. However the output vector is all zeros.

v1 = model.transform(["hello"]) In [12]: np.allclose(v1[0],np.zeros(4096)) Out[12]: True

It seems that model cannot load the pretrained weights in the proper way.

cerisara commented 7 years ago

Got non-zero output with TF1.0.1 compliant version #4

lampts commented 7 years ago

Surprisingly, I have the same TF version.

In [1]: import tensorflow as tf

In [2]: tf.version Out[2]: '1.0.1'

xpact commented 7 years ago

I'm on 1.0.0 - still had to pick up the change for TF1.0.1 in order to run but the output is indeed all 0s. @lampts did you figure out what is going?

seangerrish commented 7 years ago

From my experiments the loop in transform,

for step in range(0, ceil_round_step(maxlen, nsteps), nsteps):

Isn't doing anything because maxlen is always 4.

xpact commented 7 years ago

In the end I gave up on Python 2.7 and TF 1.0.1 (or 1.0.0). If you use Python 3.4 (my version is 3.4.3) and TF 0.12.1 (I suspect 0.1X would work) it works out of the box and returns non-zero values.