readme: ---
  
  language:
  
  - es
  
  license: apache-2.0
  
  tags:
  
  - "national library of spain"
  
  - "spanish"
  
  - "bne"
  
  - "roberta-base-bne"
  
  datasets:
  
  - "bne"
  
  metrics:
  
  - "ppl"
  
  widget:
  - text: "Por la ventanilla del coche vi la Giralda y pensé que bonita que es la ciudad de <mask>." 
  - text: "Más vale <mask> que lamentar."
  - text: "Caminante no hay camino, se hace camino al <mask>."
  - text: "Tengo una pelota roja y otra amarilla. Si le doy la roja a Jose, sólo me queda la <mask>."
  - text: "Tengo una pelota roja y otra amarilla. Si le doy la amarilla a Jose, sólo me queda la <mask>."
  - text: "El <mask> es el pico más alto de España."
  
  ---
  
  # RoBERTa base trained with data from the National Library of Spain (BNE)
  
  ## Table of Contents
  <details>
  <summary>Click to expand</summary>
  
  - [Overview](#overview)
  - [Model description](#model-description)
  - [Intended uses and limitations](#intended-uses-and-limitations)
  - [How to use](#how-to-use)
  - [Limitations and bias](#limitations-and-bias)
  - [Training](#training)
    - [Training data](#training-data)
    - [Training procedure](#training-procedure)
  - [Evaluation](#evaluation)
  - [Additional information](#additional-information)
    - [Author](#author)
    - [Contact information](#contact-information)
    - [Copyright](#copyright)
    - [Licensing information](#licensing-information)
    - [Funding](#funding)
    - [Citation Information](#citation-information)
    - [Disclaimer](#disclaimer)
  
  </details>
  
  ## Overview
  - **Architecture:** roberta-base
  - **Language:** Spanish
  - **Task:** fill-mask
  - **Data:** BNE
  
  ## Model description
  The **roberta-base-bne** is a transformer-based masked language model for the Spanish language. It is based on the [RoBERTa](https://arxiv.org/abs/1907.11692) base model and has been pre-trained using the largest Spanish corpus known to date, with a total of 570GB of clean and deduplicated text processed for this work, compiled from the web crawlings performed by the [National Library of Spain (Biblioteca Nacional de España)](http://www.bne.es/en/Inicio/index.html) from 2009 to 2019.
  
  ## Intended uses and limitations
  The **roberta-base-bne** 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.
  You can use the raw model for fill mask or fine-tune it to a downstream task.
  
  ## How to use
  Here is how to use this model:
  
  ```python
  >>> from transformers import pipeline
  >>> from pprint import pprint
  >>> unmasker = pipeline('fill-mask', model='PlanTL-GOB-ES/roberta-base-bne')
  >>> pprint(unmasker("Gracias a los datos de la BNE se ha podido <mask> este modelo del lenguaje."))
  [{'score': 0.08422081917524338, 
  'token': 3832, 
  'token_str': ' desarrollar', 
  'sequence': 'Gracias a los datos de la BNE se ha podido desarrollar este modelo del lenguaje.'}, 
  {'score': 0.06348305940628052, 
  'token': 3078, 
  'token_str': ' crear', 
  'sequence': 'Gracias a los datos de la BNE se ha podido crear este modelo del lenguaje.'}, 
  {'score': 0.06148449331521988, 
  'token': 2171, 
  'token_str': ' realizar', 
  'sequence': 'Gracias a los datos de la BNE se ha podido realizar este modelo del lenguaje.'}, 
  {'score': 0.056218471378088, 
  'token': 10880, 
  'token_str': ' elaborar', 
  'sequence': 'Gracias a los datos de la BNE se ha podido elaborar este modelo del lenguaje.'}, 
  {'score': 0.05133328214287758, 
  'token': 31915, 
  'token_str': ' validar', 
  'sequence': 'Gracias a los datos de la BNE se ha podido validar este modelo del lenguaje.'}]
  ```
  
  Here is how to use this model to get the features of a given text in PyTorch:
  
  ```python
  >>> from transformers import RobertaTokenizer, RobertaModel
  >>> tokenizer = RobertaTokenizer.from_pretrained('PlanTL-GOB-ES/roberta-base-bne')
  >>> model = RobertaModel.from_pretrained('PlanTL-GOB-ES/roberta-base-bne')
  >>> text = "Gracias a los datos de la BNE se ha podido desarrollar este modelo del lenguaje."
  >>> encoded_input = tokenizer(text, return_tensors='pt')
  >>> output = model(**encoded_input)
  >>> print(output.last_hidden_state.shape)
  torch.Size([1, 19, 768])
  ```
  
  
  ## Limitations and bias
  
  At the time of submission, no measures have been taken to estimate the bias and toxicity 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. Nevertheless, here's an example of how the model can have biased predictions:
  
  ```python
  >>> from transformers import pipeline, set_seed
  >>> from pprint import pprint
  >>> unmasker = pipeline('fill-mask', model='PlanTL-GOB-ES/roberta-base-bne')
  >>> set_seed(42)
  >>> pprint(unmasker("Antonio está pensando en <mask>."))
  [{'score': 0.07950365543365479,
    'sequence': 'Antonio está pensando en ti.',
    'tok