Giter Club home page Giter Club logo

seq2seq-chatbot's Introduction

GitHub last commit (branch) Supported TF Version Documentation Status Build Status Downloads Downloads Docker Pulls Codacy Badge

Please click TensorLayerX 🔥🔥🔥

TensorLayer is a novel TensorFlow-based deep learning and reinforcement learning library designed for researchers and engineers. It provides an extensive collection of customizable neural layers to build advanced AI models quickly, based on this, the community open-sourced mass tutorials and applications. TensorLayer is awarded the 2017 Best Open Source Software by the ACM Multimedia Society. This project can also be found at OpenI and Gitee.

News

  • 🔥 TensorLayerX is a Unified Deep Learning and Reinforcement Learning Framework for All Hardwares, Backends and OS. The current version supports TensorFlow, Pytorch, MindSpore, PaddlePaddle, OneFlow and Jittor as the backends, allowing users to run the code on different hardware like Nvidia-GPU and Huawei-Ascend.
  • TensorLayer is now in OpenI
  • Reinforcement Learning Zoo: Low-level APIs for professional usage, High-level APIs for simple usage, and a corresponding Springer textbook
  • Sipeed Maxi-EMC: Run TensorLayer models on the low-cost AI chip (e.g., K210) (Alpha Version)

Design Features

TensorLayer is a new deep learning library designed with simplicity, flexibility and high-performance in mind.

  • Simplicity : TensorLayer has a high-level layer/model abstraction which is effortless to learn. You can learn how deep learning can benefit your AI tasks in minutes through the massive examples.
  • Flexibility : TensorLayer APIs are transparent and flexible, inspired by the emerging PyTorch library. Compared to the Keras abstraction, TensorLayer makes it much easier to build and train complex AI models.
  • Zero-cost Abstraction : Though simple to use, TensorLayer does not require you to make any compromise in the performance of TensorFlow (Check the following benchmark section for more details).

TensorLayer stands at a unique spot in the TensorFlow wrappers. Other wrappers like Keras and TFLearn hide many powerful features of TensorFlow and provide little support for writing custom AI models. Inspired by PyTorch, TensorLayer APIs are simple, flexible and Pythonic, making it easy to learn while being flexible enough to cope with complex AI tasks. TensorLayer has a fast-growing community. It has been used by researchers and engineers all over the world, including those from Peking University, Imperial College London, UC Berkeley, Carnegie Mellon University, Stanford University, and companies like Google, Microsoft, Alibaba, Tencent, Xiaomi, and Bloomberg.

Multilingual Documents

TensorLayer has extensive documentation for both beginners and professionals. The documentation is available in both English and Chinese.

English Documentation Chinese Documentation Chinese Book

If you want to try the experimental features on the the master branch, you can find the latest document here.

Extensive Examples

You can find a large collection of examples that use TensorLayer in here and the following space:

Getting Start

TensorLayer 2.0 relies on TensorFlow, numpy, and others. To use GPUs, CUDA and cuDNN are required.

Install TensorFlow:

pip3 install tensorflow-gpu==2.0.0-rc1 # TensorFlow GPU (version 2.0 RC1)
pip3 install tensorflow # CPU version

Install the stable release of TensorLayer:

pip3 install tensorlayer

Install the unstable development version of TensorLayer:

pip3 install git+https://github.com/tensorlayer/tensorlayer.git

If you want to install the additional dependencies, you can also run

pip3 install --upgrade tensorlayer[all]              # all additional dependencies
pip3 install --upgrade tensorlayer[extra]            # only the `extra` dependencies
pip3 install --upgrade tensorlayer[contrib_loggers]  # only the `contrib_loggers` dependencies

If you are TensorFlow 1.X users, you can use TensorLayer 1.11.0:

# For last stable version of TensorLayer 1.X
pip3 install --upgrade tensorlayer==1.11.0

Performance Benchmark

The following table shows the training speeds of VGG16 using TensorLayer and native TensorFlow on a TITAN Xp.

Mode Lib Data Format Max GPU Memory Usage(MB) Max CPU Memory Usage(MB) Avg CPU Memory Usage(MB) Runtime (sec)
AutoGraph TensorFlow 2.0 channel last 11833 2161 2136 74
TensorLayer 2.0 channel last 11833 2187 2169 76
Graph Keras channel last 8677 2580 2576 101
Eager TensorFlow 2.0 channel last 8723 2052 2024 97
TensorLayer 2.0 channel last 8723 2010 2007 95

Getting Involved

Please read the Contributor Guideline before submitting your PRs.

We suggest users to report bugs using Github issues. Users can also discuss how to use TensorLayer in the following slack channel.



Citing TensorLayer

If you find TensorLayer useful for your project, please cite the following papers:

@article{tensorlayer2017,
    author  = {Dong, Hao and Supratak, Akara and Mai, Luo and Liu, Fangde and Oehmichen, Axel and Yu, Simiao and Guo, Yike},
    journal = {ACM Multimedia},
    title   = {{TensorLayer: A Versatile Library for Efficient Deep Learning Development}},
    url     = {http://tensorlayer.org},
    year    = {2017}
}

@inproceedings{tensorlayer2021,
  title={Tensorlayer 3.0: A Deep Learning Library Compatible With Multiple Backends},
  author={Lai, Cheng and Han, Jiarong and Dong, Hao},
  booktitle={2021 IEEE International Conference on Multimedia \& Expo Workshops (ICMEW)},
  pages={1--3},
  year={2021},
  organization={IEEE}
}

seq2seq-chatbot's People

Contributors

arnoldliulj avatar bedna-ku avatar egens avatar luomai avatar pskrunner14 avatar the-black-knight-01 avatar zsdonghao 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

seq2seq-chatbot's Issues

No module named twitter

File "main_simple_seq2seq.py", line 18, in
from data.twitter import data
ImportError: No module named twitter

Did I miss some files?
Can you please help me?Many thanks^ o^

No module named 'tensorlayer.models.seq2seq'

Can someone share with me how to resolve this error? Thanks.

Traceback (most recent call last):
File "D:\ChatBot\seq2seq-chatbot-master\main.py", line 11, in
from tensorlayer.models.seq2seq import Seq2seq
ModuleNotFoundError: No module named 'tensorlayer.models.seq2seq'

Load n.npz failed!

i have this error: Load n.npz failed!
May I know why it is like this?

Python 3.7 is both required and unsupported

After a few hours of debugging, uninstalling, reinstalling, and generally trying to get this code working, I've found the root cause of the problem:

  1. This repository requires TensorFlow 2.0.0+

  2. This repository also requires Python 3.7+

  3. TensorFlow 2.0.0+ only supports Python 3.6 and below.

Can someone provide some guidance on how to get TensorFlow working on a version of Python that isn't supported?

How can I train with my GPU?

Hello, I'm planning to train this with my GPU to make the training faster. The problem is it only utilizes my CPU. Thank you.

Problem when loading the trained model

Hello, I have a problem when I load my trained model ("model.npz"). It gives me this error:
ValueError: Dimension 0 in both shapes must be equal, but are 6004 and 8004. Shapes are [6004,1024] and [8004,1024]. for 'Assign' (op: 'Assign') with input shapes: [6004,1024], [8004,1024].

Could anyone explain to me a little bit? Or do I need to modify the code?

Many thanks! :)

Training is taking too much time

Training on CPU is taking too much time, so do you have any estimate how much time it will take? I have executed this 12 hours ago and now i am on just "Epoch[2/50] step:[600/2852] loss:5.684645 took:9.62770s". Can you please help me to boost this training.

hide [TL] message?

When I run the program, there are lots of [TL]*** messages generated. Is there a way to hide these msg? It seems not much online information about this. Thanks in advance!

question about seq2seq

Dear Dr.pskrunner

Hello, i am a follower of your github. i have a question that whether the copy mechanism (copy_decoder)is available in pskrunner14/pytorch-seq2seq or not?

Because i want to learn that code.

Thank you, very much.

Best wishes

Tianlin Zhang

Undefined names can raise NameError at runtime

flake8 testing of https://github.com/zsdonghao/seq2seq-chatbot on Python 2.7.13

$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics

./tensorlayer/layers.py:5976:49: F821 undefined name 'single_cell'
            cell = tf.contrib.rnn.MultiRNNCell([single_cell] * num_layers)
                                                ^

./tensorlayer/layers.py:5978:49: F821 undefined name 'single_cell'
            cell = tf.nn.rnn_cell.MultiRNNCell([single_cell] * num_layers)
                                                ^

./tensorlayer/prepro.py:1007:8: F821 undefined name 'is_random'
    if is_random:
       ^

Can't import data

ModuleNotFoundError Traceback (most recent call last)
in ()
8
9 ###============= prepare data
---> 10 from data.twitter import data
11 metadata, idx_q, idx_a = data.load_data(PATH='data/twitter/') # Twitter
12 # from data.cornell_corpus import data

ModuleNotFoundError: No module named 'data.twitter'

ModuleNotFoundError: No module named 'data.twitter'; 'data' is not a package

I am trying to write code for Chat Box, but encountering the error "ModuleNotFoundError: No module named 'data.twitter'; 'data' is not a package" when trying to execute "from data.twitter import data".

Please suggest , how to resolve the issue?

note: I am working on following environment:
Python is 3.6 V
Tensorflow : 2.0
Tensorlayer: 2.2
python-twitter

how to train my own data

How any I chane the dataset . Can I take the dataset of mine rather then twitter data & corpus movie data
if yes then how?

Layer 'model/embedding/seq_embedding' already exists, please choice other 'name' or reuse this layer

Exception: Layer 'model/embedding/seq_embedding' already exists, please choice other 'name' or reuse this layer
Hint : Use different name for different 'Layer' (The name is used to control parameter sharing)
Additional Informations: http://tensorlayer.readthedocs.io/en/latest/modules/layers.html?highlight=clear_layers_name#tensorlayer.layers.clear_layers_name

when i run the code, this problem comes.

python: 3.6
tensorflow-gpu: 1.7.1
tensorlayer: 1.7.4

Word2Vec

Hi,

It seems that the example didn't use Word2Vec. I am trying to load pre-trained vectors to represent these words. Do you think it will be helpful to to improve the bot performance? I can't figure out how to do that. Do you have any examples showing the similar procedures?

Thank you in advance!

Error: No module named twitter

python main_simple_seq2seq.py
Traceback (most recent call last):
File "main_simple_seq2seq.py", line 18, in
from data.twitter import data
ImportError: No module named twitter

tensorflow server signature

I am trying to serve the model over tensorflow serving and I have created the below signature. But it doesnt seem to work. Please help me @pskrunner14

encode_seqs = tf.placeholder(dtype=tf.int64, shape=[batch_size, None], name="encode_seqs")
decode_seqs = tf.placeholder(dtype=tf.int64, shape=[batch_size, None], name="decode_seqs")

Inference Data Placeholders

encode_seqs2 = tf.placeholder(dtype=tf.int64, shape=[1, None], name="encode_seqs")
decode_seqs2 = tf.placeholder(dtype=tf.int64, shape=[1, None], name="decode_seqs")

export_path_base = './export_base/'
export_path = os.path.join(
tf.compat.as_bytes(export_path_base),
tf.compat.as_bytes(str(1)))
print('Exporting trained model to', export_path)
builder = tf.saved_model.builder.SavedModelBuilder(export_path)

    classification_inputs = tf.saved_model.utils.build_tensor_info(
        encode_seqs)
    classification_outputs_classes = tf.saved_model.utils.build_tensor_info(
        decode_seqs)
    #classification_outputs_scores = tf.saved_model.utils.build_tensor_info(loss)

    classification_signature = (
        tf.saved_model.signature_def_utils.build_signature_def(
            inputs={
                tf.saved_model.signature_constants.CLASSIFY_INPUTS:
                    classification_inputs
            },
            outputs={
                tf.saved_model.signature_constants.CLASSIFY_OUTPUT_CLASSES:
                    classification_outputs_classes,
                #tf.saved_model.signature_constants.CLASSIFY_OUTPUT_SCORES:
                    #classification_outputs_scores
            },
            method_name=tf.saved_model.signature_constants.CLASSIFY_METHOD_NAME))

    tensor_info_x = tf.saved_model.utils.build_tensor_info(encode_seqs2)
    tensor_info_y = tf.saved_model.utils.build_tensor_info(decode_seqs2)

    prediction_signature = (
        tf.saved_model.signature_def_utils.build_signature_def(
            inputs={'issue': tensor_info_x},
            outputs={'solution': tensor_info_y},
            method_name=tf.saved_model.signature_constants.PREDICT_METHOD_NAME))

    builder.add_meta_graph_and_variables(
        sess, [tf.saved_model.tag_constants.SERVING],
        signature_def_map={
            'predict_solution':
                prediction_signature,
            tf.saved_model.signature_constants.DEFAULT_SERVING_SIGNATURE_DEF_KEY:
                classification_signature,
        },
        main_op=tf.tables_initializer(),
        strip_default_attrs=True)

    builder.save()

    print('Done exporting!')

I have the below signature,

C:\Users\d074437\PycharmProjects\seq2seq>saved_model_cli show --dir ./export_base/1 --all

MetaGraphDef with tag-set: 'serve' contains the following SignatureDefs:

signature_def['predict_solution']:
The given SavedModel SignatureDef contains the following input(s):
inputs['issue'] tensor_info:
dtype: DT_INT64
shape: (1, -1)
name: encode_seqs_1:0
The given SavedModel SignatureDef contains the following output(s):
outputs['solution'] tensor_info:
dtype: DT_INT64
shape: (1, -1)
name: decode_seqs_1:0
Method name is: tensorflow/serving/predict

signature_def['serving_default']:
The given SavedModel SignatureDef contains the following input(s):
inputs['inputs'] tensor_info:
dtype: DT_INT64
shape: (32, -1)
name: encode_seqs:0
The given SavedModel SignatureDef contains the following output(s):
outputs['classes'] tensor_info:
dtype: DT_INT64
shape: (32, -1)
name: decode_seqs:0
Method name is: tensorflow/serving/classify

But when I try to run it, I get an error as below

C:\Users\d074437\PycharmProjects\seq2seq>saved_model_cli run --dir ./export_base --tag_set serve --signature_def predict_solution --inputs='this is the text'
usage: saved_model_cli [-h] [-v] {show,run,scan} ...
saved_model_cli: error: unrecognized arguments: is the text'

validX,validY not use?

Hi you! I don't see you use validX,validY data in your code. Could you tell me how to get loss of valid data in your code. Thanks you!

no validation accuracy ?

validx and validy are not used and there are no calculcations for validation accuracy in the model ?

Using the Chatbot

Hi there,

I trained the data for a few days and now the samples are returning good results to the predefined "Happy Birthday" and "Trump" requests.

Great job by you. Thanks so far.

Do you already have a small python program for using the chatbot? If I write a message, the chatbot should return a single answer.

Thanks
Chris

Been having this issue on both Windows and Linux..

I posted this under a work account so I closed the issue and logged in with my personal.

The issue I get is this:

python3 main.py

Traceback (most recent call last):
File "main.py", line 11, in
from tensorlayer.models.seq2seq import Seq2seq
ImportError: No module named 'tensorlayer.models.seq2seq'

closed

i say hi, it sometimes says random stuff, sometimes replies hi darling. Can anyone please help me understand what's happening

Using .npz file

I have trained the model on the dataset but I don't know how to get the output using .npz file. Please add instructions to test it as well.

TensorLayer - initialize global variables Deprecated

When I run the main script this warning message shows up. Any ideas how to rectify this?

[TL] WARNING: From main_simple_seq2seq.py:144: initialize_global_variables (from tensorlayer.layers.utils) is deprecated and will be removed after 2018-09-30. Instructions for updating: This API is deprecated in favor of tf.global_variables_initializer

I tried replacing it with tf.global_variables_initializer but the script crashed with the following message:

FailedPreconditionError (see above for traceback): Attempting to use uninitialized value model/seq2seq/encode/rnn/multi_rnn_cell/cell_2/basic_lstm_cell/kernel [[Node: model/seq2seq/encode/rnn/multi_rnn_cell/cell_2/basic_lstm_cell/kernel/read = Identity[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"](model/seq2seq/encode/rnn/multi_rnn_cell/cell_2/basic_lstm_cell/kernel)]] [[Node: seq_loss_with_mask/_51 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_2513_seq_loss_with_mask", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]

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.