Git Product home page Git Product logo

retriever_parsing's Introduction

Few-shot Slot Filling and Intent Classification with Retrieved Examples

This repository contains code for running CLINC and SNIPS experiments in the paper "Few-shot Slot Filling and Intent Classification with Retrieved Examples" (to appear in NAACL 2021).

To run the code, you need to first make sure your python version is below 3.8 because the code uses Tensorflow 1.x which is not supported in python 3.8. To check your python version, run

python --version

If you have a python vesion >= 3.8, you may want to create a new enviroment with a lower version of python, e.g. using conda.

Next install all the required packages and check out this repo.

cd /my/path/
pip install absl-py tensorflow==1.15 bert-tensorflow
pip install --no-deps -e \
  git://github.com/google-research/language.git#egg=language
git clone https://github.com/google/retriever_parsing

Choose and download a BERT model from here and unzip models files at /my/path/bert.

CLINC Experiments

First, download CLINC data.

cd /my/path/
git clone https://github.com/clinc/oos-eval.git

The data will be at /my/path/oos-eval/data/data_full.json.

cd /my/path/retriever_parsing
python clinc_similarity_train.py \
 --data_dir=/my/path/oos-eval/data \
 --data_output_dir=/my/path/oos-eval/preprocessed \
 --bert_config_file=/my/path/bert/bert_config.json \
 --vocab_file=/my/path/bert/vocab.txt \
 --init_checkpoint=/my/path/bert/bert_model.ckpt \
 --use_tpu=false

SNIPS Experiments

First, download SNIPS data from here and unpack it in /my/path/snips_data/. Assume the data is in /my/path/snips_data/ACL2020data.

Then preprocess data for each domain, e.g. AddToPlaylist.

python snips_preprocess_data.py \
  --input_dir=/my/path/snips_data/ACL2020data \
  --output_dir=/my/path/snips_data/ACL2020data/preprocessed \
  --target_domain=AddToPlaylist \
  --few_shot=5 \
  --vocab_file=/my/path/bert/vocab.txt

To start training

python snips_similarity_train.py \
 --data_dir=/my/path/snips_data/ACL2020data/preprocessed/5 \
 --few_shot=5 \
 --bert_config_file=/my/path/bert/bert_config.json \
 --vocab_file=/my/path/bert/vocab.txt \
 --init_checkpoint=/my/path/bert/bert_model.ckpt \
 --target_domain=AddToPlaylist \
 --use_tpu=false

retriever_parsing's People

Contributors

yuanzh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

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.