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
This is an implementation for the CVPR2020 paper "Learning Invariant Representation for Unsupervised Image Restoration"

Learning Invariant Representation for Unsupervised Image Restoration (CVPR 2020) Introduction This is an implementation for the paper "Learning Invari

GarField 88 Nov 07, 2022
my graduation project is about live human face augmentation by projection mapping by using CNN

Live-human-face-expression-augmentation-by-projection my graduation project is about live human face augmentation by projection mapping by using CNN o

1 Mar 08, 2022
This is the official implementation for the paper "(Almost) Free Incentivized Exploration from Decentralized Learning Agents" in NeurIPS 2021.

Observe then Incentivize Experiments This is the code used for the paper "(Almost) Free Incentivized Exploration from Decentralized Learning Agents",

Cong Shen Research Group 0 Mar 08, 2022
Flaxformer: transformer architectures in JAX/Flax

Flaxformer is a transformer library for primarily NLP and multimodal research at Google.

Google 116 Jan 05, 2023
LAVT: Language-Aware Vision Transformer for Referring Image Segmentation

LAVT: Language-Aware Vision Transformer for Referring Image Segmentation Where we are ? 12.27 目前和原论文仍有1%左右得差距,但已经力压很多SOTA了 ckpt__448_epoch_25.pth mIoU

zichengsaber 60 Dec 11, 2022
Deep Learning with PyTorch made easy 🚀 !

Deep Learning with PyTorch made easy 🚀 ! Carefree? carefree-learn aims to provide CAREFREE usages for both users and developers. It also provides a c

381 Dec 22, 2022
A Closer Look at Structured Pruning for Neural Network Compression

A Closer Look at Structured Pruning for Neural Network Compression Code used to reproduce experiments in https://arxiv.org/abs/1810.04622. To prune, w

Bayesian and Neural Systems Group 140 Dec 05, 2022
Domain Generalization with MixStyle, ICLR'21.

MixStyle This repo contains the code of our ICLR'21 paper, "Domain Generalization with MixStyle". The OpenReview link is https://openreview.net/forum?

Kaiyang 208 Dec 28, 2022
Elevation Mapping on GPU.

Elevation Mapping cupy Overview This is a ros package of elevation mapping on GPU. Code are written in python and uses cupy for GPU calculation. * pla

Robotic Systems Lab - Legged Robotics at ETH Zürich 183 Dec 19, 2022
ONNX-GLPDepth - Python scripts for performing monocular depth estimation using the GLPDepth model in ONNX

ONNX-GLPDepth - Python scripts for performing monocular depth estimation using the GLPDepth model in ONNX

Ibai Gorordo 18 Nov 06, 2022
Temporal Knowledge Graph Reasoning Triggered by Memories

MTDM Temporal Knowledge Graph Reasoning Triggered by Memories To alleviate the time dependence, we propose a memory-triggered decision-making (MTDM) n

4 Sep 25, 2022
A python3 tool to take a 360 degree survey of the RF spectrum (hamlib + rotctld + RTL-SDR/HackRF)

RF Light House (rflh) A python script to use a rotor and a SDR device (RTL-SDR or HackRF One) to measure the RF level around and get a data set and be

Pavel Milanes (CO7WT) 11 Dec 13, 2022
A map update dataset and benchmark

MUNO21 MUNO21 is a dataset and benchmark for machine learning methods that automatically update and maintain digital street map datasets. Previous dat

16 Nov 30, 2022
Language models are open knowledge graphs ( non official implementation )

language-models-are-knowledge-graphs-pytorch Language models are open knowledge graphs ( work in progress ) A non official reimplementation of Languag

theblackcat102 132 Dec 18, 2022
ActNN: Reducing Training Memory Footprint via 2-Bit Activation Compressed Training

ActNN : Activation Compressed Training This is the official project repository for ActNN: Reducing Training Memory Footprint via 2-Bit Activation Comp

UC Berkeley RISE 178 Jan 05, 2023
An Active Automata Learning Library Written in Python

AALpy An Active Automata Learning Library AALpy is a light-weight active automata learning library written in pure Python. You can start learning auto

TU Graz - SAL Dependable Embedded Systems Lab (DES Lab) 78 Dec 30, 2022
This is the pytorch re-implementation of the IterNorm

IterNorm-pytorch Pytorch reimplementation of the IterNorm methods, which is described in the following paper: Iterative Normalization: Beyond Standard

Lei Huang 32 Dec 27, 2022
Nsdf: A mesh SDF with just some code we can directly paste into our raymarcher

nsdf Representing SDFs of arbitrary meshes has been a bit tricky so far. Express

Jan Ivanecky 5 Feb 18, 2022
Reverse engineering recurrent neural networks with Jacobian switching linear dynamical systems

Reverse engineering recurrent neural networks with Jacobian switching linear dynamical systems This repository is the official implementation of Rever

6 Aug 25, 2022
The official PyTorch implementation for the paper "sMGC: A Complex-Valued Graph Convolutional Network via Magnetic Laplacian for Directed Graphs".

Magnetic Graph Convolutional Networks About The official PyTorch implementation for the paper sMGC: A Complex-Valued Graph Convolutional Network via M

3 Feb 25, 2022