Views
No views yet
@InProceedings{sugimoto_nlp2023_jmedroberta,
author = "杉本海人 and 壹岐太一 and 知田悠生 and 金沢輝一 and 相澤彰子",
title = "J{M}ed{R}o{BERT}a: 日本語の医学論文にもとづいた事前学習済み言語モデルの構築と評価",
booktitle = "言語処理学会第29回年次大会",
year = "2023",
url = "https://www.anlp.jp/proceedings/annual_meeting/2023/pdf_dir/P3-1.pdf"
}@InProceedings{sugimoto_nlp2023_jmedroberta,
author = "Sugimoto, Kaito and Iki, Taichi and Chida, Yuki and Kanazawa, Teruhito and Aizawa, Akiko",
title = "J{M}ed{R}o{BERT}a: a Japanese Pre-trained Language Model on Academic Articles in Medical Sciences (in Japanese)",
booktitle = "Proceedings of the 29th Annual Meeting of the Association for Natural Language Processing",
year = "2023",
url = "https://www.anlp.jp/proceedings/annual_meeting/2023/pdf_dir/P3-1.pdf"
}1from transformers import AutoModelForMaskedLM, AutoTokenizer
2
3model = AutoModelForMaskedLM.from_pretrained("alabnii/jmedroberta-base-sentencepiece")
4model.eval()
5tokenizer = AutoTokenizer.from_pretrained("alabnii/jmedroberta-base-sentencepiece")
6
7texts = ['この患者は[MASK]と診断された。']
8inputs = tokenizer.batch_encode_plus(texts, return_tensors='pt')
9outputs = model(**inputs)
10tokenizer.convert_ids_to_tokens(outputs.logits[0][1:-1].argmax(axis=-1))
11# ['▁この', '患者は', 'AML', '▁', 'と診断された', '。']1from transformers import pipeline
2fill = pipeline("fill-mask", model="alabnii/jmedroberta-base-sentencepiece", top_k=10)
3fill("この患者は[MASK]と診断された。")
4#[{'score': 0.04239409416913986,
5# 'token': 7698,
6# 'token_str': 'AML',
7# 'sequence': 'この患者はAML と診断された。'},
8# {'score': 0.03562006726861,
9# 'token': 3298,
10# 'token_str': 'SLE',
11# 'sequence': 'この患者はSLE と診断された。'},
12# {'score': 0.025064188987016678,
13# 'token': 10303,
14# 'token_str': 'MDS',
15# 'sequence': 'この患者はMDS と診断された。'},
16# ...BertForMaskedLM class. However, we consider our model as RoBERTa for the following reasons: