Views
No views yet
modeling_ltgbert.py, you should therefore load the model with trust_remote_code=True.1import torch
2from transformers import AutoTokenizer, AutoModelForMaskedLM
3
4tokenizer = AutoTokenizer.from_pretrained("HPLT/hplt_bert_base_sw")
5model = AutoModelForMaskedLM.from_pretrained("HPLT/hplt_bert_base_sw", trust_remote_code=True)
6
7mask_id = tokenizer.convert_tokens_to_ids("[MASK]")
8input_text = tokenizer("It's a beautiful[MASK].", return_tensors="pt")
9output_p = model(**input_text)
10output_text = torch.where(input_text.input_ids == mask_id, output_p.logits.argmax(-1), input_text.input_ids)
11
12# should output: '[CLS] It's a beautiful place.[SEP]'
13print(tokenizer.decode(output_text[0].tolist()))AutoModel, AutoModelMaskedLM, AutoModelForSequenceClassification, AutoModelForTokenClassification, AutoModelForQuestionAnswering and AutoModeltForMultipleChoice.stepXXX: for example, step18750.transformers using the argument revision:model = AutoModelForMaskedLM.from_pretrained("HPLT/hplt_bert_base_sw", revision="step21875", trust_remote_code=True)1from huggingface_hub import list_repo_refs
2out = list_repo_refs("HPLT/hplt_bert_base_sw")
3print([b.name for b in out.branches])1@inproceedings{samuel-etal-2023-trained,
2 title = "Trained on 100 million words and still in shape: {BERT} meets {B}ritish {N}ational {C}orpus",
3 author = "Samuel, David and
4 Kutuzov, Andrey and
5 {\O}vrelid, Lilja and
6 Velldal, Erik",
7 editor = "Vlachos, Andreas and
8 Augenstein, Isabelle",
9 booktitle = "Findings of the Association for Computational Linguistics: EACL 2023",
10 month = may,
11 year = "2023",
12 address = "Dubrovnik, Croatia",
13 publisher = "Association for Computational Linguistics",
14 url = "https://aclanthology.org/2023.findings-eacl.146",
15 doi = "10.18653/v1/2023.findings-eacl.146",
16 pages = "1954--1974"
17})1@inproceedings{de-gibert-etal-2024-new-massive,
2 title = "A New Massive Multilingual Dataset for High-Performance Language Technologies",
3 author = {de Gibert, Ona and
4 Nail, Graeme and
5 Arefyev, Nikolay and
6 Ba{\~n}{\'o}n, Marta and
7 van der Linde, Jelmer and
8 Ji, Shaoxiong and
9 Zaragoza-Bernabeu, Jaume and
10 Aulamo, Mikko and
11 Ram{\'\i}rez-S{\'a}nchez, Gema and
12 Kutuzov, Andrey and
13 Pyysalo, Sampo and
14 Oepen, Stephan and
15 Tiedemann, J{\"o}rg},
16 editor = "Calzolari, Nicoletta and
17 Kan, Min-Yen and
18 Hoste, Veronique and
19 Lenci, Alessandro and
20 Sakti, Sakriani and
21 Xue, Nianwen",
22 booktitle = "Proceedings of the 2024 Joint International Conference on Computational Linguistics, Language Resources and Evaluation (LREC-COLING 2024)",
23 month = may,
24 year = "2024",
25 address = "Torino, Italia",
26 publisher = "ELRA and ICCL",
27 url = "https://aclanthology.org/2024.lrec-main.100",
28 pages = "1116--1128",
29 abstract = "We present the HPLT (High Performance Language Technologies) language resources, a new massive multilingual dataset including both monolingual and bilingual corpora extracted from CommonCrawl and previously unused web crawls from the Internet Archive. We describe our methods for data acquisition, management and processing of large corpora, which rely on open-source software tools and high-performance computing. Our monolingual collection focuses on low- to medium-resourced languages and covers 75 languages and a total of {\mbox{$\approx$}} 5.6 trillion word tokens de-duplicated on the document level. Our English-centric parallel corpus is derived from its monolingual counterpart and covers 18 language pairs and more than 96 million aligned sentence pairs with roughly 1.4 billion English tokens. The HPLT language resources are one of the largest open text corpora ever released, providing a great resource for language modeling and machine translation training. We publicly release the corpora, the software, and the tools used in this work.",
30}