mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-06 14:20:04 +06:00

* wip * rebase * all tests pass * rebase * ready for PR * address comments * fix styles * add require_torch to pipeline test * remove remote image to improve CI consistency * address comments; fix tf/flax tests * address comments; fix tf/flax tests * fix tests; add alias * repo consistency tests * Update src/transformers/pipelines/visual_question_answering.py Co-authored-by: NielsRogge <48327001+NielsRogge@users.noreply.github.com> * address comments * Update src/transformers/pipelines/visual_question_answering.py Co-authored-by: NielsRogge <48327001+NielsRogge@users.noreply.github.com> * merge * wip * wip * wip * most basic tests passes * all tests pass now * relative embedding * wip * running make fixup * remove bert changes * fix doc * fix doc * fix issues * fix doc * address comments * fix CI * remove redundant copied from * address comments * fix broken test Co-authored-by: Sijun He <sijunhe@Sijuns-MacBook-Pro.local> Co-authored-by: NielsRogge <48327001+NielsRogge@users.noreply.github.com>
76 lines
2.7 KiB
Plaintext
76 lines
2.7 KiB
Plaintext
<!--Copyright 2022 The HuggingFace Team. All rights reserved.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
|
the License. You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
|
|
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
specific language governing permissions and limitations under the License.
|
|
-->
|
|
|
|
# Nezha
|
|
|
|
## Overview
|
|
|
|
The Nezha model was proposed in [NEZHA: Neural Contextualized Representation for Chinese Language Understanding](https://arxiv.org/abs/1909.00204) by Junqiu Wei et al.
|
|
|
|
The abstract from the paper is the following:
|
|
|
|
*The pre-trained language models have achieved great successes in various natural language understanding (NLU) tasks
|
|
due to its capacity to capture the deep contextualized information in text by pre-training on large-scale corpora.
|
|
In this technical report, we present our practice of pre-training language models named NEZHA (NEural contextualiZed
|
|
representation for CHinese lAnguage understanding) on Chinese corpora and finetuning for the Chinese NLU tasks.
|
|
The current version of NEZHA is based on BERT with a collection of proven improvements, which include Functional
|
|
Relative Positional Encoding as an effective positional encoding scheme, Whole Word Masking strategy,
|
|
Mixed Precision Training and the LAMB Optimizer in training the models. The experimental results show that NEZHA
|
|
achieves the state-of-the-art performances when finetuned on several representative Chinese tasks, including
|
|
named entity recognition (People's Daily NER), sentence matching (LCQMC), Chinese sentiment classification (ChnSenti)
|
|
and natural language inference (XNLI).*
|
|
|
|
This model was contributed by [sijunhe](https://huggingface.co/sijunhe). The original code can be found [here](https://github.com/huawei-noah/Pretrained-Language-Model/tree/master/NEZHA-PyTorch).
|
|
|
|
## NezhaConfig
|
|
|
|
[[autodoc]] NezhaConfig
|
|
|
|
## NezhaModel
|
|
|
|
[[autodoc]] NezhaModel
|
|
- forward
|
|
|
|
## NezhaForPreTraining
|
|
|
|
[[autodoc]] NezhaForPreTraining
|
|
- forward
|
|
|
|
## NezhaForMaskedLM
|
|
|
|
[[autodoc]] NezhaForMaskedLM
|
|
- forward
|
|
|
|
## NezhaForNextSentencePrediction
|
|
|
|
[[autodoc]] NezhaForNextSentencePrediction
|
|
- forward
|
|
|
|
## NezhaForSequenceClassification
|
|
|
|
[[autodoc]] NezhaForSequenceClassification
|
|
- forward
|
|
|
|
## NezhaForMultipleChoice
|
|
|
|
[[autodoc]] NezhaForMultipleChoice
|
|
- forward
|
|
|
|
## NezhaForTokenClassification
|
|
|
|
[[autodoc]] NezhaForTokenClassification
|
|
- forward
|
|
|
|
## NezhaForQuestionAnswering
|
|
|
|
[[autodoc]] NezhaForQuestionAnswering
|
|
- forward |