Code Monkey home page Code Monkey logo

sentiprompt's Introduction

SentiPrompt

This is the official implementation of the paper SentiPrompt: Sentiment Knowledge Enhanced Prompt-Tuning for Aspect-Based Sentiment Analysis

Dependency

Install the package in the requirements.txt, then use the following commands to install two other packages

pip install git+https://github.com/fastnlp/fastNLP@dev
pip install git+https://github.com/fastnlp/fitlog

Dataset Preparation

All versions of datasets should be placed in data/ folder and different datasets split in sub-directories.

 -  data
    - penga  # D_20a in paper
    - pengb  # D_20b in paper
    - lcx    # D_21 in paper  

and data for train, dev and test should be placed inside every sub-directories in json format.

Training

Run train.py to start a training. Use --dataset_name to assign the dataset you want to train with, --prompt to choose the prompt type and --fewshot for fewshot setting. For example

LOG_DIR=logs_prompt_type3/pengb/
SEED=your_seed
CUDA_VISIBLE_DEVICES=1 python train.py --dataset_name pengb/14lap \
                                       --log_dir $LOG_DIR/14lap \
                                       --batch_size 16 \
                                       --lr 5e-5 \
                                       --n_epochs 100 \
                                       --save_model $LOG_DIR/14lap/models \
                                       --prompt type3 \
                                       --seed $SEED \
                                       --fewshot

Please do remember to cite this paper if you use our published dataset.

sentiprompt's People

Contributors

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