Feat: add editor server backend

This commit is contained in:
litagin02
2024-02-23 13:21:14 +09:00
parent de539e74f9
commit e16cdad6e9
10 changed files with 423 additions and 54 deletions

View File

@@ -4,7 +4,7 @@ import torch
from transformers import AutoModelForMaskedLM, AutoTokenizer
from config import config
from text.japanese import text2sep_kata
from text.japanese import text2sep_kata, text_normalize
LOCAL_PATH = "./bert/deberta-v2-large-japanese-char-wwm"
@@ -19,8 +19,10 @@ def get_bert_feature(
device=config.bert_gen_config.device,
assist_text=None,
assist_text_weight=0.7,
ignore_unknown=False,
):
text = "".join(text2sep_kata(text)[0])
text = "".join(text2sep_kata(text, ignore_unknown=ignore_unknown)[0])
# text = text_normalize(text)
if assist_text:
assist_text = "".join(text2sep_kata(assist_text)[0])
if (