readme: ---
  language:
  
  - ca
  
  license: apache-2.0
  
  tags:
  
  - "catalan"
  
  - "masked-lm"
  
  - "RoBERTa-large-ca-v2"
  
  - "CaText"
  
  - "Catalan Textual Corpus"
  
  widget:
  - text: "El Català és una llengua molt <mask>."
  - text: "Salvador Dalí va viure a <mask>."
  - text: "La Costa Brava té les millors <mask> d'Espanya."
  - text: "El cacaolat és un batut de <mask>."
  - text: "<mask> és la capital de la Garrotxa."
  - text: "Vaig al <mask> a buscar bolets."
  - text: "Antoni Gaudí vas ser un <mask> molt important per la ciutat."
  - text: "Catalunya és una referència en <mask> a nivell europeu."
  
  ---
  
  # Catalan BERTa (roberta-large-ca-v2) large model
  
  ## Table of Contents
  <details>
  <summary>Click to expand</summary>
  
  - [Model description](#model-description)
  - [Intended uses and limitations](#intended-use)
  - [How to use](#how-to-use)
  - [Limitations and bias](#limitations-and-bias)
  - [Training](#training)
    - [Training data](#training-data)
    - [Training procedure](#training-procedure)
  - [Evaluation](#evaluation)
     - [CLUB benchmark](#club-benchmark)
     - [Evaluation results](#evaluation-results)
  - [Additional information](#additional-information)
    - [Author](#author)
    - [Contact information](#contact-information)
    - [Copyright](#copyright)
    - [Licensing information](#licensing-information)
    - [Funding](#funding)
    - [Citing information](#citing-information)
    - [Disclaimer](#disclaimer)
  
  </details>
  
  ## Model description
  
  The **roberta-large-ca-v2** is a transformer-based masked language model for the Catalan language. 
  It is based on the [RoBERTA](https://github.com/pytorch/fairseq/tree/master/examples/roberta) large model 
  and has been trained on a medium-size corpus collected from publicly available corpora and crawlers.
  
  ## Intended uses and limitations
  
  **roberta-large-ca-v2** model is ready-to-use only for masked language modeling to perform the Fill Mask task (try the inference API or read the next section).
  However, it is intended to be fine-tuned on non-generative downstream tasks such as Question Answering, Text Classification, or Named Entity Recognition.
  
  ## How to use
  
  Here is how to use this model:
  
  ```python
  from transformers import AutoModelForMaskedLM
  from transformers import AutoTokenizer, FillMaskPipeline
  from pprint import pprint
  tokenizer_hf = AutoTokenizer.from_pretrained('projecte-aina/roberta-large-ca-v2')
  model = AutoModelForMaskedLM.from_pretrained('projecte-aina/roberta-large-ca-v2')
  model.eval()
  pipeline = FillMaskPipeline(model, tokenizer_hf)
  text = f"Em dic <mask>."
  res_hf = pipeline(text)
  pprint([r['token_str'] for r in res_hf])
  ```
  
  ## Limitations and bias
  At the time of submission, no measures have been taken to estimate the bias embedded in the model. However, we are well aware that our models may be biased since the corpora have been collected using crawling techniques on multiple web sources. We intend to conduct research in these areas in the future, and if completed, this model card will be updated.
  
  ## Training
  
  ### Training data
  
  The training corpus consists of several corpora gathered from web crawling and public corpora.
  
  
  | Corpus                  | Size in GB |
  |-------------------------|------------|
  | Catalan Crawling        | 13.00      |
  | Wikipedia               | 1.10       |
  | DOGC                    | 0.78       |
  | Catalan Open Subtitles  | 0.02       |
  | Catalan Oscar           | 4.00       |
  | CaWaC                   | 3.60       |
  | Cat. General Crawling   | 2.50       |
  | Cat. Goverment Crawling | 0.24       |
  | ACN                     | 0.42       |
  | Padicat                 | 0.63       |
  | RacoCatalá              | 8.10       |
  | Nació Digital           | 0.42       |
  | Vilaweb                 | 0.06       |
  | Tweets                  | 0.02       |
  
  ### Training procedure
  
  The training corpus has been tokenized using a byte version of [Byte-Pair Encoding (BPE)](https://github.com/openai/gpt-2)
  used in the original [RoBERTA](https://github.com/pytorch/fairseq/tree/master/examples/roberta) model with a vocabulary size of 50,262 tokens. 
  The RoBERTa-large pretraining consists of a masked language model training that follows the approach employed for the RoBERTa large model
  with the same hyperparameters as in the original work.
  The training lasted a total of 96 hours with 32 NVIDIA V100 GPUs of 16GB DDRAM.
  
  
  ## Evaluation
  
  ### CLUB benchmark
  
  The BERTa-large model has been fine-tuned on the downstream tasks of the Catalan Language Understanding Evaluation benchmark (CLUB),
  that has been created along with the model.
  
  It contains the following tasks and their related datasets:
  
   1. Named Entity Recognition (NER)
  
      
      **[NER (AnCora)](https://zenodo.org/record/4762031#.YKaFjqGxWUk)**: extracted named entities from the original [Ancora](https://doi.org/10.5281/zenodo.4762030) version,
      filtering out some unconventional ones, like book titles, and transcribed them into a standard CONLL-IOB format
  
  
   2. Part-of-Speech Tagging (POS)
      
      **[POS (AnCora)](https://zenodo.org/