Giter Site home page Giter Site logo

tensorflow_chatbot's Introduction

Tensorflow Chatbot

Tensorflow Chatbot Demo by @Sirajology on Youtube

Overview

This is the full code for 'How to Make an Amazing Tensorflow Chatbot Easily' by @Sirajology on Youtube. In this demo code, we implement Tensorflows Sequence to Sequence model to train a chatbot on the Cornell Movie Dialogue dataset. After training for a few hours, the bot is able to hold a fun conversation.

Dependencies

Use pip to install any missing dependencies

Usage

To train the bot, edit the seq2seq.ini file so that mode is set to train like so

mode = train

then run the code like so

python execute.py

To test the bot during or after training, edit the seq2seq.ini file so that mode is set to test like so

mode = test

then run the code like so

python execute.py

Challenge

The challenge for this video is write an entirely different script using TF Learn to generate Lord of the Ring style sentences. Check out this very similar example, it uses TF Learn to generate Shakespeare-style sentences. Train your model on Lord of the rings text to do something similar! And play around with the hyperparameters to get a more accurate result. Post your GitHub link in the video comments and I'll judge it!

Due date: December 8th

Also see this issue, some people have found this discussion helpful #3

Credits

Credit for the vast majority of code here goes to suriyadeepan. I've merely created a wrapper to get people started.

tensorflow_chatbot's People

Contributors

johndpope avatar llsourcell avatar sseidl88 avatar willgroves avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tensorflow_chatbot's Issues

Incomplete documentation on the training data

I tried to look through the issues and watched the video over and over again, but nowhere did I find an explanation of where the following files come from or how the corpus files could be converted to those.

train_enc = data/train.enc
train_dec = data/train.dec
test_enc = data/test.enc
test_dec = data/test.enc

Could information on this be added to the README?

Python newb stuck launching execute

Love the videos and the live coding is great too ;)

But I am struggling to get the project running as is before I start to make changes.

When I run $python execute.py I get the following
python execute.py

Mode : train

Preparing data in working_dir/
Tokenizing data in data/train.enc
Traceback (most recent call last):
File "execute.py", line 309, in
train()
File "execute.py", line 123, in train
enc_train, dec_train, enc_dev, dec_dev, _, _ = data_utils.prepare_custom_data(gConfig['working_directory'],gConfig['train_enc'],gConfig['train_dec'],gConfig['test_enc'],gConfig['test_dec'],gConfig['enc_vocab_size'],gConfig['dec_vocab_size'])
File "/Users/kelia01/Downloads/tensorflow_chatbot-master/data_utils.py", line 137, in prepare_custom_data
data_to_token_ids(train_enc, enc_train_ids_path, enc_vocab_path, tokenizer)
File "/Users/kelia01/Downloads/tensorflow_chatbot-master/data_utils.py", line 116, in data_to_token_ids
for line in data_file:
File "/Library/Python/2.7/site-packages/tensorflow/python/lib/io/file_io.py", line 156, in next
retval = self.readline()
File "/Library/Python/2.7/site-packages/tensorflow/python/lib/io/file_io.py", line 123, in readline
self._preread_check()
File "/Library/Python/2.7/site-packages/tensorflow/python/lib/io/file_io.py", line 73, in _preread_check
compat.as_bytes(self.__name), 1024 * 512, status)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 24, in exit
self.gen.next()
File "/Library/Python/2.7/site-packages/tensorflow/python/framework/errors_impl.py", line 469, in raise_exception_on_not_ok_status
pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.NotFoundError: data/train.enc

I walked the execution of the code manually but cannot figure out how it's not getting the data/train.enc

Thanks all!

Can't get a good enough perplexity score

Hi,
I have just run the script for 6 hours and noticed it didn't made any progress during the last 5 hours. The perplexity seems to be stuck at 1.35. The part of the code that reduce learning rate didn't reduced learning rate that much ....
What should I do from here ? Did you trained a good enough chat bot ? What were your settings ? Is perplexity an indicator of how good the chatbot is ?
Thanks.

Gibberish

Trained it for a lot of time on my computer. Eventually I tried testing for results. The results seem to be gibberish and repition of the same words.

How long did you train it. Thank you

What are some good 'questions' to ask the ChatBot as it's training?

I've got the chatbot training at the moment (for the past few hours), and I intermittently test it with simple inputs like 'hello' or 'Tom Cruise' or 'best movie?', but so far the outputs are nonsense (although they are changing, which I guess indicates that it's learning something!).

The video shows the test input of 'hello' eventually responding with 'how are you?' (mine currently responds with 'What ?'!), so I was wondering what are some other examples of inputs that should generate the claimed 'fun responses' when trained sufficiently?

(I'm running with the default settings of 3 layers of size 256 with batch size 64). My training output started at perplexity 377.94, but now on step 6600 the perplexity is down to 26.78. With this particular demo, would a specific step value or perplexity value indicate 'sufficiently trained now to start giving some meaningful responses'?

NotFoundError: data/test.enc

Hi,

I cant run it because there is not datasets.

How can I add it in order to run the script? I was not able to find solution and there was no instruction in readme.

TypeError: can't pickle _thread.lock objects

python3 execute.py

Mode : train

Preparing data in working_dir/
2017-05-21 11:54:31.378451: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-05-21 11:54:31.378491: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-05-21 11:54:31.378507: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-05-21 11:54:31.378523: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-05-21 11:54:31.378539: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
Creating 3 layers of 256 units.
Traceback (most recent call last):
File "execute.py", line 324, in
train()
File "execute.py", line 142, in train
model = create_model(sess, False)
File "execute.py", line 109, 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 "/mnt/newvolume/tensorflow_home/jupyter-notebooks_backup/tensorflow_chatbot-master/seq2seq_model.py", line 161, in init
lambda x, y: seq2seq_f(x, y, False))
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py", line 849, in embedding_attention_seq2seq
encoder_cell = copy.deepcopy(cell)
File "/usr/lib/python3.5/copy.py", line 155, in deepcopy
y = copier(x, memo)
File "/usr/lib/python3.5/copy.py", line 218, in _deepcopy_list
y.append(deepcopy(a, memo))
File "/usr/lib/python3.5/copy.py", line 182, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "/usr/lib/python3.5/copy.py", line 297, in _reconstruct
state = deepcopy(state, memo)
File "/usr/lib/python3.5/copy.py", line 155, in deepcopy
y = copier(x, memo)
File "/usr/lib/python3.5/copy.py", line 243, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/lib/python3.5/copy.py", line 182, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "/usr/lib/python3.5/copy.py", line 297, in _reconstruct
state = deepcopy(state, memo)
File "/usr/lib/python3.5/copy.py", line 155, in deepcopy
y = copier(x, memo)
File "/usr/lib/python3.5/copy.py", line 243, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/lib/python3.5/copy.py", line 182, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "/usr/lib/python3.5/copy.py", line 297, in _reconstruct
state = deepcopy(state, memo)
File "/usr/lib/python3.5/copy.py", line 155, in deepcopy
y = copier(x, memo)
File "/usr/lib/python3.5/copy.py", line 243, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/lib/python3.5/copy.py", line 174, in deepcopy
rv = reductor(4)
TypeError: can't pickle _thread.lock objects

Not Restoring Checkpoints

Hey all,

I was wondering if any of you have been encountering issues with restoring to previous checkpoints? After running the program in train mode for a few hours (step 4500), I attempted to test my results. When I did, I noticed that "Created model with fresh parameters" showed up in the terminal. So, from reading through the code, to my understanding, this means my previous checkpoint wasn't loaded.

Along with that, when I went to "train" mode again, it said it created a new model as well. I believe there is something wrong with the create_model function where lines 110-113 in execute.py are not retrieving and loading the model correctly. Looking through TensorFlow documentation, I believe this is because my checkpoints are being saved in three files. A .index, .meta, and .data-00000-of-00001 are being created instead of a .ckpt as described in the documentation. (See screen-shot)
image

Is anyone else having this problem or knows how to fix it? Do I need to use a different restore or save function? If anyone has more experience with TensorFlow and could help I'd appreciate it.

TL;DR: Unable to restore checkpoints because three files are being created instead of one .ckpt file?

After long time training ,when I run with "test", but get Error "IndexError: list index out of range"

After trained enough, I run with "test" and input someting. But get Error.

hello
Traceback (most recent call last):
File "E:/A Files/chatbot-master/execute.py", line 324, in
decode()
File "E:/A Files/chatbot-master/execute.py", line 245, in decode
print(" ".join([tf.compat.as_str(rev_dec_vocab[output]) for output in outputs]))
File "E:/A Files/chatbot-master/execute.py", line 245, in
print(" ".join([tf.compat.as_str(rev_dec_vocab[output]) for output in outputs]))
IndexError: list index out of range

'module' object has no attribute 'seq2seq'

I run the execute.py and receive this error.
`>> Mode : train

Preparing data in working_dir/
2017-07-30 20:40:34.971282: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-07-30 20:40:34.971452: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-07-30 20:40:34.971593: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-07-30 20:40:34.971732: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-07-30 20:40:34.971872: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
Creating 3 layers of 256 units.
Traceback (most recent call last):
File "execute.py", line 319, in
train()
File "execute.py", line 137, in train
model = create_model(sess, False)
File "execute.py", line 104, 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 "/home/bugsbunny/tensorflow_chatbot/seq2seq_model.py", line 146, in init
self.outputs, self.losses = tf.nn.seq2seq.model_with_buckets(
AttributeError: 'module' object has no attribute 'seq2seq'`

My tensorflow version is 1.2 and so is my tensorflow-gpu

Issues after changing all the imports for TF 1.0.0

I'm trying to run this tensorflow_chatbot under the new version released TF 1.0.0. And I had a lot of "import troubles", which I fixed by following the advices of TF's devs.

tf.nn.rnn_cell.* and most functions in tf.nn.rnn.* (with the exception of dynamic_rnn and raw_rnn) are temporarily in tf.contrib.rnn. They will be moved back into core for TF 1.1.

But even after all this work I still have an error.

Traceback (most recent call last):
File "C:\Users\pauls\Anaconda3\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 670, in _call_cpp_shape_fn_impl
status)
File "C:\Users\pauls\Anaconda3\lib\contextlib.py", line 66, in exit
next(self.gen)
File "C:\Users\pauls\Anaconda3\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 469, in raise_exception_on_not_ok_status
pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: Shape must be rank 2 but is rank 1 for 'model_with_buckets/sequence_loss/sequence_loss_by_example/sampled_softmax_loss/LogUniformCandidateSampler' (op: 'LogUniformCandidateSampler') with input shapes: [?].
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/pauls/Desktop/4. Stela/Chatbot project/chatBot-master/execute.py", line 303, in
decode()
File "C:/Users/pauls/Desktop/4. Stela/Chatbot project/chatBot-master/execute.py", line 192, in decode
model = create_model(sess, True)
File "C:/Users/pauls/Desktop/4. Stela/Chatbot project/chatBot-master/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 "C:\Users\pauls\Desktop\4. Stela\Chatbot project\chatBot-master\seq2seq_model.py", line 135, in init
softmax_loss_function=softmax_loss_function)
File "C:\Users\pauls\Anaconda3\lib\site-packages\tensorflow\contrib\legacy_seq2seq\python\ops\seq2seq.py", line 1195, in model_with_buckets
softmax_loss_function=softmax_loss_function))
File "C:\Users\pauls\Anaconda3\lib\site-packages\tensorflow\contrib\legacy_seq2seq\python\ops\seq2seq.py", line 1110, in sequence_loss
softmax_loss_function=softmax_loss_function))
File "C:\Users\pauls\Anaconda3\lib\site-packages\tensorflow\contrib\legacy_seq2seq\python\ops\seq2seq.py", line 1067, in sequence_loss_by_example
crossent = softmax_loss_function(target, logit)
File "C:\Users\pauls\Desktop\4. Stela\Chatbot project\chatBot-master\seq2seq_model.py", line 92, in sampled_loss
self.target_vocab_size)
File "C:\Users\pauls\Anaconda3\lib\site-packages\tensorflow\python\ops\nn_impl.py", line 1191, in sampled_softmax_loss
name=name)
File "C:\Users\pauls\Anaconda3\lib\site-packages\tensorflow\python\ops\nn_impl.py", line 947, in _compute_sampled_logits
range_max=num_classes)
File "C:\Users\pauls\Anaconda3\lib\site-packages\tensorflow\python\ops\candidate_sampling_ops.py", line 134, in log_uniform_candidate_sampler
seed2=seed2, name=name)
File "C:\Users\pauls\Anaconda3\lib\site-packages\tensorflow\python\ops\gen_candidate_sampling_ops.py", line 357, in _log_uniform_candidate_sampler
name=name)
File "C:\Users\pauls\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 763, in apply_op
op_def=op_def)
File "C:\Users\pauls\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 2397, in create_op
set_shapes_for_outputs(ret)
File "C:\Users\pauls\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 1757, in set_shapes_for_outputs
shapes = shape_func(op)
File "C:\Users\pauls\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 1707, in call_with_requiring
return call_cpp_shape_fn(op, require_shape_fn=True)
File "C:\Users\pauls\Anaconda3\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 610, in call_cpp_shape_fn
debug_python_shape_fn, require_shape_fn)
File "C:\Users\pauls\Anaconda3\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 675, in _call_cpp_shape_fn_impl
raise ValueError(err.message)
ValueError: Shape must be rank 2 but is rank 1 for 'model_with_buckets/sequence_loss/sequence_loss_by_example/sampled_softmax_loss/LogUniformCandidateSampler' (op: 'LogUniformCandidateSampler') with input shapes: [?].

I would like to know if anyone has a solution?

Missing train directory?

Traceback (most recent call last):
  File "C:\Users\Sinclair\Desktop\tensorflow_chatbot-master\execute.py", line 319, in <module>
    train()
  File "C:\Users\Sinclair\Desktop\tensorflow_chatbot-master\execute.py", line 127, in train
    enc_train, dec_train, enc_dev, dec_dev, _, _ = data_utils.prepare_custom_data(gConfig['working_directory'],gConfig['train_enc'],gConfig['train_dec'],gConfig['test_enc'],gConfig['test_dec'],gConfig['enc_vocab_size'],gConfig['dec_vocab_size'])
  File "C:\Users\Sinclair\Desktop\tensorflow_chatbot-master\data_utils.py", line 137, in prepare_custom_data
    data_to_token_ids(train_enc, enc_train_ids_path, enc_vocab_path, tokenizer)
  File "C:\Users\Sinclair\Desktop\tensorflow_chatbot-master\data_utils.py", line 116, in data_to_token_ids
    for line in data_file:
  File "F:\Python\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 162, in __next__
    return self.next()
  File "F:\Python\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 156, in next
    retval = self.readline()
  File "F:\Python\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 123, in readline
    self._preread_check()
  File "F:\Python\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 73, in _preread_check
    compat.as_bytes(self.__name), 1024 * 512, status)
  File "F:\Python\lib\contextlib.py", line 66, in __exit__
    next(self.gen)
  File "F:\Python\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 469, in raise_exception_on_not_ok_status
    pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.NotFoundError: NewRandomAccessFile failed to Create/Open: data/train.enc : The system cannot find the path specified.

This is the error message I get, and from what I can tell I'm missing a folder "data" that contains a training set. Is there a specific way I have to create this? I tried creating my own data folder and plopped the vocab2000 files into it, renaming them to train.dec and train.enc, but that just gave me a different error.

Any advice would be much appreciated!

Unsuccessful TensorSliceReader constructor

I keep getting the error

NotFoundError (see above for traceback): Unsuccessful TensorSliceReader constructor: Failed to find any matching files for C:\Users\jonsa\Desktop\tensorflow_chatbot-master\working_dir\seq2seq.ckpt-143100
[[Node: save/RestoreV2_1 = RestoreV2[dtypes=[DT_INT32], _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/RestoreV2_1/tensor_names, save/RestoreV2_1/shape_and_slices)]]
[[Node: save/RestoreV2_17/_1 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/gpu:0", send_device="/job:localhost/replica:0/task:0/cpu:0", send_device_incarnation=1, tensor_name="edge_18_save/RestoreV2_17", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/gpu:0"]]

I am not sure why it is not locating the file when I see the file sitting in the directory \working_dir\

any help would be great thanks

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position N: invalid start byte

This is the traceback:

(venv_tf_chatbot) tmba:tensorflow_chatbot thill $ python execute.py

>> Mode : train

Preparing data in working_dir/
Tokenizing data in data/test.enc
Traceback (most recent call last):
  File "execute.py", line 319, in <module>
    train()
  File "execute.py", line 127, in train
    enc_train, dec_train, enc_dev, dec_dev, _, _ = data_utils.prepare_custom_data(gConfig['working_directory'],gConfig['train_enc'],gConfig['train_dec'],gConfig['test_enc'],gConfig['test_dec'],gConfig['enc_vocab_size'],gConfig['dec_vocab_size'])
  File "/Users/thill/projects/play/python/tensorflow_chatbot/data_utils.py", line 146, in prepare_custom_data
    data_to_token_ids(test_enc, enc_dev_ids_path, enc_vocab_path, tokenizer)
  File "/Users/thill/projects/play/python/tensorflow_chatbot/data_utils.py", line 119, in data_to_token_ids
    for line in data_file:
  File "/Users/thill/projects/play/python/tensorflow_chatbot/venv_tf_chatbot/lib/python3.6/site-packages/tensorflow/python/lib/io/file_io.py", line 162, in __next__
    return self.next()
  File "/Users/thill/projects/play/python/tensorflow_chatbot/venv_tf_chatbot/lib/python3.6/site-packages/tensorflow/python/lib/io/file_io.py", line 156, in next
    retval = self.readline()
  File "/Users/thill/projects/play/python/tensorflow_chatbot/venv_tf_chatbot/lib/python3.6/site-packages/tensorflow/python/lib/io/file_io.py", line 124, in readline
    return compat.as_str_any(self._read_buf.ReadLineAsString())
  File "/Users/thill/projects/play/python/tensorflow_chatbot/venv_tf_chatbot/lib/python3.6/site-packages/tensorflow/python/util/compat.py", line 106, in as_str_any
    return as_str(value)
  File "/Users/thill/projects/play/python/tensorflow_chatbot/venv_tf_chatbot/lib/python3.6/site-packages/tensorflow/python/util/compat.py", line 84, in as_text
    return bytes_or_text.decode(encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position 16: invalid start byte

Each time I tried to run python execute.py I got a different position N in the traceback.
After 5 attempted runs something finally fixed itself and I can now run as expected.

Has anyone else encountered this?

No reference to data/test.dec in seq2seq.ini?

Perhaps more of a question than potential issue, but why in seq2seq.ini does test_dec reference data/test.enc not data/test.dec?

[seq2seq.ini]
mode = train
train_enc = data/train.enc
train_dec = data/train.dec
test_enc = data/test.enc
test_dec = data/test.enc

Bucket perplexity increasing : why ?

Hi, I finally managed to have a workable chatbot in Python 3. It isn't trained enough for the moment but gives quite interesting answers.
What bothers me is that while overall perplexity decreases as it should (for 300 to 8.90 approximately), the bucket perplexity increase at each step with a perplexity of approximately 2000 while it was almost below 100 at start.
I just wanted to know how a seq2seq model can see it's bucket perplexity increase ? What causes it and why does the chatbot seems to improve despite this issue ?

osx - UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 1: invalid start byte

steps - I used the cpu only option

Mac OS X, CPU only, Python 3.4 or 3.5:

$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0rc0-py3-none-any.whl

Mac OS X, GPU enabled, Python 3.4 or 3.5:

$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-0.12.0rc0-py3-none-any.whl
Install TensorFlow:

Python 3

$ sudo pip3 install --upgrade $TF_BINARY_URL

python3 execute.py

Mode : train

Preparing data in working_dir/
Tokenizing data in data/train.enc
Traceback (most recent call last):
File "execute.py", line 300, in
train()
File "execute.py", line 114, in train
enc_train, dec_train, enc_dev, dec_dev, _, _ = data_utils.prepare_custom_data(gConfig['working_directory'],gConfig['train_enc'],gConfig['train_dec'],gConfig['test_enc'],gConfig['test_dec'],gConfig['enc_vocab_size'],gConfig['dec_vocab_size'])
File "/Users/johndpope/Documents/gitWorkspace/tensorflow_chatbot/data_utils.py", line 137, in prepare_custom_data
data_to_token_ids(train_enc, enc_train_ids_path, enc_vocab_path, tokenizer)
File "/Users/johndpope/Documents/gitWorkspace/tensorflow_chatbot/data_utils.py", line 112, in data_to_token_ids
vocab, _ = initialize_vocabulary(vocabulary_path)
File "/Users/johndpope/Documents/gitWorkspace/tensorflow_chatbot/data_utils.py", line 87, in initialize_vocabulary
rev_vocab.extend(f.readlines())
File "/usr/local/lib/python3.5/site-packages/tensorflow/python/lib/io/file_io.py", line 131, in readlines
s = self.readline()
File "/usr/local/lib/python3.5/site-packages/tensorflow/python/lib/io/file_io.py", line 124, in readline
return compat.as_str_any(self._read_buf.ReadLineAsString())
File "/usr/local/lib/python3.5/site-packages/tensorflow/python/util/compat.py", line 106, in as_str_any
return as_str(value)
File "/usr/local/lib/python3.5/site-packages/tensorflow/python/util/compat.py", line 84, in as_text
return bytes_or_text.decode(encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 1: invalid start byte

How long does it normally take to train the sample data

Sorry this is a basic question. I have 2.5 GHz Intel i7 quad core on Mac and when I ran execute.py to train, it heated my CPUs to 90 Celsius so I had to shut it off after 5 minutes because I was worried about heat damage. I am running the tensorflow CPU only installation.

Here is where I stopped it

global step 300 learning rate 0.5000 step-time 1.42 perplexity 455.42
eval: bucket 0 perplexity 138.66
eval: bucket 1 perplexity 202.11
eval: bucket 2 perplexity 235.91
eval: bucket 3 perplexity 282.56

It was using all of my RAM and I was wondering if I did something wrong. Should I use the GPU installation? How long does it normally take? I don't want to risk overheating. Thanks!

(non-issue)could this chat bot used in chinese language?

@llSourcell hi
great work!

I 'm wondering if this project could be used for chinese language?
If ,it is could .how to do this work?
I just need a chinese conversation file which contains ASK and Answer in separate line .Right?

could you please give a instructions for doing this ?
Thank you very much !

ValueError: Attempt to reuse RNNCell

After editing the seq2seq_model.py file. I changed cells values from tf.rnn to tf.contrib.rnn and etc.
Now I am getting this error:

ValueError: Attempt to reuse RNNCell <tensorflow.contrib.rnn.python.ops.core_rnn_cell_impl.GRUCell object at 0x11b9f5790> with a different variable scope than its first use. First use of cell was with scope 'embedding_attention_seq2seq/rnn/multi_rnn_cell/cell_0/gru_cell', this attempt is with scope 'embedding_attention_seq2seq/rnn/multi_rnn_cell/cell_1/gru_cell'. Please create a new instance of the cell if you would like it to use a different set of weights. If before you were using: MultiRNNCell([GRUCell(...)] * num_layers), change to: MultiRNNCell([GRUCell(...) for _ in range(num_layers)]). If before you were using the same cell instance as both the forward and reverse cell of a bidirectional RNN, simply create two instances (one for forward, one for reverse). In May 2017, we will start transitioning this cell's behavior to use existing stored weights, if any, when it is called with scope=None (which can lead to silent model degradation, so this error will remain until then.)

Any idea?
thank you in advance

Error at reading data line 100000: Received a label value of 19143 which is outside the valid range of [0, 256).

Anyhow has a similar issue?

Run the following command

$ python execute.py

And the error:

Reading development and training data (limit: 0).
reading data line 100000
W tensorflow/core/framework/op_kernel.cc:993] Invalid argument: Received a label value of 19143 which is outside the valid range of [0, 256). Label values: 149 567 18943 7 7 1024 7 78 20 160 1216 320 11712 78 273 5 33 566 78 138 20 212 1650 392 104 1359 69 83 14028 3 241 487 33 273 7 33 142 3 7 619 547 7 7 124 33 415 4 2753 3035 33 562 79 79 127 354 47 19143 62 117 20 33 1664 78 6290
W tensorflow/core/framework/op_kernel.cc:993] Invalid argument: Received a label value of 10939 which is outside the valid range of [0, 256). Label values: 13 5942 168 5 64 4 5 4 25 221 32 9 595 4 7 149 48 141 30 31 29 6 8 4 9 114 8 6 4 7 34 4 5 8 44 9 111 10245 5 59 9 5 136 5 52 6 4 4 2 42 15 6 15 8 150 9 7804 10939 924 96 5 13 16 19
W tensorflow/core/framework/op_kernel.cc:993] Invalid argument: Received a label value of 5787 which is outside the valid range of [0, 256). Label values: 527 4 37 24 11 2 24 2 37 23 102 2 108 2 42 750 3 4 15 80 11 7 5787 2 2 9 29 7 2 25 6 4 85 267 5 2 252 2249 24 16 2 24 10 14 8 342 4 2 0 9 144 161 5 125 453 190 16 3 1060 21 85 369 2 2326
W tensorflow/core/framework/op_kernel.cc:993] Invalid argument: Received a label value of 10895 which is outside the valid range of [0, 256). Label values: 4 2 1665 87 600 0 295 0 221 950 812 0 50 0 9 5 9 2 23 949 436 488 9 0 0 2 11 100 0 8 125 4 8 42 14 0 4 168 279 2 0 279 280 36 196 4 15 0 0 33 6 9 12 11 4 42 10895 9 4 13 15 358 0 4
W tensorflow/core/framework/op_kernel.cc:993] Invalid argument: Received a label value of 10079 which is outside the valid range of [0, 256). Label values: 528 0 4 2577 13 0 189 0 4 4 4 0 3 0 2 9 2 0 4 4 26 18 2 0 0 0 398 4 0 9 34 148 36 7 130 0 2 13 4 0 0 4 4 15 9 745 23 0 0 10079 4101 2 40 5360 2 100 16 2 2 644 106 4 0 2
W tensorflow/core/framework/op_kernel.cc:993] Invalid argument: Received a label value of 19143 which is outside the valid range of [0, 256). Label values: 9 0 2 87 300 0 4 0 2 2 2 0 9 0 0 2 0 0 2 2 294 838 0 0 0 0 37 2 0 2 4 7 9 137 10 0 0 568 337 0 0 2 2 16 16 807 77 0 0 9 30 0 13 30 0 43 19143 0 0 9 9 2 0 0
W tensorflow/core/framework/op_kernel.cc:993] Invalid argument: Received a label value of 8089 which is outside the valid range of [0, 256). Label values: 2 0 0 290 4 0 2 0 0 0 0 0 2 0 0 0 0 0 0 0 4 4 0 0 0 0 287 0 0 0 4 444 2 9 6065 0 0 8089 4 0 0 0 0 2 2 4 34 0 0 2 2 0 261 2 0 106 16 0 0 2 2 0 0 0
W tensorflow/core/framework/op_kernel.cc:993] Invalid argument: Received a label value of 13568 which is outside the valid range of [0, 256). Label values: 0 0 0 3 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 0 0 0 0 4 0 0 0 4 9 0 2 4 0 0 4 2 0 0 0 0 0 0 2 4 0 0 0 0 0 13568 0 0 9 2 0 0 0 0 0 0 0
Traceback (most recent call last):
File "execute.py", line 319, in
train()
File "execute.py", line 169, in train
target_weights, bucket_id, False)
File "/Users/user/tensorflow/chatbot-master/seq2seq_model.py", line 238, in step
outputs = session.run(output_feed, input_feed)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 767, in run
run_metadata_ptr)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 965, in _run
feed_dict_string, options, run_metadata)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1015, in _do_run
target_list, options, run_metadata)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1035, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Received a label value of 19143 which is outside the valid range of [0, 256). Label values: 149 567 18943 7 7 1024 7 78 20 160 1216 320 11712 78 273 5 33 566 78 138 20 212 1650 392 104 1359 69 83 14028 3 241 487 33 273 7 33 142 3 7 619 547 7 7 124 33 415 4 2753 3035 33 562 79 79 127 354 47 19143 62 117 20 33 1664 78 6290
[[Node: model_with_buckets/sequence_loss/sequence_loss_by_example/SparseSoftmaxCrossEntropyWithLogits/SparseSoftmaxCrossEntropyWithLogits = SparseSoftmaxCrossEntropyWithLogits[T=DT_FLOAT, Tlabels=DT_INT32, _device="/job:localhost/replica:0/task:0/cpu:0"](model_with_buckets/embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/AttnOutputProjection/BiasAdd, model_with_buckets/sequence_loss/sequence_loss_by_example/Reshape)]]

Caused by op u'model_with_buckets/sequence_loss/sequence_loss_by_example/SparseSoftmaxCrossEntropyWithLogits/SparseSoftmaxCrossEntropyWithLogits', defined at:
File "execute.py", line 319, in
train()
File "execute.py", line 137, in train
model = create_model(sess, False)
File "execute.py", line 104, 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 "/Users/user/tensorflow/chatbot-master/seq2seq_model.py", line 166, in init
softmax_loss_function=softmax_loss_function)
File "/usr/local/lib/python2.7/site-packages/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py", line 1195, in model_with_buckets
softmax_loss_function=softmax_loss_function))
File "/usr/local/lib/python2.7/site-packages/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py", line 1110, in sequence_loss
softmax_loss_function=softmax_loss_function))
File "/usr/local/lib/python2.7/site-packages/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py", line 1065, in sequence_loss_by_example
labels=target, logits=logit)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/ops/nn_ops.py", line 1713, in sparse_softmax_cross_entropy_with_logits
precise_logits, labels, name=name)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/ops/gen_nn_ops.py", line 2378, in _sparse_softmax_cross_entropy_with_logits
features=features, labels=labels, name=name)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 763, in apply_op
op_def=op_def)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2395, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1264, in init
self._traceback = _extract_stack()

InvalidArgumentError (see above for traceback): Received a label value of 19143 which is outside the valid range of [0, 256). Label values: 149 567 18943 7 7 1024 7 78 20 160 1216 320 11712 78 273 5 33 566 78 138 20 212 1650 392 104 1359 69 83 14028 3 241 487 33 273 7 33 142 3 7 619 547 7 7 124 33 415 4 2753 3035 33 562 79 79 127 354 47 19143 62 117 20 33 1664 78 6290
[[Node: model_with_buckets/sequence_loss/sequence_loss_by_example/SparseSoftmaxCrossEntropyWithLogits/SparseSoftmaxCrossEntropyWithLogits = SparseSoftmaxCrossEntropyWithLogits[T=DT_FLOAT, Tlabels=DT_INT32, _device="/job:localhost/replica:0/task:0/cpu:0"](model_with_buckets/embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/AttnOutputProjection/BiasAdd, model_with_buckets/sequence_loss/sequence_loss_by_example/Reshape)]]

not able to restart training from a checkpoint.

It always creates model with fresh parameters and it seems that
tf.gfile.Exists(ckpt.model_checkpoint_path + checkpoint_suffix)
check fails.

Using tensorflow 0.11.0, haven't tried with 0.12.0.

Output of ckpt.model_checkpoint_path is a file that doesn't exist in the directory.

How to update dataset every day and train chatbot on updated dataset.

Hi
I have created chatbot on Cornell movie dataset and it's working fine. I have trained chatbot application up to global step 330000. I am also receiving output. But I wish to modify dataset in train.enc and train.dec. I have deleted train.enc.ids20000,train.dec.ids20000 file. Then I created this new file by running chatbot application with updated files. Now should I delete working_dir checkpoints and start training once again for new files or it is not necessary and new changes will be added on it's own by chatbot code.

I wish to know how to improve tensorflow chatbot. I wish to add new sentence in train.enc and train.dec every day to improve the result. Should i delete working_dir content every day and then train once again from 0.

Useless output at 42500 steps

I'm currently using python3 with #46

`Reading model parameters from working_dir/seq2seq.ckpt-42500

hello

how are you?
I ' m not .
you're not?
No .
what colo is the sky?
_UNK .
who are you?
I ' m not .
Whats your name?
_UNK .
`

This is my last eval

global step 42500 learning rate 0.0383 step-time 0.46 perplexity 18.02
eval: bucket 0 perplexity 1329.99
eval: bucket 1 perplexity 1946.94
eval: bucket 2 perplexity 1677.25
eval: bucket 3 perplexity 1582.53

With settings

# number of LSTM layers : 1/2/3
num_layers = 1
# typical options : 128, 256, 512, 1024
layer_size = 128
learning_rate = 0.09

This out put seems useless. I see that there is a python3 #22

Is it worth attempting the python3 fix along with the TF 1.2 fix? Or is my best bet to run Tensorflow 0.12 in my python 2+ environment?

ValueError: Attempt to reuse RNNCell <tensorflow.contrib.rnn.python.ops.core_rnn_cell_impl.GRUCell object at 0x7f8317334a90> with a different variable scope than its first use.

sudo python3 execute.py

Mode : train

Preparing data in working_dir/
2017-05-22 13:05:16.764861: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-05-22 13:05:16.764899: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-05-22 13:05:16.764908: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-05-22 13:05:16.764916: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-05-22 13:05:16.764922: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
Creating 3 layers of 256 units.
Traceback (most recent call last):
File "execute.py", line 324, in
train()
File "execute.py", line 142, in train
model = create_model(sess, False)
File "execute.py", line 109, 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 "/mnt/newvolume/tensorflow_home/jupyter-notebooks_backup/tensorflow_chatbot-master/seq2seq_model.py", line 179, in init
softmax_loss_function=softmax_loss_function)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py", line 1201, in model_with_buckets
decoder_inputs[:bucket[1]])
File "/mnt/newvolume/tensorflow_home/jupyter-notebooks_backup/tensorflow_chatbot-master/seq2seq_model.py", line 178, in
lambda x, y: seq2seq_f(x, y, False),
File "/mnt/newvolume/tensorflow_home/jupyter-notebooks_backup/tensorflow_chatbot-master/seq2seq_model.py", line 142, in seq2seq_f
dtype=dtype)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py", line 855, in embedding_attention_seq2seq
encoder_cell, encoder_inputs, dtype=dtype)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/rnn/python/ops/core_rnn.py", line 197, in static_rnn
(output, state) = call_cell()
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/rnn/python/ops/core_rnn.py", line 184, in
call_cell = lambda: cell(input
, state)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/rnn/python/ops/core_rnn_cell_impl.py", line 881, in call
return self._cell(embedded, state)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/rnn/python/ops/core_rnn_cell_impl.py", line 953, in call
cur_inp, new_state = cell(cur_inp, cur_state)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/rnn/python/ops/core_rnn_cell_impl.py", line 146, in call
with _checked_scope(self, scope or "gru_cell", reuse=self._reuse):
File "/usr/lib/python3.5/contextlib.py", line 59, in enter
return next(self.gen)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/rnn/python/ops/core_rnn_cell_impl.py", line 77, in _checked_scope
type(cell).name))
ValueError: Attempt to reuse RNNCell <tensorflow.contrib.rnn.python.ops.core_rnn_cell_impl.GRUCell object at 0x7f8317334a90> with a different variable scope than its first use. First use of cell was with scope 'embedding_attention_seq2seq/embedding_attention_decoder/attention_decoder/multi_rnn_cell/cell_0/gru_cell', this attempt is with scope 'embedding_attention_seq2seq/rnn/multi_rnn_cell/cell_0/gru_cell'. Please create a new instance of the cell if you would like it to use a different set of weights. If before you were using: MultiRNNCell([GRUCell(...)] * num_layers), change to: MultiRNNCell([GRUCell(...) for _ in range(num_layers)]). If before you were using the same cell instance as both the forward and reverse cell of a bidirectional RNN, simply create two instances (one for forward, one for reverse). In May 2017, we will start transitioning this cell's behavior to use existing stored weights, if any, when it is called with scope=None (which can lead to silent model degradation, so this error will remain until then.)

Breaks in latest TensorFlow 1.0.0

I spent a few hours trying to translate this into TF 1.0.0 based on the error messages. I gave up in a puddle of tears.

I'm going to try this in TF.12.

Mac OSX Sierra missing imports

Hey, so I was trying to check out TensorFlow based on your video and came across and issue.

For what ever reason, both seq2seq_model and data_util I keep getting this error:
"Traceback (most recent call last):
File "", line 1, in
ImportError: No module named seq2seq_model"

Thoughts? Solutions? Tid bits of advice?

A small problem

train_enc = data/train.enc
train_dec = data/train.dec
test_enc = data/test.enc
test_dec = data/test.enc

There are two “data/test.enc”, change "test_dec = data/test.dec"

how to test the chatbot

Hi people, when I run execute.py with test mode im getting this

python execute.py

Mode : test
Reading model parameters from working_dir/seq2seq.ckpt-266100

hi
size _UNK
hello
size _UNK

Am I doing something wrong? the unzipped cornel data is in tensorflow_chatbot/data/ and I did uncomment the last line so that prepare_seq2seq_files(questions,answers) executes.

after training for days on GPU...

...the conversations are gibberish (

[tf] Forget here , look .
[me] are you a robot
[tf] Oh not .
[me] what is your name?
[tf] Long it is always Isn ' d just drop with for awhile

tensorflow 0.12

training:

  eval: bucket 0 perplexity 1153481202401.01
  eval: bucket 1 perplexity 3621452378204.35
  eval: bucket 2 perplexity 5702366989115.59
  eval: bucket 3 perplexity 294104169518.42

settings in ini (python 2.7, GFX GPU, Linux)

# vocabulary size
enc_vocab_size = 40000
dec_vocab_size = 40000
num_layers = 3
layer_size = 256
max_train_data_size = 0
batch_size = 64
steps_per_checkpoint = 300
[floats]
learning_rate = 0.5
learning_rate_decay_factor = 0.99
max_gradient_norm = 5.0

so I'm wondering if I should look elsewhere for different conversational data? Is there a tool in your repo for turning a dataset into the enc/dec format you're expecting? I can write one but didn't want to duplicate work.

neuralconvo.ini + missing data/train.enc

the neuralconvo.ini specifies following files

[strings]

Mode : train, test, serve

mode = train
train_enc = data/train.enc
train_dec = data/train.dec
test_enc = data/test.enc
test_dec = data/test.enc

but there is no data folder in repo.
there is the working_dir

python3 execute.py

Mode : train

Preparing data in working_dir/
Tokenizing data in data/train.enc
Traceback (most recent call last):
File "execute.py", line 313, in
train()
File "execute.py", line 127, in train
enc_train, dec_train, enc_dev, dec_dev, _, _ = data_utils.prepare_custom_data(gConfig['working_directory'],gConfig['train_enc'],gConfig['train_dec'],gConfig['test_enc'],gConfig['test_dec'],gConfig['enc_vocab_size'],gConfig['dec_vocab_size'])
File "/Users/johndpope/Documents/gitWorkspace/tensorflow_chatbot/data_utils.py", line 137, in prepare_custom_data
data_to_token_ids(train_enc, enc_train_ids_path, enc_vocab_path, tokenizer)
File "/Users/johndpope/Documents/gitWorkspace/tensorflow_chatbot/data_utils.py", line 121, in data_to_token_ids
normalize_digits)
File "/Users/johndpope/Documents/gitWorkspace/tensorflow_chatbot/data_utils.py", line 100, in sentence_to_token_ids
words = basic_tokenizer(sentence)
File "/Users/johndpope/Documents/gitWorkspace/tensorflow_chatbot/data_utils.py", line 50, in basic_tokenizer
words.extend(re.split(_WORD_SPLIT, space_separated_fragment))
File "/usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/re.py", line 203, in split
return _compile(pattern, flags).split(string, maxsplit)
TypeError: cannot use a bytes pattern on a string-like object

Error while running execute.py

getting this error while executing "python3 execute.py"
Help please

Traceback (most recent call last): File "execute.py", line 303, in <module> decode() File "execute.py", line 199, in decode enc_vocab, _ = data_utils.initialize_vocabulary(enc_vocab_path) File "/Users/sagarsuri/Downloads/tensorflow_chatbot-master/data_utils.py", line 87, in initialize_vocabulary rev_vocab.extend(f.readlines()) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensorflow/python/lib/io/file_io.py", line 131, in readlines s = self.readline() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensorflow/python/lib/io/file_io.py", line 124, in readline return compat.as_str_any(self._read_buf.ReadLineAsString()) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensorflow/python/util/compat.py", line 106, in as_str_any return as_str(value) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensorflow/python/util/compat.py", line 84, in as_text return bytes_or_text.decode(encoding) UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 1: invalid start byte

ImportError: No module named 'tensorflow.models'

Windows 10
Python=3.5.2
all packages up to date

I have tried it from python shell and cmd with same result:
Traceback (most recent call last): File "C:\Users\aweso\Desktop\tensorflow_chatbot\execute.py", line 31, in <module> import seq2seq_model File "C:\Users\aweso\Desktop\tensorflow_chatbot\seq2seq_model.py", line 28, in <module> from tensorflow.models.rnn.translate import data_utils ImportError: No module named 'tensorflow.models'

No module named models.rnn.translate

Traceback (most recent call last):
File "execute.py", line 31, in
import seq2seq_model
File "tensorflow_chatbot/seq2seq_model.py", line 28, in
from tensorflow.models.rnn.translate import data_utils
ImportError: No module named models.rnn.translate

AttributeError: module 'execute' has no attribute 'init_session'

Python newbie here and I tried running app.py but failed with the error below.
Anyone got the following? How did you fix it?

$ python ui/app.py 
Traceback (most recent call last):
  File "ui/app.py", line 31, in <module>
    sess, model, enc_vocab, rev_dec_vocab = execute.init_session(sess, conf='seq2seq_serve.ini')
AttributeError: module 'execute' has no attribute 'init_session'

size _UNK _UNK

I'm training the chat. More than 5 hours.
Making the test while training I have always:

 Reading model parameters from working_dir/seq2seq.ckpt-12850
 > hello
size _UNK _UNK

I'm doing something wrong?
I'm at:
global step 12850 learning rate 0.3589 step-time 0.44 perplexity 1.00

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 1: invalid start byte

I use python 3.5.2 with Tensorflow v0.11.0rc2. When I try to execute:

python execute.py

the application throws the following error:

File "execute.py", line 116, in train
enc_train, dec_train, enc_dev, dec_dev, _, _ = data_utils.prepare_custom_data(gConfig['working_directory'],gConfig['train_enc'],gConfig['train_dec'],gConfig['test_enc'],gConfig['test_dec'],gConfig['enc_vocab_size'],gConfig['dec_vocab_size'])

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 1: invalid start byte
What can I do to solve this problem?

Thanks!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.