GithubHelp home page GithubHelp logo

leonardo-lyh / fewshottext Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tdopierre/fewshottext

0.0 0.0 0.0 1.78 MB

Library of various Few-Shot Learning frameworks for text classification

Shell 4.47% Python 95.53%

fewshottext's Introduction

FewShotText

This repository contains code for the paper A Neural Few-Shot Text Classification Reality Check

Environment setup

# Create environment
python3 -m virtualenv .venv --python=python3.6

# Install environment
.venv/bin/pip install -r requirements.txt

# Activate environment
source .venv/bin/activate

Fine-tuning BERT on the MLM task

model_name=bert-base-cased
block_size=256
dataset=OOS
output_dir=transformer_models/${dataset}/fine-tuned

python language_modeling/run_language_modeling.py \
        --model_name_or_path ${model_name} \
        --output_dir ${output_dir} \
        --mlm \
        --do_train \
        --train_data_file data/${dataset}/full/full-train.txt  \
        --do_eval \
        --eval_data_file data/${dataset}/full/full-test.txt \
        --overwrite_output_dir \
        --logging_steps=1000 \
        --line_by_line \
        --logging_dir ${output_dir} \
        --block_size ${block_size} \
        --save_steps=1000 \
        --num_train_epochs 20 \
        --save_total_limit 20 \
        --seed 42 \
        --evaluation_strategy epoch

Training a few-shot model

To run the paper's experiments, simply use the utils/scripts/runner.sh file.

Reference

If you use the data or codes in this repository, please cite our paper:

@article{dopierre2021neural,
    title={A Neural Few-Shot Text Classification Reality Check},
    author={Dopierre, Thomas and Gravier, Christophe and Logerais, Wilfried},
    journal={arXiv preprint arXiv:2101.12073},
    year={2021}
}

fewshottext's People

Contributors

tdopierre avatar dependabot[bot] 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.