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
Investigating Attention Mechanism in 3D Point Cloud Object Detection (arXiv 2021)

Investigating Attention Mechanism in 3D Point Cloud Object Detection (arXiv 2021) This repository is for the following paper: "Investigating Attention

52 Nov 19, 2022
Do you like Quick, Draw? Well what if you could train/predict doodles drawn inside Streamlit? Also draws lines, circles and boxes over background images for annotation.

Streamlit - Drawable Canvas Streamlit component which provides a sketching canvas using Fabric.js. Features Draw freely, lines, circles, boxes and pol

Fanilo Andrianasolo 325 Dec 28, 2022
Log4j JNDI inj. vuln scanner

Log-4-JAM - Log 4 Just Another Mess Log4j JNDI inj. vuln scanner Requirements pip3 install requests_toolbelt Usage # make sure target list has http/ht

Ashish Kunwar 66 Nov 09, 2022
[NeurIPS 2021] Galerkin Transformer: a linear attention without softmax

[NeurIPS 2021] Galerkin Transformer: linear attention without softmax Summary A non-numerical analyst oriented explanation on Toward Data Science abou

Shuhao Cao 159 Dec 20, 2022
Used to record WKU's utility bills on a regular basis.

WKU水电费小助手 一个用于定期记录WKU水电费的脚本 Looking for English Readme? 背景 由于WKU校园内的水电账单系统时常存在扣费延迟的现象,而补扣的费用缺乏令人信服的证明。不少学生为费用摸不着头脑,但也没有申诉的依据。为了更好地掌握水电费使用情况,留下一手证据,我开源

2 Jul 21, 2022
Implement the Pareto Optimizer and pcgrad to make a self-adaptive loss for multi-task

multi-task_losses_optimizer Implement the Pareto Optimizer and pcgrad to make a self-adaptive loss for multi-task 已经实验过了,不会有cuda out of memory情况 ##Par

14 Dec 25, 2022
A PyTorch Implementation of Neural IMage Assessment

NIMA: Neural IMage Assessment This is a PyTorch implementation of the paper NIMA: Neural IMage Assessment (accepted at IEEE Transactions on Image Proc

yunxiaos 418 Dec 29, 2022
AsymmetricGAN - Dual Generator Generative Adversarial Networks for Multi-Domain Image-to-Image Translation

AsymmetricGAN for Image-to-Image Translation AsymmetricGAN Framework for Multi-Domain Image-to-Image Translation AsymmetricGAN Framework for Hand Gest

Hao Tang 42 Jan 15, 2022
A fuzzing framework for SMT solvers

yinyang A fuzzing framework for SMT solvers. Given a set of seed SMT formulas, yinyang generates mutant formulas to stress-test SMT solvers. yinyang c

Project Yin-Yang for SMT Solver Testing 145 Jan 04, 2023
Run PowerShell command without invoking powershell.exe

PowerLessShell PowerLessShell rely on MSBuild.exe to remotely execute PowerShell scripts and commands without spawning powershell.exe. You can also ex

Mr.Un1k0d3r 1.2k Jan 03, 2023
Code release for Local Light Field Fusion at SIGGRAPH 2019

Local Light Field Fusion Project | Video | Paper Tensorflow implementation for novel view synthesis from sparse input images. Local Light Field Fusion

1.1k Dec 27, 2022
The project is an official implementation of our paper "3D Human Pose Estimation with Spatial and Temporal Transformers".

3D Human Pose Estimation with Spatial and Temporal Transformers This repo is the official implementation for 3D Human Pose Estimation with Spatial and

Ce Zheng 363 Dec 28, 2022
A list of multi-task learning papers and projects.

This page contains a list of papers on multi-task learning for computer vision. Please create a pull request if you wish to add anything. If you are interested, consider reading our recent survey pap

svandenh 297 Dec 17, 2022
Tutorial repo for an end-to-end Data Science project

End-to-end Data Science project This is the repo with the notebooks, code, and additional material used in the ITI's workshop. The goal of the session

Deena Gergis 127 Dec 30, 2022
Show-attend-and-tell - TensorFlow Implementation of "Show, Attend and Tell"

Show, Attend and Tell Update (December 2, 2016) TensorFlow implementation of Show, Attend and Tell: Neural Image Caption Generation with Visual Attent

Yunjey Choi 902 Nov 29, 2022
Discord Multi Tool that focuses on design and easy usage

Multi-Tool-v1.0 Discord Multi Tool that focuses on design and easy usage Delete webhook Block all friends Spam webhook Modify webhook Webhook info Tok

Lodi#0001 24 May 23, 2022
A PyTorch implementation of "From Two to One: A New Scene Text Recognizer with Visual Language Modeling Network" (ICCV2021)

From Two to One: A New Scene Text Recognizer with Visual Language Modeling Network The official code of VisionLAN (ICCV2021). VisionLAN successfully a

81 Dec 12, 2022
Generalized Proximal Policy Optimization with Sample Reuse (GePPO)

Generalized Proximal Policy Optimization with Sample Reuse This repository is the official implementation of the reinforcement learning algorithm Gene

Jimmy Queeney 9 Nov 28, 2022
Sketch-Based 3D Exploration with Stacked Generative Adversarial Networks

pix2vox [Demonstration video] Sketch-Based 3D Exploration with Stacked Generative Adversarial Networks. Generated samples Single-category generation M

Takumi Moriya 232 Nov 14, 2022
Tensorflow Implementation of SMU: SMOOTH ACTIVATION FUNCTION FOR DEEP NETWORKS USING SMOOTHING MAXIMUM TECHNIQUE

SMU A Tensorflow Implementation of SMU: SMOOTH ACTIVATION FUNCTION FOR DEEP NETWORKS USING SMOOTHING MAXIMUM TECHNIQUE arXiv https://arxiv.org/abs/211

Fuhang 5 Jan 18, 2022