Chatbot in 200 lines of code using TensorLayer

Overview

Seq2Seq Chatbot

This is a 200 lines implementation of Twitter/Cornell-Movie Chatbot, please read the following references before you read the code:

Prerequisites

Model


Training

python3 main.py

Results

Query > happy birthday have a nice day
 > thank you so much
 > thank babe
 > thank bro
 > thanks so much
 > thank babe i appreciate it
Query > donald trump won last nights presidential debate according to snap online polls
 > i dont know what the fuck is that
 > i think he was a racist
 > he is not a racist
 > he is a liar
 > trump needs to be president
Comments
  • [WIP] Fix error in PR #16 Inference mode and TF compatibility

    [WIP] Fix error in PR #16 Inference mode and TF compatibility

    Hey @pskrunner14

    Thanks for the great PR! We have rolled back the PR you recently submitted as the PR contains the error. Could you please have a look on it and we can merge it again? You can create a PR from your fork again or directly modify from here.

    Cheers, Luo

    opened by luomai 6
  • No module named 'tensorlayer.models.seq2seq'

    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'

    opened by geongm 5
  • Change seq2seq import names

    Change seq2seq import names

    Had the #37 problem. It looks like on in current version of tensorlayer import names changed.

    These imports work with tensorflow 2.0.0-beta1 tensorlayer 2.1.0

    opened by egens 4
  • TL2.0

    TL2.0

    Update model compatible with TensorLayer2.0. Rewrite the loss. cross_entropy_seq_with_mask and cross_entropy_seq. Need to run to see if it converges and produce desirable results

    opened by ArnoldLIULJ 3
  • Inference mode and TF compatibility

    Inference mode and TF compatibility

    • Moved Inference code to a function.
    • Added optional arguments including running script in inference mode [usage python main.py --help].
    • Added tqdm progress bar for info while training.
    • Made the code compatible with TF v1.10.0 and TL v1.10.1.
    • Changed tf.contrib.rnn.BasicLSTMCell to tf.nn.rnn_cell.LSTMCell since the former is deprecated.
    • Moved session config to global scope.
    • Refactored code into relevant functions and reordered them so that the higher-level ones appear earlier in the code.
    • Renamed script to main.py for ease of use.
    • Updated README to add training and inference usage commands.
    • Added requirements.txt file.
    • Changed n.npz to model.npz since it is more standard.

    Note: Fixes #12 and #15

    opened by pskrunner14 3
  • Using the Chatbot

    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

    opened by cpro90 3
  • Training is taking too much time

    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.

    opened by aqeellegalinc 3
  • Inference mode and TF compatibility (#16)

    Inference mode and TF compatibility (#16)

    @pskrunner14

    We have rolled back the PR you recently submitted as the PR contains the error. Could you please have a look on it and we can merge it again?

    opened by luomai 2
  • Fixes TL global variables initializer deprecated issue and Code readability

    Fixes TL global variables initializer deprecated issue and Code readability

    Fixed TensorLayer initialize global vars deprecated issue #13, changed learning rate to 0.001 for faster convergence, improved code readability and removed redundant comments and code

    opened by pskrunner14 2
  • Can't import data

    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'

    opened by georgexli 2
  • No module named twitter

    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^

    opened by MProtoss 1
  • ModuleNotFoundError: No module named 'data.twitter'; 'data' is not a package

    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

    opened by mhmitalihalder 0
  • How could I get the

    How could I get the "thought vector" using TensorLayer?

    I am using the seq2seq model as an autoencoder. Given a test paragraph, I'd like to get the thought vector (using the terminology in the figure of README.md).

    opened by munichong 0
Releases(0.1)
Owner
TensorLayer Community
A neutral open community to promote AI technology.
TensorLayer Community
Fine-Tune EleutherAI GPT-Neo to Generate Netflix Movie Descriptions in Only 47 Lines of Code Using Hugginface And DeepSpeed

GPT-Neo-2.7B Fine-Tuning Example Using HuggingFace & DeepSpeed Installation cd venv/bin ./pip install -r ../../requirements.txt ./pip install deepspe

Nikita 180 Jan 5, 2023
Deploy a ML inference service on a budget in less than 10 lines of code.

BudgetML is perfect for practitioners who would like to quickly deploy their models to an endpoint, but not waste a lot of time, money, and effort trying to figure out how to do this end-to-end.

null 1.3k Dec 25, 2022
SparseML is a libraries for applying sparsification recipes to neural networks with a few lines of code, enabling faster and smaller models

SparseML is a toolkit that includes APIs, CLIs, scripts and libraries that apply state-of-the-art sparsification algorithms such as pruning and quantization to any neural network. General, recipe-driven approaches built around these algorithms enable the simplification of creating faster and smaller models for the ML performance community at large.

Neural Magic 1.5k Dec 30, 2022
Train neural network for semantic segmentation (deep lab V3) with pytorch in less then 50 lines of code

Train neural network for semantic segmentation (deep lab V3) with pytorch in 50 lines of code Train net semantic segmentation net using Trans10K datas

null 17 Dec 19, 2022
Create Data & AI apps in 20 lines of code with Shimoku

Install with: pip install shimoku-api-python Start with: from os import getenv import shimoku_api_python.client as Shimoku

Shimoku 5 Nov 7, 2022
Python wrapper class for OpenVINO Model Server. User can submit inference request to OVMS with just a few lines of code

Python wrapper class for OpenVINO Model Server. User can submit inference request to OVMS with just a few lines of code.

Yasunori Shimura 7 Jul 27, 2022
sequitur is a library that lets you create and train an autoencoder for sequential data in just two lines of code

sequitur sequitur is a library that lets you create and train an autoencoder for sequential data in just two lines of code. It implements three differ

Jonathan Shobrook 305 Dec 21, 2022
A Marvelous ChatBot implement using PyTorch.

PyTorch Marvelous ChatBot [Update] it's 2019 now, previously model can not catch up state-of-art now. So we just move towards the future a transformer

JinTian 223 Oct 18, 2022
A Planar RGB-D SLAM which utilizes Manhattan World structure to provide optimal camera pose trajectory while also providing a sparse reconstruction containing points, lines and planes, and a dense surfel-based reconstruction.

ManhattanSLAM Authors: Raza Yunus, Yanyan Li and Federico Tombari ManhattanSLAM is a real-time SLAM library for RGB-D cameras that computes the camera

null 117 Dec 28, 2022
The (Official) PyTorch Implementation of the paper "Deep Extraction of Manga Structural Lines"

MangaLineExtraction_PyTorch The (Official) PyTorch Implementation of the paper "Deep Extraction of Manga Structural Lines" Usage model_torch.py [sourc

Miaomiao Li 82 Jan 2, 2023
It helps user to learn Pick-up lines and share if he has a better one

Pick-up-Lines-Generator(Open Source) It helps user to learn Pick-up lines Share and Add one or many to the DataBase Unique SQLite DataBase AI Undercon

knock_nott 0 May 4, 2022
Deployment of PyTorch chatbot with Flask

Chatbot Deployment with Flask and JavaScript In this tutorial we deploy the chatbot I created in this tutorial with Flask and JavaScript. This gives 2

Patrick Loeber (Python Engineer) 107 Dec 29, 2022
Politecnico of Turin Thesis: "Implementation and Evaluation of an Educational Chatbot based on NLP Techniques"

THESIS_CAIRONE_FIORENTINO Politecnico of Turin Thesis: "Implementation and Evaluation of an Educational Chatbot based on NLP Techniques" GENERATE TOKE

cairone_fiorentino97 1 Dec 10, 2021
Keqing Chatbot With Python

KeqingChatbot A public running instance can be found on telegram as @keqingchat_bot. Requirements Python 3.8 or higher. A bot token. Local Deploy git

Rikka-Chan 2 Jan 16, 2022
This is the official source code for SLATE. We provide the code for the model, the training code, and a dataset loader for the 3D Shapes dataset. This code is implemented in Pytorch.

SLATE This is the official source code for SLATE. We provide the code for the model, the training code and a dataset loader for the 3D Shapes dataset.

Gautam Singh 66 Dec 26, 2022
This source code is implemented using keras library based on "Automatic ocular artifacts removal in EEG using deep learning"

CSP_Deep_EEG This source code is implemented using keras library based on "Automatic ocular artifacts removal in EEG using deep learning" {https://www

Seyed Mahdi Roostaiyan 2 Nov 8, 2022
TensorFlow code for the neural network presented in the paper: "Structural Language Models of Code" (ICML'2020)

SLM: Structural Language Models of Code This is an official implementation of the model described in: "Structural Language Models of Code" [PDF] To ap

null 73 Nov 6, 2022
Inference code for "StylePeople: A Generative Model of Fullbody Human Avatars" paper. This code is for the part of the paper describing video-based avatars.

NeuralTextures This is repository with inference code for paper "StylePeople: A Generative Model of Fullbody Human Avatars" (CVPR21). This code is for

Visual Understanding Lab @ Samsung AI Center Moscow 18 Oct 6, 2022
A code generator from ONNX to PyTorch code

onnx-pytorch Generating pytorch code from ONNX. Currently support onnx==1.9.0 and torch==1.8.1. Installation From PyPI pip install onnx-pytorch From

Wenhao Hu 94 Jan 6, 2023