sherjilozair / char-rnn-tensorflow

Multi-layer Recurrent Neural Networks (LSTM, RNN) for character-level language models in Python using Tensorflow
MIT License
2.64k stars 960 forks source link

Compat issues with latest TF #31

Closed kastnerkyle closed 7 years ago

kastnerkyle commented 8 years ago

After building from HEAD of TF, I get some import errors for various things (almost every example on the web has this problem!)

I had to change imports in model.py to

from tensorflow.python.ops import rnn_cell
from tensorflow.python.ops import seq2seq

Downside is that importing tensorflow.models.rnn raises ImportError, so something like this is probably needed to preserve backwards compat:

try:
    from tensorflow.models.rnn import blah
except ImportError:
    from tensorflow.python.ops import blah
hunkim commented 8 years ago

I also noticed this issue. Feel free to send PR if you know how to fix it. I guess the fix is simple.

hunkim commented 8 years ago

I think we can check the version something like this:

import tensorflow as tf
print(tf.__version__)
sherjilozair commented 8 years ago

Thanks for the report @kastnerkyle. Could you perhaps send a PR for your try except fix?

kastnerkyle commented 8 years ago

I will see if I get some time, if someone doesn't beat me to it

On Thu, Jun 9, 2016 at 5:03 AM, Sherjil Ozair notifications@github.com wrote:

Thanks for the report @kastnerkyle https://github.com/kastnerkyle. Could you perhaps send a PR for your try except fix?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sherjilozair/char-rnn-tensorflow/issues/31#issuecomment-224875032, or mute the thread https://github.com/notifications/unsubscribe/ABfbHQ7hYpf1e1yGL3w_el1IW908vwDwks5qKAEHgaJpZM4IwJGQ .

prestonvanloon commented 7 years ago

I think these are under tensorflow.contrib.

This was working for me:

from tensorflow.contrib import rnn
from tensorflow.contrib import seq2seq
ubergarm commented 7 years ago

Everything should be working now with TF 1.0. The travis ci builds should help keep this repo up to date with latest TF.

Thanks all!