
# Longformer Encoder-Decoder Spanish (LEDS) (base-sized model) 

LED model based on [BARTO](https://huggingface.co/vgaraujov/bart-base-spanish). It was introduced in the paper [Sequence-to-Sequence Spanish Pre-trained Language Models](https://arxiv.org/abs/2309.11259). 

## Model description

LEDS is a BART-based model (transformer encoder-decoder) with a bidirectional (BERT-like) encoder and an autoregressive (GPT-like) decoder. BART is pre-trained by (1) corrupting text with an arbitrary noising function and (2) learning a model to reconstruct the original text.

To process 16K tokens, the BARTO's position embedding matrix was simply copied 16 times.

BARTO is particularly effective when fine-tuned for long-range summarization and question answering.

## Intended uses & limitations

You can use the raw model for text infilling. However, the model is mainly meant to be fine-tuned on a supervised dataset.

This model does not have a slow tokenizer (LEDTokenizer).

### How to use

Here is how to use this model in PyTorch:

```python
from transformers import AutoTokenizer, AutoModel

tokenizer = AutoTokenizer.from_pretrained('vgaraujov/led-base-16384-spanish')
model = AutoModel.from_pretrained('vgaraujov/led-base-16384-spanish')

inputs = tokenizer("Hola amigo, bienvenido a casa.", return_tensors="pt")
outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state
```

### Citation (BibTeX)

```bibtex
@misc{araujo2023sequencetosequence,
      title={Sequence-to-Sequence Spanish Pre-trained Language Models}, 
      author={Vladimir Araujo and Maria Mihaela Trusca and Rodrigo Tufiño and Marie-Francine Moens},
      year={2023},
      eprint={2309.11259},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}
```
{"language": ["es"], "license": "apache-2.0", "tags": ["text-generation-inference"], "datasets": ["large_spanish_corpus", "bertin-project/mc4-es-sampled", "oscar-corpus/OSCAR-2109"], "base_model": "vgaraujov/bart-base-spanish", "widget": [{"text": "Quito es la capital de <mask>"}]}
transformers pytorch led text2text-generation text-generation-inference es dataset:large_spanish_corpus dataset:bertin-project/mc4-es-sampled dataset:oscar-corpus/OSCAR-2109 arxiv:2309.11259 base_model:vgaraujov/bart-base-spanish license:apache-2.0 autotrain_compatible endpoints_compatible region:us