practical_seq2seq icon indicating copy to clipboard operation
practical_seq2seq copied to clipboard

no attribute 'seq2seq'

Open rap9430 opened this issue 8 years ago • 9 comments

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

rap9430 avatar Feb 23 '17 20:02 rap9430

the same with u :-)

im trying to find some solutions

datagridview avatar Apr 20 '17 10:04 datagridview

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

lkluo avatar May 17 '17 09:05 lkluo

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

bandarikanth avatar Dec 26 '17 06:12 bandarikanth

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' "

kartikitrak avatar Oct 25 '18 03:10 kartikitrak

@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.

lkluo avatar Oct 25 '18 03:10 lkluo

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

kartikitrak avatar Oct 25 '18 07:10 kartikitrak

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

its5Q avatar Oct 27 '18 04:10 its5Q

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'

KingfaLuis avatar Nov 23 '18 06:11 KingfaLuis

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

prayagupa avatar Apr 14 '19 00:04 prayagupa