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
A machine learning project which can detect and predict the skin disease through image recognition.

ML-Project-2021 A machine learning project which can detect and predict the skin disease through image recognition. The dataset used for this is the H

Debshishu Ghosh 1 Jan 13, 2022
MoCap-Solver: A Neural Solver for Optical Motion Capture Data

MoCap-Solver is a data-driven-based robust marker denoising method, which takes raw mocap markers as input and outputs corresponding clean markers and skeleton motions.

55 Dec 28, 2022
This is a simple plugin for Vim that allows you to use OpenAI Codex.

🤖 Vim Codex An AI plugin that does the work for you. This is a simple plugin for Vim that will allow you to use OpenAI Codex. To use this plugin you

Tom Dörr 195 Dec 28, 2022
The implementation of 'Image synthesis via semantic composition'.

Image synthesis via semantic synthesis [Project Page] by Yi Wang, Lu Qi, Ying-Cong Chen, Xiangyu Zhang, Jiaya Jia. Introduction This repository gives

DV Lab 71 Jan 06, 2023
Single-step adversarial training (AT) has received wide attention as it proved to be both efficient and robust.

Subspace Adversarial Training Single-step adversarial training (AT) has received wide attention as it proved to be both efficient and robust. However,

15 Sep 02, 2022
[NeurIPS 2021] “Improving Contrastive Learning on Imbalanced Data via Open-World Sampling”,

Improving Contrastive Learning on Imbalanced Data via Open-World Sampling Introduction Contrastive learning approaches have achieved great success in

VITA 24 Dec 17, 2022
Official PaddlePaddle implementation of Paint Transformer

Paint Transformer: Feed Forward Neural Painting with Stroke Prediction [Paper] [Paddle Implementation] Update We have optimized the serial inference p

TianweiLin 284 Dec 31, 2022
This is the repository for our paper SimpleTrack: Understanding and Rethinking 3D Multi-object Tracking

SimpleTrack This is the repository for our paper SimpleTrack: Understanding and Rethinking 3D Multi-object Tracking. We are still working on writing t

TuSimple 189 Dec 26, 2022
FS-Mol: A Few-Shot Learning Dataset of Molecules

FS-Mol is A Few-Shot Learning Dataset of Molecules, containing molecular compounds with measurements of activity against a variety of protein targets. The dataset is presented with a model evaluation

Microsoft 114 Dec 15, 2022
This is a package for LiDARTag, described in paper: LiDARTag: A Real-Time Fiducial Tag System for Point Clouds

LiDARTag Overview This is a package for LiDARTag, described in paper: LiDARTag: A Real-Time Fiducial Tag System for Point Clouds (PDF)(arXiv). This wo

University of Michigan Dynamic Legged Locomotion Robotics Lab 159 Dec 21, 2022
All public open-source implementations of convnets benchmarks

convnet-benchmarks Easy benchmarking of all public open-source implementations of convnets. A summary is provided in the section below. Machine: 6-cor

Soumith Chintala 2.7k Dec 30, 2022
Combine Tacotron2 and Hifi GAN to generate speech from text

EndToEndTextToSpeech Combine Tacotron2 and Hifi GAN to generate speech from text Download weights Hifi GAN - hifi_gan/checkpoint/ : pretrain 2.5M ste

Phạm Quốc Huy 1 Dec 18, 2021
Unofficial implementation of MLP-Mixer: An all-MLP Architecture for Vision

MLP-Mixer: An all-MLP Architecture for Vision This repo contains PyTorch implementation of MLP-Mixer: An all-MLP Architecture for Vision. Usage : impo

Rishikesh (ऋषिकेश) 175 Dec 23, 2022
Hyper-parameter optimization for sklearn

hyperopt-sklearn Hyperopt-sklearn is Hyperopt-based model selection among machine learning algorithms in scikit-learn. See how to use hyperopt-sklearn

1.4k Jan 01, 2023
Code for DisCo: Remedy Self-supervised Learning on Lightweight Models with Distilled Contrastive Learning

DisCo: Remedy Self-supervised Learning on Lightweight Models with Distilled Contrastive Learning Pytorch Implementation for DisCo: Remedy Self-supervi

79 Jan 06, 2023
Weight initialization schemes for PyTorch nn.Modules

nninit Weight initialization schemes for PyTorch nn.Modules. This is a port of the popular nninit for Torch7 by @kaixhin. ##Update This repo has been

Alykhan Tejani 69 Jan 26, 2021
Self-labelling via simultaneous clustering and representation learning. (ICLR 2020)

Self-labelling via simultaneous clustering and representation learning 🆗 🆗 🎉 NEW models (20th August 2020): Added standard SeLa pretrained torchvis

Yuki M. Asano 469 Jan 02, 2023
Equivariant Imaging: Learning Beyond the Range Space

Equivariant Imaging: Learning Beyond the Range Space Equivariant Imaging: Learning Beyond the Range Space Dongdong Chen, Julián Tachella, Mike E. Davi

Dongdong Chen 46 Jan 01, 2023
Part-aware Measurement for Robust Multi-View Multi-Human 3D Pose Estimation and Tracking

Part-aware Measurement for Robust Multi-View Multi-Human 3D Pose Estimation and Tracking Part-Aware Measurement for Robust Multi-View Multi-Human 3D P

19 Oct 27, 2022
Cortex-compatible model server for Python and TensorFlow

Nucleus model server Nucleus is a model server for TensorFlow and generic Python models. It is compatible with Cortex clusters, Kubernetes clusters, a

Cortex Labs 14 Nov 27, 2022