• Stars
    star
    111
  • Rank 304,888 (Top 7 %)
  • Language
    Python
  • License
    MIT License
  • Created over 2 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Code for our paper "Dual Contrastive Learning: Text Classification via Label-Aware Data Augmentation"

Dual-Contrastive-Learning

GitHub

PWC

PWC

PWC

A PyTorch implementation for our paper "Dual Contrastive Learning: Text Classification via Label-Aware Data Augmentation".

You can download the paper via: [ArXiv] [PapersWithCode].

One-Sentence Summary

This paper proposes a novel contrastive learning framework for supervised classification tasks by simultaneously learning the features of input samples and the parameters of classifiers in the same space.

method

Abstract

Contrastive learning has achieved remarkable success in representation learning via self-supervision in unsupervised settings. However, effectively adapting contrastive learning to supervised learning tasks remains as a challenge in practice. In this work, we introduce a dual contrastive learning (DualCL) framework that simultaneously learns the features of input samples and the parameters of classifiers in the same space. Specifically, DualCL regards the parameters of the classifiers as augmented samples associating to different labels and then exploits the contrastive learning between the input samples and the augmented samples. Empirical studies on five benchmark text classification datasets and their low-resource version demonstrate the improvement in classification accuracy and confirm the capability of learning discriminative representations of DualCL.

Requirement

  • Python = 3.7
  • torch = 1.11.0
  • numpy = 1.17.2
  • transformers = 4.19.2

Preparation

Clone

git clone https://github.com/hiyouga/Dual-Contrastive-Learning.git

Create an anaconda environment:

conda create -n dualcl python=3.7
conda activate dualcl
pip install -r requirements.txt

Usage

python main.py --method dualcl

Citation

If this work is helpful, please cite as:

@article{chen2022dual,
  title={Dual Contrastive Learning: Text Classification via Label-Aware Data Augmentation},
  author={Qianben Chen and Richong Zhang and Yaowei Zheng and Yongyi Mao},
  journal={arXiv preprint},
  year={2022}
}

Contact

hiyouga [AT] buaa [DOT] edu [DOT] cn

License

MIT

More Repositories

1

LLaMA-Factory

Easy-to-use LLM fine-tuning framework (LLaMA, BLOOM, Mistral, Baichuan, Qwen, ChatGLM)
Python
7,645
star
2

ChatGLM-Efficient-Tuning

Fine-tuning ChatGLM-6B with PEFT | 基于 PEFT 的高效 ChatGLM 微调
Python
3,349
star
3

PBAN-PyTorch

A Position-aware Bidirectional Attention Network for Aspect-level Sentiment Analysis, PyTorch implementation.
Python
35
star
4

AMP-Regularizer

Code for our paper "Regularizing Neural Networks via Adversarial Model Perturbation", CVPR2021
Python
31
star
5

FastEdit

⚡🩹 Editing large language models within 10 seconds
Python
31
star
6

RepWalk

Code and dataset for our paper "Replicate, Walk, and Stop on Syntax: an Effective Neural Network Model for Aspect-Level Sentiment Classification", AAAI2020
Python
25
star
7

AMP-Poster-Slides-LaTeX

LaTeX Poster and Slides for AMP (CVPR 2021)
TeX
17
star
8

ChatNVL-Towards-Visual-Novel-ChatBot

Python
16
star
9

HuaweiCup2021-MCM-ProblemE

2021年华为杯第十八届中国研究生数学建模竞赛E题全国一等奖
Python
16
star
10

bilibili-parse

bilibili视频html5直播&下载&API(待修复)
PHP
15
star
11

Image-Segmentation-PyTorch

U-Net for image segmentation, PyTorch implementation.
Python
13
star
12

cryptography-experiment

BUAA CST Spring 2019 Cryptography Experiment
Python
9
star
13

buaa-counselor-order

辅导员预约微信小程序
JavaScript
7
star
14

BiLSTM-CRF-PyTorch-demo

A simple baseline model for Named Entity Recognition
Python
7
star
15

SAGAN-PyTorch

A PyTorch implementation for Self-Attention Generative Adversarial Networks
Python
5
star
16

hiyouga-blog-project

填坑ing...
TypeScript
5
star
17

Visual-Novel-Music

视觉小说音乐库(跑路ing)
PHP
5
star
18

LLaMA-QQ-Chatbot

A QQ chatbot using OpenAI API
JavaScript
4
star
19

Musicbox-for-web

论坛中使用的简易音乐播放器
PHP
3
star
20

Toxic_Detection

BUAA SCSE Autumn 2021 Machine Learning Group Homework
Python
3
star
21

Java-Network-Capturer

BUAA CST Autumn 2018 Java Programming Course Design
Java
3
star
22

database-experiment

BUAA CST Autumn 2019 Database Experiment
JavaScript
2
star
23

Cuisine_Prediction

BUAA SCSE Autumn 2021 Machine Learning Personal Homework
Python
2
star
24

digiC-experiment

BUAA CST Autumn 2018 Digital Circuit Experiment
Verilog
1
star
25

Survey-readme-template

How to write a pretty readme for your survey.
1
star
26

PY-Learning

学习代码
Python
1
star
27

information-theory-experiment

BUAA CST Spring 2019 Information Theory Experiment
Python
1
star
28

hiyouga

1
star
29

yukidou-wechat

祐希堂汉化组公众号接口
PHP
1
star
30

getchu-proxy

论坛中使用的Getchu游戏信息抓取
PHP
1
star
31

Papercode-readme-template

How to write a pretty readme for your paper's code.
1
star