File size: 4,363 Bytes
da22152
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20de62e
da22152
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1ddae99
 
da22152
 
 
 
 
 
 
 
 
 
 
be797c5
da22152
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
---
language:
- en
tags:
- summarization
datasets:
- multi_news
metrics:
- rouge
model-index:
- name: ccdv/lsg-bart-base-4096-multinews
  results: []
---

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

**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)**

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

tokenizer = AutoTokenizer.from_pretrained("ccdv/lsg-bart-base-4096-multinews", trust_remote_code=True)
model = AutoModelForSeq2SeqLM.from_pretrained("ccdv/lsg-bart-base-4096-multinews", 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-4096-multinews

This model is a fine-tuned version of [ccdv/lsg-bart-base-4096](https://huggingface.co/ccdv/lsg-bart-base-4096) on the [multi_news default](https://huggingface.co/datasets/multi_news) dataset. \
It achieves the following results on the test set:

| Length | Sparse Type  | Block Size | Sparsity | Connexions | R1    | R2    | RL    | RLsum |
|:------ |:------------ |:---------- |:-------- | :--------- |:----- |:----- |:----- |:----- |
| 4096   | Local        | 256        | 0        | 768        | 47.10 | 18.94 | 25.22 | 43.13 |
| 4096   | Local        | 128        | 0        | 384        | 46.73 | 18.79 | 25.13 | 42.76 |
| 4096   | Pooling      | 128        | 4        | 644        | 46.83 | 18.87 | 25.23 | 42.86 |
| 4096   | Stride       | 128        | 4        | 644        | 46.83 | 18.68 | 24.98 | 42.88 |
| 4096   | Block Stride | 128        | 4        | 644        | 46.83 | 18.72 | 25.06 | 42.88 |
| 4096   | Norm         | 128        | 4        | 644        | 46.74 | 18.60 | 24.93 | 42.79 |
| 4096   | LSH          | 128        | 4        | 644        | 46.74 | 18.82 | 25.19 | 42.77 |

With smaller block size (lower ressources):

| Length | Sparse Type  | Block Size | Sparsity | Connexions | R1    | R2    | RL    | RLsum |
|:------ |:------------ |:---------- |:-------- | :--------- |:----- |:----- |:----- |:----- |
| 4096   | Local        | 64         | 0        | 192        | 45.61 | 17.91 | 24.54 | 41.65 |
| 4096   | Local        | 32         | 0        | 96         | 43.50 | 16.36 | 23.45 | 39.61 |
| 4096   | Pooling      | 32         | 4        | 160        | 44.77 | 17.31 | 24.16 | 40.86 |
| 4096   | Stride       | 32         | 4        | 160        | 45.29 | 17.81 | 24.45 | 41.40 |
| 4096   | Block Stride | 32         | 4        | 160        | 45.39 | 17.86 | 24.51 | 41.43 |
| 4096   | Norm         | 32         | 4        | 160        | 44.65 | 17.25 | 24.09 | 40.76 |
| 4096   | LSH          | 32         | 4        | 160        | 44.44 | 17.20 | 24.00 | 40.57 |

## 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 BART-base, 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: 12.0

### Generate hyperparameters

The following hyperparameters were used during generation:
- dataset_name: multi_news
- dataset_config_name: default
- eval_batch_size: 8
- eval_samples: 5622
- 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