Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
pipeline_tag: text2text-generation
|
6 |
+
---
|
7 |
+
# MANTa-LM (small)
|
8 |
+
|
9 |
+
Pretrained MANTa-LM architecture as introduced in the paper [MANTa: Efficient Gradient-Based Tokenization for Robust End-to-End Language Modeling](https://aclanthology.org/2022.findings-emnlp.207.pdf).
|
10 |
+
<center><img src="https://github.com/NathanGodey/nathangodey.github.io/raw/main/img/posts/full_difftok_schema.png" width="600"></center>
|
11 |
+
|
12 |
+
## Model Details
|
13 |
+
|
14 |
+
### Model Description
|
15 |
+
|
16 |
+
The MANTa tokenizer aims at mimicking the combination of a subword tokenizer and an embedding matrix in a classical language model in a differentiable way.
|
17 |
+
This trainable tokenizer is thus added as the first layer of an encoder-decoder model and trained using the language modeling objective.
|
18 |
+
|
19 |
+
Our results show that MANTa-LM only slightly degrades the performance of a T5 equivalent on the GLUE benchmark while being **much more robust** to artificial and user-generated noise.
|
20 |
+
|
21 |
+
|
22 |
+
### Model Sources
|
23 |
+
|
24 |
+
- **Paper:** [MANTa: Efficient Gradient-Based Tokenization for Robust End-to-End Language Modeling](https://aclanthology.org/2022.findings-emnlp.207.pdf) (EMNLP 2022 Findings)
|
25 |
+
|
26 |
+
## Uses
|
27 |
+
|
28 |
+
### Direct Use
|
29 |
+
|
30 |
+
```python
|
31 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
32 |
+
|
33 |
+
tokenizer = AutoTokenizer.from_pretrained("google/byt5-base")
|
34 |
+
manta_model = AutoModelForSeq2SeqLM.from_pretrained("almanach/manta-lm-small", trust_remote_code=True)
|
35 |
+
|
36 |
+
tokens = tokenizer("The name of the capital of France is <extra_id_0> and it is a very big city.", return_tensors="pt")
|
37 |
+
output = manta_model.generate(**tokens, decoder_start_token_id=0)
|
38 |
+
|
39 |
+
print(tokenizer.batch_decode(output))
|
40 |
+
```
|
41 |
+
|
42 |
+
### Recommendations
|
43 |
+
|
44 |
+
We recommend using a smaller learning rate for the tokenizer module during fine-tuning (byte embeddings, frontier predictor, pooler).
|
45 |
+
|
46 |
+
|
47 |
+
## Training Details
|
48 |
+
|
49 |
+
### Training Data
|
50 |
+
|
51 |
+
This model was trained on the C4 dataset.
|
52 |
+
|
53 |
+
### Training Procedure
|
54 |
+
|
55 |
+
The training objective is the same as ByT5, but most hyperparameters are taken from T5.
|
56 |
+
|
57 |
+
|
58 |
+
## Citation
|
59 |
+
|
60 |
+
**BibTeX:**
|
61 |
+
|
62 |
+
```
|
63 |
+
@inproceedings{godey-etal-2022-manta,
|
64 |
+
title = "{MANT}a: Efficient Gradient-Based Tokenization for End-to-End Robust Language Modeling",
|
65 |
+
author = "Godey, Nathan and
|
66 |
+
Castagn{\'e}, Roman and
|
67 |
+
de la Clergerie, {\'E}ric and
|
68 |
+
Sagot, Beno{\^\i}t",
|
69 |
+
booktitle = "Findings of the Association for Computational Linguistics: EMNLP 2022",
|
70 |
+
month = dec,
|
71 |
+
year = "2022",
|
72 |
+
address = "Abu Dhabi, United Arab Emirates",
|
73 |
+
publisher = "Association for Computational Linguistics",
|
74 |
+
url = "https://aclanthology.org/2022.findings-emnlp.207",
|
75 |
+
pages = "2859--2870",
|
76 |
+
}
|
77 |
+
|
78 |
+
```
|
79 |
+
|
80 |
+
## Model Card Authors
|
81 |
+
|
82 |
+
[Nathan Godey](https://nathangodey.github.io/)
|
83 |
+
[Roman Castagné](https://romancast.github.io/)
|
84 |
+
|