GithubHelp home page GithubHelp logo

dengbocong / prompt-tuning Goto Github PK

View Code? Open in Web Editor NEW
39.0 4.0 14.0 70 KB

A pipeline for Prompt-tuning

License: MIT License

Shell 1.17% Python 98.83%
deep-learning classification few-shot-learning fine-tuning nlp pretrained-models prompt prompt-tuning

prompt-tuning's Introduction

Prompt-Tuning

  • A pipeline for Prompt-tuning
  • 集成主流的Prompt-tuning相关方法,以及search template策略
  • 提供Prompt-tuning完整的执行pipeline

Requirements

本项目相关的依赖包参考requirements.txt,也可直接使用如下指令安装:

pip install -r requirements.txt

Usage

  • core下放置相关prompt-tuning模型
  • core/gen_template下是相关template生成方法,执行入口参考run_gen_template.py,执行示例如下:
python3 run_gen_template.py \
    --task_name CoLA \
    --k 16 \
    --dev_rate 1 \
    --data_loader glue \
    --template_generator lm_bff \
    --data_dir data/original/CoLA \
    --output_dir data/output \
    --generator_config_path data/config/lm_bff.json
  • 模型实现放在core目录下,执行入口参考run_prompt_tuning.py,执行示例如下:
python3 run_prompt_tuning.py \
    --data_dir data/CoLA/ \
    --do_train \
    --do_eval \
    --do_predict \
    --model_name_or_path bert \
    --num_k 16 \
    --max_steps 1000 \
    --eval_steps 100 \
    --learning_rate 1e-5 \
    --output_dir result/ \
    --seed 16
    --template "*cls**sent_0*_It_was*mask*.*sep+*" \
    --mapping "{'0':'terrible','1':'great'}" \
    --num_sample 16 \
  • data放置相关config及datasets,由于数据集比较庞大,可使用scripts下的下载脚本自行下载,如下:
cd data
sh download_clue_dataset.sh
sh download_glue_dataset.sh
  • tools放置相关工具方法及数据集处理方法等

Paper

更详细的论文解读和阅读笔记 ☞ 点这里

Reference

Dataset

sh scripts/download_glue_dataset.sh
sh scripts/download_clue_dataset.sh

prompt-tuning's People

Contributors

dengbocong 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

Watchers

 avatar  avatar  avatar  avatar

prompt-tuning's Issues

运行 run_prompt_tuning 报错

run_gen_template.py has no error when running, but later run_prompt_tuning.py occurs errors(1、2) as follow:

error01

I'm very grateful if you have any advice!

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.