suriyadeepan / practical_seq2seq

A simple, minimal wrapper for tensorflow's seq2seq module, for experimenting with datasets rapidly
http://suriyadeepan.github.io/2016-12-31-practical-seq2seq/
GNU General Public License v3.0
569 stars 270 forks source link

no attribute 'seq2seq' #21

Open rap9430 opened 7 years ago

rap9430 commented 7 years ago

I get the following error: AttributeError: module 'tensorflow.python.ops.nn' has no attribute 'seq2seq' It should be related to my tensorflow's version. Although I tried with 0.11, 0.12 and 1.0, I cannot get it running. Any idea?

Thanks

datagridview commented 7 years ago

the same with u :-)

im trying to find some solutions

lkluo commented 7 years ago

what is your tensorflow version? try tensorflow.contrib.seq2seq if you are using the latest version.

bandarikanth commented 6 years ago

Hi, replace this code in previous code(in seq2seqwraper.py)

basic_cell = tf.contrib.rnn.core_rnn_cell.DropoutWrapper(
                tf.contrib.rnn.core_rnn_cell.BasicLSTMCell(emb_dim, state_is_tuple=True),
                output_keep_prob=self.keep_prob)
        # stack cells together : n layered model
        stacked_lstm = tf.contrib.rnn.core_rnn_cell.MultiRNNCell([basic_cell]*num_layers, state_is_tuple=True)

Thank you

kartikitrak commented 5 years ago

what is your tensorflow version? try tensorflow.contrib.seq2seq if you are using the latest version.

Earlier the error was "AttributeError: module 'tensorflow.contrib.seq2seq' has no attribute 'model_with_buckets'" and then I tried "tensorflow.contrib.seq2seq" and now the error is "AttributeError: module 'tensorflow.contrib.seq2seq' has no attribute 'model_with_buckets' "

lkluo commented 5 years ago

@kartikitrak : I think the problem is related to tensorflow version. You may downgrade tf to 1.2 (not sure the exact one when the repo was created) if you are using a newer version. Also there are plenty of more activate projects on seq2seq such as here.

kartikitrak commented 5 years ago

Thank you @lkluo, Anyone can confirm the version of tensorflow ?

its5Q commented 5 years ago

@kartikitrak, replace tensorflow.contrib.seq2seq with tensorflow.contrib.legacy_seq2seq Works for me

KingfaLuis commented 5 years ago

Mode : train

Preparing data in working_dir/ Tokenizing data in data/train.enc tokenizing line 100000 Tokenizing data in data/train.dec tokenizing line 100000 Tokenizing data in data/test.enc Tokenizing data in data/test.dec Creating 3 layers of 256 units. Traceback (most recent call last): File "F:/1_tensorflow/code/Technical-Analysis-And-Practice-in-TensorFlow-master/source/11/execute.py", line 300, in train() File "F:/1_tensorflow/code/Technical-Analysis-And-Practice-in-TensorFlow-master/source/11/execute.py", line 123, in train model = create_model(sess, False) File "F:/1_tensorflow/code/Technical-Analysis-And-Practice-in-TensorFlow-master/source/11/execute.py", line 95, in create_model model = seq2seq_model.Seq2SeqModel( gConfig['enc_vocab_size'], gConfig['dec_vocab_size'], _buckets, gConfig['layer_size'], gConfig['num_layers'], gConfig['max_gradient_norm'], gConfig['batch_size'], gConfig['learning_rate'], gConfig['learning_rate_decay_factor'], forward_only=forward_only) File "F:\1_tensorflow\code\Technical-Analysis-And-Practice-in-TensorFlow-master\source\11\seq2seq_model.py", line 147, in init self.outputs, self.losses = tf.nn.seq2seq.model_with_buckets( AttributeError: module 'tensorflow.nn' has no attribute 'seq2seq'

prayagupa commented 5 years ago

It did not work for me as well with tensorflow 1.0.+ but is working for me with "tensorflow 0.12.1",

## uninstall latest versions
pip uninstall tensorflow
Uninstalling tensorflow-1.1.0:
  Would remove:
    /usr/local/bin/tensorboard
    /usr/local/lib/python2.7/site-packages/external/*
    /usr/local/lib/python2.7/site-packages/tensorflow-1.1.0.dist-info/*
    /usr/local/lib/python2.7/site-packages/tensorflow/*
Proceed (y/n)? y
  Successfully uninstalled tensorflow-1.1.0

# install older tensorflow version
pip install tensorflow==0.12.1
λ python execute.py 

>> Mode : train

Preparing data in working_dir/
Creating 3 layers of 256 units.
WARNING:tensorflow:From /Users/prayagupd/soundofmusic/compile1010/tensorflow_chatbot/seq2seq_model.py:174 in __init__.: all_variables (from tensorflow.python.ops.variables) is deprecated and will be removed after 2017-03-02.
Instructions for updating:
Please use tf.global_variables instead.
Created model with fresh parameters.
WARNING:tensorflow:From execute.py:120 in create_model.: initialize_all_variables (from tensorflow.python.ops.variables) is deprecated and will be removed after 2017-03-02.
Instructions for updating:
Use `tf.global_variables_initializer` instead.
Reading development and training data (limit: 0).
  reading data line 100000