Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# gaBERT
|
| 2 |
+
|
| 3 |
+
[gaBERT](https://arxiv.org/abs/2107.12930) is a BERT-base model trained on 7.9M Irish sentences. For more details, including the hyperparameters and pretraining corpora used please refer to our paper.
|
| 4 |
+
|
| 5 |
+
### How to use gaBERT with HuggingFace
|
| 6 |
+
|
| 7 |
+
```
|
| 8 |
+
from transformers import AutoModelWithLMHead, AutoTokenizer
|
| 9 |
+
import torch
|
| 10 |
+
|
| 11 |
+
tokenizer = AutoTokenizer.from_pretrained("DCU-NLP/bert-base-irish-cased-v1")
|
| 12 |
+
model = AutoModelWithLMHead.from_pretrained("DCU-NLP/bert-base-irish-cased-v1")
|
| 13 |
+
|
| 14 |
+
sequence = f"Ceolt贸ir {tokenizer.mask_token} ab ea Johnny Cash."
|
| 15 |
+
|
| 16 |
+
input = tokenizer.encode(sequence, return_tensors="pt")
|
| 17 |
+
mask_token_index = torch.where(input == tokenizer.mask_token_id)[1]
|
| 18 |
+
|
| 19 |
+
token_logits = model(input)[0]
|
| 20 |
+
mask_token_logits = token_logits[0, mask_token_index, :]
|
| 21 |
+
|
| 22 |
+
top_5_tokens = torch.topk(mask_token_logits, 5, dim=1).indices[0].tolist()
|
| 23 |
+
|
| 24 |
+
for token in top_5_tokens:
|
| 25 |
+
print(sequence.replace(tokenizer.mask_token, tokenizer.decode([token])))
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
### BibTeX entry and citation info
|
| 29 |
+
|
| 30 |
+
If you use this model in your research, please consider citing our paper:
|
| 31 |
+
|
| 32 |
+
```
|
| 33 |
+
@article{DBLP:journals/corr/abs-2107-12930,
|
| 34 |
+
author = {James Barry and
|
| 35 |
+
Joachim Wagner and
|
| 36 |
+
Lauren Cassidy and
|
| 37 |
+
Alan Cowap and
|
| 38 |
+
Teresa Lynn and
|
| 39 |
+
Abigail Walsh and
|
| 40 |
+
M{\'{\i}}che{\'{a}}l J. {\'{O}} Meachair and
|
| 41 |
+
Jennifer Foster},
|
| 42 |
+
title = {gaBERT - an Irish Language Model},
|
| 43 |
+
journal = {CoRR},
|
| 44 |
+
volume = {abs/2107.12930},
|
| 45 |
+
year = {2021},
|
| 46 |
+
url = {https://arxiv.org/abs/2107.12930},
|
| 47 |
+
archivePrefix = {arXiv},
|
| 48 |
+
eprint = {2107.12930},
|
| 49 |
+
timestamp = {Fri, 30 Jul 2021 13:03:06 +0200},
|
| 50 |
+
biburl = {https://dblp.org/rec/journals/corr/abs-2107-12930.bib},
|
| 51 |
+
bibsource = {dblp computer science bibliography, https://dblp.org}
|
| 52 |
+
}
|
| 53 |
+
```
|