Code for a research paper on Dice Loss
Top 95.2% on sourcepulse
This repository provides the implementation for "Dice Loss for Data-imbalanced NLP Tasks," a method to improve model performance on imbalanced datasets in Natural Language Processing. It is targeted at NLP researchers and practitioners dealing with class imbalance issues. The primary benefit is enhanced accuracy and robustness in tasks like machine reading comprehension, paraphrase identification, named entity recognition, and text classification.
How It Works
The project implements Dice Loss, a metric derived from the Dice coefficient, which is known for its effectiveness in segmentation tasks. By adapting Dice Loss for NLP, the approach aims to directly optimize for overlap and reduce sensitivity to class imbalance compared to traditional losses like cross-entropy. This is achieved by integrating the Dice Loss function into BERT-based models for various NLP tasks.
Quick Start & Requirements
pip install torch==1.7.1+cu101 torchvision==0.8.2+cu101 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html
followed by pip install -r requirements.txt
.scripts/prepare_ckpt.sh
. Datasets for specific tasks (SQuAD 1.1, MRPC, NER datasets, TNews) need to be downloaded separately.Highlighted Details
Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
The setup requires specific versions of PyTorch and CUDA, and manual conversion of BERT checkpoints. The project focuses on BERT as the backbone, limiting its direct applicability to other architectures without modification.
2 years ago
Inactive