Giter VIP home page Giter VIP logo

fewshotmultilabel's Introduction

Few-shot MLC

The code of AAAI2021 paper Few-Shot Learning for Multi-label Intent Detection.

The code framework is based on few-shot learning platform: MetaDialog.

Get Started

Requirement

python >= 3.6
pytorch >= 1.5.0
transformers >= 2.8.0
allennlp >= 0.8.2
tqdm >= 4.33.0

Prepare pre-trained embedding:

BERT

Down the pytorch bert model, or convert tensorflow param yourself as follow:

export BERT_BASE_DIR=/users4/ythou/Projects/Resources/bert-base-uncased/uncased_L-12_H-768_A-12/

pytorch_pretrained_bert convert_tf_checkpoint_to_pytorch
  $BERT_BASE_DIR/bert_model.ckpt
  $BERT_BASE_DIR/bert_config.json
  $BERT_BASE_DIR/pytorch_model.bin

Set BERT path in the ./utils/config.py

Prepare data

Get data at ./data/

Full data is available by contacting me, or you can generate it by your self:

Set test, train, dev data file path in ./scripts/

Few-shot Data Generation Tool

We provide a generation tool for converting normal data into few-shot/meta-episode style. See details at here

Run!

Execute the command line to run with scripts:

source ./scripts/run_1_shot_slot_tagging.sh [gpu_id]

We provide all scripts for experiment at ./scripts/, and you can also directly run with ./main.py.

bert based scripts:

  • run_b_stanford_1_main.sh
  • run_b_stanford_5_main.sh
  • run_b_toursg_1_main.sh
  • run_b_toursg_5_main.sh

electra based scripts:

  • run_e_stanford_1_main.sh
  • run_e_stanford_5_main.sh
  • run_e_toursg_1_main.sh
  • run_e_toursg_5_main.sh

[2020-12-28] add script to generate tag_dict.all file

  • script: scripts/get_tag_data_from_training_dataset.py
  • operation:
    • change the parameters called MODEL_DIR and DATA_DIR
  • command: python scripts/get_tag_data_from_training_dataset.py

fewshotmultilabel's People

Contributors

atmahou 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.