ganbon/novel-bert-base-relationship
047
Novel-BERT-base-Relationship(beta version)
- This model is in beta and subject to change. This model determines the utterance response relationship in novel dialogue. This model was constructed for a [Japanese Novel Dialogue System]().
Dataset
We trained the model using 5,000 annotated samples from 8 romance genre titles and 2 mystery genre titles on the Shosetukani Naro platform.
How to use
- Install dependencies
$ pip install transformers fugashi[unidic-lite]- Inference If the output is
True, it is determined that there is a utterance response relationship, and if the output isFalse, it is determined that there is no relationship.
from transformers import AutoTokenizer, AutoModelForSequenceClassification
model_path = "ganbon/novel-bert-base-relationship"
model = AutoModelForSequenceClassification.from_pretrained(model_path, trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained(model_path)
previous_sentence_list = [["「おはよう」",
"「おはよう。元気ですか?」",
"太郎が花子を気にかける。"
"昨日体調が悪そうだったからだ。"
],
[
"「早く学校に行こうか」"
"「そうだね!」"
"そういいながら、学校に行った。",
"学校ではすでに次郎がいた。"
]]
next_sentence_list = ["「はい、元気です。お気遣いありがとう。」","「おはよう、次郎」"]
for previous, next_sentence in zip(previous_sentence_list, next_sentence_list):
previous_sentences = "[SEP]".join(previous)
outputs = model(**tokenizer(previous_sentences, next_sentence, return_tensors='pt'))
if torch.argmax(outputs["logits"]).item() == 0:
print(True)
else:
print(False)Citation
When using this model, please cite one of the following.
@article{iwamoto-2024-novel_relation-ja,
title={小説を用いた対話コーパス構築のための言語モデルによる台詞間の発話応答関係の判定手法},
author={岩本 和真 and 安藤 一秋},
journal={人工知能学会全国大会論文集},
volume={JSAI2024},
pages={2G4GS605-2G4GS605},
year={2024},
}
@inproceedings{iwamoto-2024-novel_relation,
author = "Iwamoto, Kazuma and Ando, Kazuaki",
title = "A Method for Determining Utterance-Response Relationships Between Japanese Novel Lines for Constructing a Daily Dialogue Corpus",
booktitle = "2024 16th IIAI International Congress on Advanced Applied Informatics (IIAI-AAI)",
year = 2024,
}