
<!-- 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. -->

**Transformers >= 4.36.1**\
**This model relies on a custom modeling file, you need to add trust_remote_code=True**\
**See [\#13467](https://github.com/huggingface/transformers/pull/13467)**

LSG ArXiv [paper](https://arxiv.org/abs/2210.15497). \
Github/conversion script is available at this [link](https://github.com/ccdv-ai/convert_checkpoint_to_lsg).

```python
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline

tokenizer = AutoTokenizer.from_pretrained("ccdv/lsg-bart-base-16384-arxiv", trust_remote_code=True)
model = AutoModelForSeq2SeqLM.from_pretrained("ccdv/lsg-bart-base-16384-arxiv", trust_remote_code=True)

text = "Replace by what you want."
pipe = pipeline("text2text-generation", model=model, tokenizer=tokenizer, device=0)
generated_text = pipe(
  text, 
  truncation=True, 
  max_length=64, 
  no_repeat_ngram_size=7,
  num_beams=2,
  early_stopping=True
  )
```

# ccdv/lsg-bart-base-16384-arxiv

This model is a fine-tuned version of [ccdv/lsg-bart-base-4096-arxiv](https://huggingface.co/ccdv/lsg-bart-base-4096-arxiv) on the [scientific_papers arxiv](https://huggingface.co/datasets/scientific_papers) dataset. \
The model is converted to handle 16384 long sequences and fine-tuned accordingly during 1 epoch. \
It achieves the following results on the test set:

| Length | Global tokens | Fine-tuning | Block Size | Sparsity | Connexions | R1    | R2    | RL    | RLsum |
|:------ |:------------- |:----------- |:---------- |:-------- | :--------- |:----- |:----- |:----- |:----- |
| 16384  | 64            | Full        | 256        | 0        | 768        | 48.74 | 20.88 | 28.50 | 44.23 |
| 16384  | 1             | Full        | 256        | 0        | 768        | 48.66 | 20.92 | 28.50 | 44.18 |
| 16384  | 64            | Global only | 256        | 0        | 768        | 48.08 | 20.42 | 28.00 | 43.65 |
| 16384  | 1             | None        | 256        | 0        | 768        | 47.03 | 20.19 | 28.26 | 42.69 |

Reference model:

| Length | Global tokens | Fine-tuning | Block Size | Sparsity | Connexions | R1    | R2    | RL    | RLsum |
|:------ |:------------- |:----------- |:---------- |:-------- | :--------- |:----- |:----- |:----- |:----- |
| 4096   | 1             | -           | 256        | 0        | 768        | 46.65 | 18.91 | 26.90 | 42.18 |

## Model description
The model relies on Local-Sparse-Global attention to handle long sequences:
![attn](attn.png)

The model has about ~145 millions parameters (6 encoder layers - 6 decoder layers). \
The model is warm started from [ccdv/lsg-bart-base-4096-arxiv](https://huggingface.co/ccdv/lsg-bart-base-4096-arxiv), converted to handle long sequences (encoder only) and fine tuned.

## Intended uses & limitations

More information needed

## Training and evaluation data

More information needed

## Training procedure

### Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 8e-05
- train_batch_size: 8
- seed: 42
- gradient_accumulation_steps: 4
- total_train_batch_size: 32
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- lr_scheduler_warmup_ratio: 0.1
- num_epochs: 1.0

### Generate hyperparameters

The following hyperparameters were used during generation:
- dataset_name: scientific_papers
- dataset_config_name: arxiv
- eval_batch_size: 4
- eval_samples: 6440
- early_stopping: True
- ignore_pad_token_for_loss: True
- length_penalty: 2.0
- max_length: 320
- min_length: 32
- num_beams: 5
- no_repeat_ngram_size: None
- seed: 123

### Framework versions

- Transformers 4.18.0
- Pytorch 1.10.1+cu102
- Datasets 2.1.0
- Tokenizers 0.11.6

{"language": ["en"], "tags": ["summarization"], "datasets": ["scientific_papers"], "metrics": ["rouge"], "model-index": [{"name": "ccdv/lsg-bart-base-16384-arxiv", "results": []}]}
transformers pytorch bart text2text-generation summarization custom_code en dataset:scientific_papers arxiv:2210.15497 autotrain_compatible region:us
TAGS
#transformers #pytorch #bart #text2text-generation #summarization #custom_code #en #dataset-scientific_papers #arxiv-2210.15497 #autotrain_compatible #region-us 

Transformers >= 4.36.1  

This model relies on a custom modeling file, you need to add trust\_remote\_code=True  

See #13467


LSG ArXiv paper.   

Github/conversion script is available at this link.


ccdv/lsg-bart-base-16384-arxiv
==============================


This model is a fine-tuned version of ccdv/lsg-bart-base-4096-arxiv on the scientific\_papers arxiv dataset.   

The model is converted to handle 16384 long sequences and fine-tuned accordingly during 1 epoch.   

It achieves the following results on the test set:



Reference model:



Model description
-----------------


The model relies on Local-Sparse-Global attention to handle long sequences:
!attn


The model has about ~145 millions parameters (6 encoder layers - 6 decoder layers).   

The model is warm started from ccdv/lsg-bart-base-4096-arxiv, converted to handle long sequences (encoder only) and fine tuned.


Intended uses & limitations
---------------------------


More information needed


Training and evaluation data
----------------------------


More information needed


Training procedure
------------------


### Training hyperparameters


The following hyperparameters were used during training:


* learning\_rate: 8e-05
* train\_batch\_size: 8
* seed: 42
* gradient\_accumulation\_steps: 4
* total\_train\_batch\_size: 32
* optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
* lr\_scheduler\_type: linear
* lr\_scheduler\_warmup\_ratio: 0.1
* num\_epochs: 1.0


### Generate hyperparameters


The following hyperparameters were used during generation:


* dataset\_name: scientific\_papers
* dataset\_config\_name: arxiv
* eval\_batch\_size: 4
* eval\_samples: 6440
* early\_stopping: True
* ignore\_pad\_token\_for\_loss: True
* length\_penalty: 2.0
* max\_length: 320
* min\_length: 32
* num\_beams: 5
* no\_repeat\_ngram\_size: None
* seed: 123


### Framework versions


* Transformers 4.18.0
* Pytorch 1.10.1+cu102
* Datasets 2.1.0
* Tokenizers 0.11.6



### Training hyperparameters


The following hyperparameters were used during training:


* learning\_rate: 8e-05
* train\_batch\_size: 8
* seed: 42
* gradient\_accumulation\_steps: 4
* total\_train\_batch\_size: 32
* optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
* lr\_scheduler\_type: linear
* lr\_scheduler\_warmup\_ratio: 0.1
* num\_epochs: 1.0 ### Generate hyperparameters


The following hyperparameters were used during generation:


* dataset\_name: scientific\_papers
* dataset\_config\_name: arxiv
* eval\_batch\_size: 4
* eval\_samples: 6440
* early\_stopping: True
* ignore\_pad\_token\_for\_loss: True
* length\_penalty: 2.0
* max\_length: 320
* min\_length: 32
* num\_beams: 5
* no\_repeat\_ngram\_size: None
* seed: 123 ### Framework versions


* Transformers 4.18.0
* Pytorch 1.10.1+cu102
* Datasets 2.1.0
* Tokenizers 0.11.6
TAGS
#transformers #pytorch #bart #text2text-generation #summarization #custom_code #en #dataset-scientific_papers #arxiv-2210.15497 #autotrain_compatible #region-us 
 ### Training hyperparameters


The following hyperparameters were used during training:


* learning\_rate: 8e-05
* train\_batch\_size: 8
* seed: 42
* gradient\_accumulation\_steps: 4
* total\_train\_batch\_size: 32
* optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
* lr\_scheduler\_type: linear
* lr\_scheduler\_warmup\_ratio: 0.1
* num\_epochs: 1.0 ### Generate hyperparameters


The following hyperparameters were used during generation:


* dataset\_name: scientific\_papers
* dataset\_config\_name: arxiv
* eval\_batch\_size: 4
* eval\_samples: 6440
* early\_stopping: True
* ignore\_pad\_token\_for\_loss: True
* length\_penalty: 2.0
* max\_length: 320
* min\_length: 32
* num\_beams: 5
* no\_repeat\_ngram\_size: None
* seed: 123 ### Framework versions


* Transformers 4.18.0
* Pytorch 1.10.1+cu102
* Datasets 2.1.0
* Tokenizers 0.11.6
TAGS
#transformers #pytorch #bart #text2text-generation #summarization #custom_code #en #dataset-scientific_papers #arxiv-2210.15497 #autotrain_compatible #region-us 
### Training hyperparameters


The following hyperparameters were used during training:


* learning\_rate: 8e-05
* train\_batch\_size: 8
* seed: 42
* gradient\_accumulation\_steps: 4
* total\_train\_batch\_size: 32
* optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
* lr\_scheduler\_type: linear
* lr\_scheduler\_warmup\_ratio: 0.1
* num\_epochs: 1.0### Generate hyperparameters


The following hyperparameters were used during generation:


* dataset\_name: scientific\_papers
* dataset\_config\_name: arxiv
* eval\_batch\_size: 4
* eval\_samples: 6440
* early\_stopping: True
* ignore\_pad\_token\_for\_loss: True
* length\_penalty: 2.0
* max\_length: 320
* min\_length: 32
* num\_beams: 5
* no\_repeat\_ngram\_size: None
* seed: 123### Framework versions


* Transformers 4.18.0
* Pytorch 1.10.1+cu102
* Datasets 2.1.0
* Tokenizers 0.11.6