Giter Club home page Giter Club logo

glad's Introduction

Global-Locally Self-Attentive Dialogue State Tracker

This repository contains an implementation of the Global-Locally Self-Attentive Dialogue State Tracker (GLAD). If you use this in your work, please cite the following

@inproceedings{ zhong2018global,
  title={ Global-Locally Self-Attentive Encoder for Dialogue State Tracking },
  author={ Zhong, Victor and Xiong, Caiming and Socher, Richard },
  booktitle={ ACL },
  year={ 2018 }
}

Install dependencies

Using Docker

docker build -t glad:0.4 .
docker run --name embeddings -d vzhong/embeddings:0.0.5  # get the embeddings
env NV_GPU=0 nvidia-docker run --name glad -d -t --net host --volumes-from embeddings glad:0.4

If you do not want to build the Docker image, then run the following (you still need to have the CoreNLP server).

pip install -r requirements.txt

Download and annotate data

This project uses Stanford CoreNLP to annotate the dataset. In particular, we use the Stanford NLP Stanza python interface. To run the server, do

docker run --name corenlp -d -p 9000:9000 vzhong/corenlp-server

The first time you preprocess the data, we will download word embeddings and character embeddings and put them into a SQLite database, which will be slow. Subsequent runs will be much faster.

docker exec glad python preprocess_data.py

The raw data will be stored in data/woz/raw of the container. The annotation results will be stored in data/woz/ann of the container.

If you do not want to build the Docker image, then run

python preprocess_data.py

Train model

You can checkout the training options via python train.py -h. By default, train.py will save checkpoints to exp/glad/default.

docker exec glad python train.py --gpu 0

You can attach to the container via docker exec glad -it bin/bash to look at what's inside or docker cp glad /opt/glad/exp exp to copy out the experiment results.

If you do not want to build the Docker image, then run

python train.py --gpu 0

Evaluation

You can evaluate the model using

docker exec glad python evaluate.py --gpu 0 --split test exp/glad/default

You can also dump a predictions file by specifying the --fout flag. In this case, the output will be a list of lists. Each ith sublist is the set of predicted slot-value pairs for the ith turn. Please see evaluate.py to see how to match up the turn predictions with the dialogues.

If you do not want to build the Docker image, then run

python evaluate.py --gpu 0 --split test exp/glad/default

Contribution

Pull requests are welcome! If you have any questions, please create an issue or contact the corresponding author at victor <at> victorzhong <dot> com.

glad's People

Contributors

svc-scm avatar vzhong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

glad's Issues

Reproducing DSTC-2 evaluation results

I have downloaded the clean dstc-2 dataset and trained the system but unable to reproduce the results. Please share the hyper-parameters for the dstc-2 dataset.

MemoryError when preprocessing data (computing embeddings)

On my local machine, when I run python preprocess_data.py and the script computes word embeddings, it dies with a MemoryError. I've killed all other processes and have about 6GB free RAM, but that doesn't seem to be enough. Is this expected? Anything I can do against it? Perhaps download and use precomputed embeddings from somewhere?

RuntimeError while training: The expanded size of the tensor must match the existing size at non-singleton dimension

I am trying to run the train.py and the embedding I am using is Wikipedia embedding with 50 dimension size in python 3. I am getting this following error.

Namespace(batch_size=50, demb=400, dexp='exp', dhid=200, dout='exp/glad/default', dropout={'emb': 0.2, 'local': 0.2, 'global': 0.2}, epoch=50, gpu=0, lr=0.001, model='glad', nick='default', resume=None, seed=42, stop='joint_goal', test=False)

WARNING:root:loading split train
WARNING:root:loading split dev
WARNING:root:loading split test

INFO:root:dataset sizes: {'dev': 200, 'test': 400, 'train': 600}
INFO:root:loaded model <class 'models.glad.Model'>
INFO:root:saving config to exp/glad/default/config.json

Traceback (most recent call last):
File "train.py", line 66, in
run(args)
File "train.py", line 24, in run
model.load_emb(Eword)
File "/mount/studenten/SpokenLanguageProcessing/2019/WokeSpoke/SLU/glad_master/models/glad.py", line 151, in load_emb
self.emb_fixed.weight.data.copy_(new(Eword))

RuntimeError: The expanded size of the tensor (400) must match the existing size (150) at non-singleton dimension 1. Target sizes: [950, 400]. Tensor sizes: [950, 150]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.