🚀 NorBERT 3 xs
NorBERT 3 xs是新一代NorBERT語言模型的官方版本,該模型在論文NorBench — A Benchmark for Norwegian Language Models中有詳細描述。若想了解該模型的更多細節,請閱讀此論文。
🚀 快速開始
NorBERT 3 xs是基於挪威語的語言模型,在多種自然語言處理任務中表現出色。它提供了不同大小的版本,以滿足不同場景的需求。
✨ 主要特性
- 多版本選擇:提供了不同大小的版本,包括xs、small、base和large,可根據實際需求選擇合適的模型。
- 多種任務支持:實現了多種類,如
AutoModel
、AutoModelMaskedLM
、AutoModelForSequenceClassification
等,支持多種自然語言處理任務。
📦 相關模型鏈接
其他尺寸的NorBERT 3模型
生成式NorT5系列模型
💻 使用示例
基礎用法
import torch
from transformers import AutoTokenizer, AutoModelForMaskedLM
tokenizer = AutoTokenizer.from_pretrained("ltg/norbert3-xs")
model = AutoModelForMaskedLM.from_pretrained("ltg/norbert3-xs", trust_remote_code=True)
mask_id = tokenizer.convert_tokens_to_ids("[MASK]")
input_text = tokenizer("Nå ønsker de seg en[MASK] bolig.", return_tensors="pt")
output_p = model(**input_text)
output_text = torch.where(input_text.input_ids == mask_id, output_p.logits.argmax(-1), input_text.input_ids)
print(tokenizer.decode(output_text[0].tolist()))
此模型目前需要來自modeling_norbert.py
的自定義包裝器,因此你應該使用trust_remote_code=True
來加載模型。
支持的類
目前實現了以下類:AutoModel
、AutoModelMaskedLM
、AutoModelForSequenceClassification
、AutoModelForTokenClassification
、AutoModelForQuestionAnswering
和AutoModeltForMultipleChoice
。
📚 引用信息
@inproceedings{samuel-etal-2023-norbench,
title = "{N}or{B}ench {--} A Benchmark for {N}orwegian Language Models",
author = "Samuel, David and
Kutuzov, Andrey and
Touileb, Samia and
Velldal, Erik and
{\O}vrelid, Lilja and
R{\o}nningstad, Egil and
Sigdel, Elina and
Palatkina, Anna",
booktitle = "Proceedings of the 24th Nordic Conference on Computational Linguistics (NoDaLiDa)",
month = may,
year = "2023",
address = "T{\'o}rshavn, Faroe Islands",
publisher = "University of Tartu Library",
url = "https://aclanthology.org/2023.nodalida-1.61",
pages = "618--633",
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.",
}
📄 許可證
本項目採用apache-2.0
許可證。