ltg/norbert3-base
7964
1---2language:3- 'no'4- nb5- nn6inference: false7tags:8- BERT9- NorBERT10- Norwegian11- encoder12license: apache-2.013---14 15# NorBERT 3 base16 17<img src="https://huggingface.co/ltg/norbert3-base/resolve/main/norbert.png" width=12.5%>18 19The official release of a new generation of NorBERT language models described in paper [**NorBench — A Benchmark for Norwegian Language Models**](https://aclanthology.org/2023.nodalida-1.61/). 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)24- [NorBERT 3 small (40M)](https://huggingface.co/ltg/norbert3-small)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 usage36 37This model currently needs a custom wrapper from `modeling_norbert.py`, you should therefore load the model with `trust_remote_code=True`.38 39```python40import torch41from transformers import AutoTokenizer, AutoModelForMaskedLM42 43tokenizer = AutoTokenizer.from_pretrained("ltg/norbert3-base")44model = AutoModelForMaskedLM.from_pretrained("ltg/norbert3-base", trust_remote_code=True)45 46mask_id = tokenizer.convert_tokens_to_ids("[MASK]")47input_text = tokenizer("Nå ønsker de seg en[MASK] bolig.", return_tensors="pt")48output_p = model(**input_text)49output_text = torch.where(input_text.input_ids == mask_id, output_p.logits.argmax(-1), input_text.input_ids)50 51# should output: '[CLS] Nå ønsker de seg en ny bolig.[SEP]'52print(tokenizer.decode(output_text[0].tolist()))53```54 55The following classes are currently implemented: `AutoModel`, `AutoModelMaskedLM`, `AutoModelForSequenceClassification`, `AutoModelForTokenClassification`, `AutoModelForQuestionAnswering` and `AutoModeltForMultipleChoice`.56 57## Cite us58 59```bibtex60@inproceedings{samuel-etal-2023-norbench,61 title = "{N}or{B}ench {--} A Benchmark for {N}orwegian Language Models",62 author = "Samuel, David and63 Kutuzov, Andrey and64 Touileb, Samia and65 Velldal, Erik and66 {\O}vrelid, Lilja and67 R{\o}nningstad, Egil and68 Sigdel, Elina and69 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```