Commit ·
c7bee62
0
Parent(s):
Duplicate from google/electra-small-generator
Browse filesCo-authored-by: Julien Chaumond <julien-c@users.noreply.huggingface.co>
Files changed (9)
- .gitattributesAdded+9
- README.mdAdded+33
- config.jsonAdded+26
- flax_model.msgpackAdded+3
- pytorch_model.binAdded+3
- tf_model.h5Added+3
- tokenizer.jsonAdded
- tokenizer_config.jsonAdded+1
- vocab.txtAdded
123456789*.bin.* filter=lfs diff=lfs merge=lfs -text*.lfs.* filter=lfs diff=lfs merge=lfs -text*.bin filter=lfs diff=lfs merge=lfs -text*.h5 filter=lfs diff=lfs merge=lfs -text*.tflite filter=lfs diff=lfs merge=lfs -text*.tar.gz filter=lfs diff=lfs merge=lfs -text*.ot filter=lfs diff=lfs merge=lfs -text*.onnx filter=lfs diff=lfs merge=lfs -text*.msgpack filter=lfs diff=lfs merge=lfs -text123456789101112131415161718192021222324252627282930313233---language: enthumbnail: https://huggingface.co/front/thumbnails/google.png
license: apache-2.0---
**WARNING**: This is the official generator checkpoint as in the [ELECTRA original codebase](https://github.com/google-research/electra). However, this model is not scaled properly for pre-training with [google/electra-small-discriminator](https://huggingface.co/google/electra-small-discriminator). The paper recommends a hyperparameter multiplier of 1/4 between the discriminator and generator for this given model to avoid training instabilities. This would not be the case when using `google/electra-small-generator` and `google/electra-small-discriminator`, which are similar in size.
## ELECTRA: Pre-training Text Encoders as Discriminators Rather Than Generators
**ELECTRA** is a new method for self-supervised language representation learning. It can be used to pre-train transformer networks using relatively little compute. ELECTRA models are trained to distinguish "real" input tokens vs "fake" input tokens generated by another neural network, similar to the discriminator of a [GAN](https://arxiv.org/pdf/1406.2661.pdf). At small scale, ELECTRA achieves strong results even when trained on a single GPU. At large scale, ELECTRA achieves state-of-the-art results on the [SQuAD 2.0](https://rajpurkar.github.io/SQuAD-explorer/) dataset.
For a detailed description and experimental results, please refer to our paper [ELECTRA: Pre-training Text Encoders as Discriminators Rather Than Generators](https://openreview.net/pdf?id=r1xMH1BtvB).
This repository contains code to pre-train ELECTRA, including small ELECTRA models on a single GPU. It also supports fine-tuning ELECTRA on downstream tasks including classification tasks (e.g,. [GLUE](https://gluebenchmark.com/)), QA tasks (e.g., [SQuAD](https://rajpurkar.github.io/SQuAD-explorer/)), and sequence tagging tasks (e.g., [text chunking](https://www.clips.uantwerpen.be/conll2000/chunking/)).
## How to use the generator in `transformers`
```pythonfrom transformers import pipeline
fill_mask = pipeline( "fill-mask", model="google/electra-small-generator", tokenizer="google/electra-small-generator")
print( fill_mask(f"HuggingFace is creating a {nlp.tokenizer.mask_token} that the community uses to solve NLP tasks."))
```1234567891011121314151617181920212223242526{ "architectures": [ "ElectraForMaskedLM" ], "attention_probs_dropout_prob": 0.1, "embedding_size": 128, "hidden_act": "gelu", "hidden_dropout_prob": 0.1, "hidden_size": 256, "initializer_range": 0.02, "intermediate_size": 1024, "layer_norm_eps": 1e-12, "max_position_embeddings": 512, "model_type": "electra", "num_attention_heads": 4, "num_hidden_layers": 12, "pad_token_id": 0, "position_embedding_type": "absolute", "summary_activation": "gelu", "summary_last_dropout": 0.1, "summary_type": "first", "summary_use_proj": true, "transformers_version": "4.6.0.dev0", "type_vocab_size": 2, "vocab_size": 30522}123version https://git-lfs.github.com/spec/v1oid sha256:bf4a49d8541561372550fc94db6847b52447fc339dc1b95717809024fae36ad1size 54194080123version https://git-lfs.github.com/spec/v1oid sha256:0024548b9e17fd7740ed28ed8ee56397d7cdbabfeaa0e934e32b275b05b96378size 54236116123version https://git-lfs.github.com/spec/v1oid sha256:7e429bb09fee5b7271308e156a17400d06c026aadc531cb6605a17ab926fd522size 703603121{"do_lower_case": true, "model_max_length": 512}.gitattributesAdded+9
README.mdAdded+33
config.jsonAdded+26
flax_model.msgpackAdded+3
pytorch_model.binAdded+3
tf_model.h5Added+3
tokenizer.jsonAdded
tokenizer_config.jsonAdded+1
vocab.txtAdded