• Stars
    star
    111
  • Rank 314,510 (Top 7 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 3 years ago
  • Updated over 1 year 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

A WebUI for Efficient Fine-Tuning of 100+ LLMs (ACL 2024)
Python
29,137
star
2

ChatGLM-Efficient-Tuning

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

LLaMA-Factory-Doc

LLaMA Factory Document
40
star
4

PBAN-PyTorch

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

AMP-Regularizer

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

FastEdit

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

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
8

AMP-Poster-Slides-LaTeX

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

ChatNVL-Towards-Visual-Novel-ChatBot

Python
16
star
10

HuaweiCup2021-MCM-ProblemE

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

bilibili-parse

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

Image-Segmentation-PyTorch

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

cryptography-experiment

BUAA CST Spring 2019 Cryptography Experiment
Python
9
star
14

buaa-counselor-order

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

BiLSTM-CRF-PyTorch-demo

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

hiyouga-blog-project

填坑ing...
TypeScript
5
star
17

SAGAN-PyTorch

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

Visual-Novel-Music

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

LLaMA-QQ-Chatbot

A QQ chatbot using OpenAI API
JavaScript
4
star
20

Musicbox-for-web

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

Toxic_Detection

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

Java-Network-Capturer

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

database-experiment

BUAA CST Autumn 2019 Database Experiment
JavaScript
2
star
24

Cuisine_Prediction

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

digiC-experiment

BUAA CST Autumn 2018 Digital Circuit Experiment
Verilog
1
star
26

Survey-readme-template

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

PY-Learning

学习代码
Python
1
star
28

information-theory-experiment

BUAA CST Spring 2019 Information Theory Experiment
Python
1
star
29

hiyouga

1
star
30

yukidou-wechat

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

getchu-proxy

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

Papercode-readme-template

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