readme: ---
  language: 
    - es
  tags:
  - biomedical
  - clinical
  - spanish
  license: apache-2.0
  metrics:
  - ppl
  widget:
  - text: "El único antecedente personal a reseñar era la <mask> arterial."
  - text: "Las radiologías óseas de cuerpo entero no detectan alteraciones <mask>, ni alteraciones vertebrales."
  - text: "En el <mask> toraco-abdómino-pélvico no se encontraron hallazgos patológicos de interés."
  ---
  
  # Biomedical language model for Spanish
  
  ## 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)
    - [Tokenization and model pretraining](#Tokenization-modelpretraining)
    - [Training corpora and preprocessing](#Trainingcorpora-preprocessing)
  - [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>
  
  
  ## Model description
  Biomedical pretrained language model for Spanish. For more details about the corpus, the pretraining and the evaluation, check the official [repository](https://github.com/PlanTL-GOB-ES/lm-biomedical-clinical-es).
  
  ## Intended uses and limitations
  
  The model is ready-to-use only for masked language modelling to perform the Fill Mask task (try the inference API or read the next section). However, it is intended to be fine-tuned on downstream tasks such as Named Entity Recognition or Text Classification.
  
  ## How to use
  
  
  ## 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
  
  ### Tokenization and model pretraining
  
  This model is a [RoBERTa-based](https://github.com/pytorch/fairseq/tree/master/examples/roberta) model trained on a
  **biomedical** corpus in Spanish collected from several sources (see next section). 
  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 52,000 tokens. The pretraining consists of a masked language model training at the subword level following the approach employed for the RoBERTa base model with the same hyperparameters as in the original work. The training lasted a total of 48 hours with 16 NVIDIA V100 GPUs of 16GB DDRAM, using Adam optimizer with a peak learning rate of 0.0005 and an effective batch size of 2,048 sentences.
  
  
  ### Training corpora and preprocessing
  
  The training corpus is composed of several biomedical corpora in Spanish, collected from publicly available corpora and crawlers.
  To obtain a high-quality training corpus, a cleaning pipeline with the following operations has been applied:
  
  - data parsing in different formats
    - sentence splitting
    - language detection
    - filtering of ill-formed sentences 
    - deduplication of repetitive contents
    - keep the original document boundaries
  
  Finally, the corpora are concatenated and further global deduplication among the corpora has been applied.
  The result is a medium-size biomedical corpus for Spanish composed of about 963M tokens. The table below shows some basic statistics of the individual cleaned corpora:
  
      
  | Name                                                                                    | No. tokens  | Description                                                                                                                                                                                                                                          |
  |-----------------------------------------------------------------------------------------|-------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  | [Medical crawler](https://zenodo.org/record/4561970)                                    | 903,558,136 | Crawler of more than 3,000 URLs belonging to Spanish biomedical and health domains.                                                                                                                                                                                 |
  | Clinical cases misc.                                                                    | 102,855,267 | A miscellany of medical content, e