readme: ---
  tags:
  - generated_from_trainer
  datasets:
  - Graphcore/wikipedia-bert-128
  - Graphcore/wikipedia-bert-512
  model-index:
  - name: groupbert-base-uncased
    results: []
  license: apache-2.0
  language:
  - en
  ---
  
  <!-- This model card has been generated automatically according to the information the Trainer had access to. You
  should probably proofread and complete it, then remove this comment. -->
  
  # Graphcore/groupbert-base-uncased 
  
  Optimum Graphcore is a new open-source library and toolkit that enables developers to access IPU-optimized models certified by Hugging Face. It is an extension of Transformers, providing a set of performance optimization tools enabling maximum efficiency to train and run models on Graphcore’s IPUs - a completely new kind of massively parallel processor to accelerate machine intelligence. Learn more about how to take train Transformer models faster with IPUs at [hf.co/hardware/graphcore](https://huggingface.co/hardware/graphcore).
  
  Through HuggingFace Optimum, Graphcore released ready-to-use IPU-trained model checkpoints and IPU configuration files to make it easy to train models with maximum efficiency in the IPU. Optimum shortens the development lifecycle of your AI models by letting you plug-and-play any public dataset and allows a seamless integration to our State-of-the-art hardware giving you a quicker time-to-value for your AI project.      
  
  ## Model description
  
  GroupBERT (Bidirectional Encoder Representations from Transformers) is a transformers model which is designed by Graphcore to pretrain bidirectional representations from unlabelled texts. GroupBERT uses grouped convolutions and matmuls in the encoder, which allows to parallelize computation and achieve higher parameter efficiency. More details are described in the [GroupBERT paper](https://arxiv.org/pdf/2106.05822.pdf).    
  
  It was trained with two objectives in pretraining : Masked language modelling (MLM) and Next sentence prediction(NSP). First, MLM is different from traditional LM which sees the words one after another while BERT allows the model to learn a bidirectional representation.  In addition to MLM, NSP is used for jointly pertaining text-pair representations. Similarly to BERT it enables easy and fast fine-tuning for different downstream tasks such as Sequence Classification, Named Entity Recognition, Question Answering, Multiple Choice and MaskedLM.
  
  It reduces the need of many engineering efforts for building task specific architectures through pre-trained representation. And achieves state-of-the-art performance on a large suite of sentence-level and token-level tasks.
  
  
  ## Intended uses & limitations
  This model is a pre-trained GroupBERT-Base trained in two phases on the [Graphcore/wikipedia-bert-128](https://huggingface.co/datasets/Graphcore/wikipedia-bert-128) and [Graphcore/wikipedia-bert-512](https://huggingface.co/datasets/Graphcore/wikipedia-bert-512) datasets.
  
  It was trained on a Graphcore IPU-POD16 using [`optimum-graphcore`](https://github.com/huggingface/optimum-graphcore).
  Graphcore and Hugging Face are working together to make training of Transformer models on IPUs fast and easy. Learn more about how to take advantage of the power of Graphcore IPUs to train Transformers models at [hf.co/hardware/graphcore](https://huggingface.co/hardware/graphcore).
  
  ## Training and evaluation data
  
  Trained on wikipedia datasets:
  - [Graphcore/wikipedia-bert-128](https://huggingface.co/datasets/Graphcore/wikipedia-bert-128)
  - [Graphcore/wikipedia-bert-512](https://huggingface.co/datasets/Graphcore/wikipedia-bert-512)
  
  ## Fine-tuning with these weights
  
  These weights can be used in either `transformers` or [`optimum-graphcore`](https://github.com/huggingface/optimum-graphcore).
  
  For example, to fine-tune the SQuAD v1 with `optimum-graphcore` you can do:
  
  ```
  python examples/question-answering/run_qa.py \
  --model_name_or_path Graphcore/groupbert-base-uncased \
  --ipu_config_name Graphcore/groupbert-base-uncased \
  --dataset_name squad \
  --version_2_with_negative False \
  --do_train \
  --do_eval \
  --pad_on_batch_axis \
  --num_train_epochs 1 \
  --per_device_train_batch_size 1 \
  --per_device_eval_batch_size 16 \
  --gradient_accumulation_steps 10 \
  --pod_type pod16 \
  --learning_rate 4e-4 \
  --max_seq_length 384 \
  --doc_stride 128 \
  --seed 42 \
  --lr_scheduler_type linear \
  --lamb \
  --loss_scaling 64 \
  --weight_decay 0.01 \
  --warmup_ratio 0.1 \
  --logging_steps 5 \
  --save_steps -1 \
  --dataloader_num_workers 64 \
  --output_dir output/squad_groupbert_base
  ```
  
  ## Training procedure
  
  Trained MLM and NSP pre-training scheme from [Large Batch Optimization for Deep Learning: Training BERT in 76 minutes](https://arxiv.org/abs/1904.00962).
  Trained on a Graphcore IPU-POD16 using [`optimum-graphcore`](https://github.com/huggingface/optimum-graphcore).
  
  It was trained with the IPUConfig [Graphcore/bert-base-ipu](https://huggingface.co/Graphcore/bert-base-ipu/).
  
  Command lines:
  
  Phase 1:
  ```
  python examples/language-modeling/run_pretrain