Update README.md
Browse files
README.md
CHANGED
|
@@ -14,6 +14,10 @@ license: cc-by-4.0
|
|
| 14 |
|
| 15 |
# NorBERT 3 xs
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
## Other sizes:
|
| 19 |
- [NorBERT 3 xs (15M)](https://huggingface.co/ltg/norbert3-xs)
|
|
@@ -21,18 +25,23 @@ license: cc-by-4.0
|
|
| 21 |
- [NorBERT 3 base (123M)](https://huggingface.co/ltg/norbert3-base)
|
| 22 |
- [NorBERT 3 large (323M)](https://huggingface.co/ltg/norbert3-large)
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
## Example usage
|
| 26 |
|
| 27 |
-
This model currently needs a custom wrapper from `modeling_norbert.py
|
| 28 |
|
| 29 |
```python
|
| 30 |
import torch
|
| 31 |
-
from transformers import AutoTokenizer
|
| 32 |
-
from modeling_norbert import NorbertForMaskedLM
|
| 33 |
|
| 34 |
-
tokenizer = AutoTokenizer.from_pretrained("
|
| 35 |
-
|
| 36 |
|
| 37 |
mask_id = tokenizer.convert_tokens_to_ids("[MASK]")
|
| 38 |
input_text = tokenizer("Nå ønsker de seg en[MASK] bolig.", return_tensors="pt")
|
|
@@ -43,4 +52,29 @@ output_text = torch.where(input_text.input_ids == mask_id, output_p.logits.argma
|
|
| 43 |
print(tokenizer.decode(output_text[0].tolist()))
|
| 44 |
```
|
| 45 |
|
| 46 |
-
The following classes are currently implemented: `
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
# NorBERT 3 xs
|
| 16 |
|
| 17 |
+
<img src="https://huggingface.co/ltg/norbert3-base/resolve/main/norbert.png" width=12.5%>
|
| 18 |
+
|
| 19 |
+
The official release of a new generation of NorBERT language models described in paper [**NorBench — A Benchmark for Norwegian Language Models**](https://arxiv.org/abs/2305.03880). Plese read the paper to learn more details about the model.
|
| 20 |
+
|
| 21 |
|
| 22 |
## Other sizes:
|
| 23 |
- [NorBERT 3 xs (15M)](https://huggingface.co/ltg/norbert3-xs)
|
|
|
|
| 25 |
- [NorBERT 3 base (123M)](https://huggingface.co/ltg/norbert3-base)
|
| 26 |
- [NorBERT 3 large (323M)](https://huggingface.co/ltg/norbert3-large)
|
| 27 |
|
| 28 |
+
## Generative NorT5 siblings:
|
| 29 |
+
- [NorT5 xs (32M)](https://huggingface.co/ltg/nort5-xs)
|
| 30 |
+
- [NorT5 small (88M)](https://huggingface.co/ltg/nort5-small)
|
| 31 |
+
- [NorT5 base (228M)](https://huggingface.co/ltg/nort5-base)
|
| 32 |
+
- [NorT5 large (808M)](https://huggingface.co/ltg/nort5-large)
|
| 33 |
+
|
| 34 |
|
| 35 |
## Example usage
|
| 36 |
|
| 37 |
+
This model currently needs a custom wrapper from `modeling_norbert.py`, you should therefore load the model with `trust_remote_code=True`.
|
| 38 |
|
| 39 |
```python
|
| 40 |
import torch
|
| 41 |
+
from transformers import AutoTokenizer, AutoModelForMaskedLM
|
|
|
|
| 42 |
|
| 43 |
+
tokenizer = AutoTokenizer.from_pretrained("ltg/norbert3-xs")
|
| 44 |
+
model = AutoModelForMaskedLM.from_pretrained("ltg/norbert3-xs", trust_remote_code=True)
|
| 45 |
|
| 46 |
mask_id = tokenizer.convert_tokens_to_ids("[MASK]")
|
| 47 |
input_text = tokenizer("Nå ønsker de seg en[MASK] bolig.", return_tensors="pt")
|
|
|
|
| 52 |
print(tokenizer.decode(output_text[0].tolist()))
|
| 53 |
```
|
| 54 |
|
| 55 |
+
The following classes are currently implemented: `AutoModel`, `AutoModelMaskedLM`, `AutoModelForSequenceClassification`, `AutoModelForTokenClassification`, `AutoModelForQuestionAnswering` and `AutoModeltForMultipleChoice`.
|
| 56 |
+
|
| 57 |
+
## Cite us
|
| 58 |
+
|
| 59 |
+
```bibtex
|
| 60 |
+
@inproceedings{samuel-etal-2023-norbench,
|
| 61 |
+
title = "{N}or{B}ench {--} A Benchmark for {N}orwegian Language Models",
|
| 62 |
+
author = "Samuel, David and
|
| 63 |
+
Kutuzov, Andrey and
|
| 64 |
+
Touileb, Samia and
|
| 65 |
+
Velldal, Erik and
|
| 66 |
+
{\O}vrelid, Lilja and
|
| 67 |
+
R{\o}nningstad, Egil and
|
| 68 |
+
Sigdel, Elina and
|
| 69 |
+
Palatkina, Anna",
|
| 70 |
+
booktitle = "Proceedings of the 24th Nordic Conference on Computational Linguistics (NoDaLiDa)",
|
| 71 |
+
month = may,
|
| 72 |
+
year = "2023",
|
| 73 |
+
address = "T{\'o}rshavn, Faroe Islands",
|
| 74 |
+
publisher = "University of Tartu Library",
|
| 75 |
+
url = "https://aclanthology.org/2023.nodalida-1.61",
|
| 76 |
+
pages = "618--633",
|
| 77 |
+
abstract = "We present NorBench: a streamlined suite of NLP tasks and probes for evaluating Norwegian language models (LMs) on standardized data splits and evaluation metrics. We also introduce a range of new Norwegian language models (both encoder and encoder-decoder based). Finally, we compare and analyze their performance, along with other existing LMs, across the different benchmark tests of NorBench.",
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
```
|