CIKM2023最佳演示论文奖。HugNLP是基于HuggingFace Transformer的统一、全面的NLP库。请现在就拥抱NLP吧!
CIKM2023最佳演示论文奖。HugNLP是基于HuggingFace Transformer的统一、全面的NLP库。请现在就拥抱NLP吧!
Welcome to use HugNLP. Hugging for NLP!
HugNLP is a novel development and application library based on Hugging Face for improving the convenience and effectiveness of NLP researchers.
The framework overview is shown as follows:
In HugNLP, we provide some popular transformer-based models as backbones, such as BERT, RoBERTa, GPT-2, etc. We also release our pre-built KP-PLM, a novel knowledge-enhanced pre-training paradigm to inject factual knowledge and can be easily used for arbitrary PLMs. Apart from basic PLMs, we also implement some task-specific models, involving sequence classification, matching, labeling, span extraction, multi-choice, and text generation. Notably, we develop standard fine-tuning (based on CLS Head and prompt-tuning models that enable PLM tuning on classification tasks. For few-shot learning settings, HugNLP provides a prototypical network in both few-shot text classification and named entity recognition (NER).
In addition, we also incorporate some plug-and-play utils in HugNLP.
use_freezing and freeze the backbone. A use case is shown in Code.Processors aim to load the dataset and process the task examples in a pipeline containing sentence tokenization, sampling, and tensor generation.
Specifically, users can directly obtain the data through load_dataset, which can directly download it from the Internet or load it from the local disk.
For different tasks, users should define a task-specific data collator, which aims to transform the original examples into model input tensor features.
It provides rich modules for users to build real-world applications and products by selecting among an array of settings from Models and Processors.
We provide some core capacities to support the NLP downstream applications.
Conventional pre-training methods lack factual knowledge. To deal with this issue, we present KP-PLM with a novel knowledge prompting paradigm for knowledge-enhanced pre-training.
Specifically, we construct a knowledge sub-graph for each input text by recognizing entities and aligning with the knowledge base and decompose this sub-graph into multiple relation paths, which can be directly transformed into language prompts.
Prompt-based fine-tuning aims to reuse the pre-training objective (e.g., Masked Language Modeling, Causal Language Modeling) and utilizes a well-designed template and verbalizer to make predictions, which has achieved great success in low-resource settings.
We integrate some novel approaches into HugNLP, such as PET, P-tuning, etc.
Instruction-tuning and in-context learning enable few/zero-shot learning without parameter update, which aims to concatenate the task-aware instructions or example-based demonstrations to prompt GPT-style PLMs to generate reliable responses. So, all the NLP tasks can be unified into the same format and can substantially improve the models" generalization.
Inspired by this idea, we extend it into other two paradigms:
Self-training can address the labeled data scarcity issue by leveraging the large-scale unlabeled data in addition to labeled data, which is one of the mature paradigms in semi-supervised learning. However, the standard self-training may generate too much noise, inevitably degrading the model performance due to confirmation bias.
Thus, we present uncertainty-aware self-training. Specifically, we train a teacher model on few-shot labeled data, and then use Monte Carlo (MC) dropout technique in Bayesian neural network (BNN) to approximate the model certainty, and judiciously select the examples that have a higher model certainty of the teacher.
To improve the training efficiency of HugNLP, we also implement parameter-efficient learning, which aims to freeze some parameters in the backbone so that we only tune a few parameters during model training. We develop some novel parameter-efficient learning approaches, such as Prefix-tuning, Adapter-tuning, BitFit and LoRA, etc.
$ git clone https://github.com/HugAILab/HugNLP.git
$ cd HugNLP
$ python3 setup.py installAt present, the project is still being developed and improved, and there may be some bugs in use, please understand. We also look forward to your being able to ask issues or committing some valuable pull requests.
We demonstrate all pre-built applications in HugNLP. You can choose one application to use HugNLP. You can also click the link to see the details document.
| Applications | Runing Tasks | Task Notes | PLM Models | Documents |
|---|---|---|---|---|
| Default Application | run_seq_cls.sh | Goal: Standard Fine-tuning or Prompt-tuning for sequence classification on user-defined dataset. ` | ||
| ` Path: applications/default_applications | BERT, RoBERTa, DeBERTa | click | ||
| run_seq_labeling.sh | Goal: Standard Fine-tuning for sequence labeling on user-defined dataset. ` | |||
| ` Path: applications/default_applications | BERT, RoBERTa, ALBERT | |||
| Pre-training | run_pretrain_mlm.sh | Goal: Pre-training via Masked Language Modeling (MLM). ` | ||
| ` Path: applications/pretraining/ | BERT, RoBERTa | click | ||
| run_pretrain_casual_lm.sh | Goal: Pre-training via Causal Language Modeling (CLM). ` | |||
| ` Path: applications/pretraining | BERT, RoBERTa | click | ||
| GLUE Benchmark | run_glue.sh | Goal: Standard Fine-tuning or Prompt-tuning for GLUE classification tasks. ` | ||
| ` Path: applications/benchmark/glue | BERT, RoBERTa, DeBERTa | |||
| run_causal_incontext_glue.sh | Goal: In-context learning for GLUE classification tasks. ` | |||
| ` Path: applications/benchmark/glue | GPT-2 | |||
| CLUE Benchmark | clue_finetune_dev.sh | Goal: Standard Fine-tuning and Prompt-tuning for CLUE classification task。 ` | ||
| ` Path: applications/benchmark/clue | BERT, RoBERTa, DeBERTa | |||
| run_clue_cmrc.sh | Goal: Standard Fine-tuning for CLUE CMRC2018 task. ` | |||
| ` Path: applications/benchmark/cluemrc | BERT, RoBERTa, DeBERTa | |||
| run_clue_c3.sh | Goal: Standard Fine-tuning for CLUE C3 task. ` | |||
| ` Path: applications/benchmark/cluemrc | BERT, RoBERTa, DeBERTa | |||
| run_clue_chid.sh | Goal: Standard Fine-tuning for CLUE CHID task. ` | |||
| ` Path: applications/benchmark/cluemrc | BERT, RoBERTa, DeBERTa |
暂无开放 Issues,或尚未同步最近议题。