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
Contour-guided image completion with perceptual grouping (BMVC 2021 publication)

Contour-guided Image Completion with Perceptual Grouping Authors Morteza Rezanejad*, Sidharth Gupta*, Chandra Gummaluru, Ryan Marten, John Wilder, Mic

Sid Gupta 6 Dec 27, 2022
An implementation of quantum convolutional neural network with MindQuantum. Huawei, classifying MNIST dataset

关于实现的一点说明 山东大学 2020级 苏博南 www.subonan.com 文件说明 tools.py 这里面主要有两个函数: resize(a, lenb) 这其实是我找同学写的一个小算法hhh。给出一个$28\times 28$的方阵a,返回一个$lenb\times lenb$的方阵。因

ぼっけなす 2 Aug 29, 2022
Books, Presentations, Workshops, Notebook Labs, and Model Zoo for Software Engineers and Data Scientists wanting to learn the TF.Keras Machine Learning framework

Books, Presentations, Workshops, Notebook Labs, and Model Zoo for Software Engineers and Data Scientists wanting to learn the TF.Keras Machine Learning framework

Google Cloud Platform 792 Dec 28, 2022
This repository contains PyTorch code for Robust Vision Transformers.

This repository contains PyTorch code for Robust Vision Transformers.

117 Dec 07, 2022
Colar: Effective and Efficient Online Action Detection by Consulting Exemplars, CVPR 2022.

Colar: Effective and Efficient Online Action Detection by Consulting Exemplars This repository is the official implementation of Colar. In this work,

LeYang 246 Dec 13, 2022
B-cos Networks: Attention is All we Need for Interpretability

Convolutional Dynamic Alignment Networks for Interpretable Classifications M. Böhle, M. Fritz, B. Schiele. B-cos Networks: Alignment is All we Need fo

58 Dec 23, 2022
Personalized Transfer of User Preferences for Cross-domain Recommendation (PTUPCDR)

This is the official implementation of our paper Personalized Transfer of User Preferences for Cross-domain Recommendation (PTUPCDR), which has been accepted by WSDM2022.

Yongchun Zhu 81 Dec 29, 2022
A Learning-based Camera Calibration Toolbox

Learning-based Camera Calibration A Learning-based Camera Calibration Toolbox Paper The pdf file can be found here. @misc{zhang2022learningbased,

Eason 14 Dec 21, 2022
Anomaly Localization in Model Gradients Under Backdoor Attacks Against Federated Learning

Federated_Learning This repo provides a federated learning framework that allows to carry out backdoor attacks under varying conditions. This is a ker

Arçelik ARGE Açık Kaynak Yazılım Organizasyonu 0 Nov 30, 2021
SpeechNAS Better Trade off between Latency and Accuracy for Large Scale Speaker Verification

SpeechNAS Better Trade off between Latency and Accuracy for Large Scale Speaker Verification

Wentao Zhu 24 May 20, 2022
TakeInfoatNistforICS - Take Information in NIST NVD for ICS

Take Information in NIST NVD for ICS This project developed with Python. When yo

5 Sep 05, 2022
Official implementation for NIPS'17 paper: PredRNN: Recurrent Neural Networks for Predictive Learning Using Spatiotemporal LSTMs.

PredRNN: A Recurrent Neural Network for Spatiotemporal Predictive Learning The predictive learning of spatiotemporal sequences aims to generate future

THUML: Machine Learning Group @ THSS 243 Dec 26, 2022
Code for "Multi-View Multi-Person 3D Pose Estimation with Plane Sweep Stereo"

Multi-View Multi-Person 3D Pose Estimation with Plane Sweep Stereo This repository includes the source code for our CVPR 2021 paper on multi-view mult

Jiahao Lin 66 Jan 04, 2023
Progressive Image Deraining Networks: A Better and Simpler Baseline

Progressive Image Deraining Networks: A Better and Simpler Baseline [arxiv] [pdf] [supp] Introduction This paper provides a better and simpler baselin

190 Dec 01, 2022
A wrapper around SageMaker ML Lineage Tracking extending ML Lineage to end-to-end ML lifecycles, including additional capabilities around Feature Store groups, queries, and other relevant artifacts.

ML Lineage Helper This library is a wrapper around the SageMaker SDK to support ease of lineage tracking across the ML lifecycle. Lineage artifacts in

AWS Samples 12 Nov 01, 2022
Implementation of the SUMO (Slim U-Net trained on MODA) model

SUMO - Slim U-Net trained on MODA Implementation of the SUMO (Slim U-Net trained on MODA) model as described in: TODO: add reference to paper once ava

6 Nov 19, 2022
Intel® Nervana™ reference deep learning framework committed to best performance on all hardware

DISCONTINUATION OF PROJECT. This project will no longer be maintained by Intel. Intel will not provide or guarantee development of or support for this

Nervana 3.9k Dec 20, 2022
GARCH and Multivariate LSTM forecasting models for Bitcoin realized volatility with potential applications in crypto options trading, hedging, portfolio management, and risk management

Bitcoin Realized Volatility Forecasting with GARCH and Multivariate LSTM Author: Chi Bui This Repository Repository Directory ├── README.md

Chi Bui 113 Dec 29, 2022
This is the implementation of the paper LiST: Lite Self-training Makes Efficient Few-shot Learners.

LiST (Lite Self-Training) This is the implementation of the paper LiST: Lite Self-training Makes Efficient Few-shot Learners. LiST is short for Lite S

Microsoft 28 Dec 07, 2022
HGCN: Harmonic Gated Compensation Network For Speech Enhancement

HGCN The official repo of "HGCN: Harmonic Gated Compensation Network For Speech Enhancement", which was accepted at ICASSP2022. How to use step1: Calc

ScorpioMiku 33 Nov 14, 2022