Downloads · 30 days
18
1% of all-time downloads
nlp-guild/bert-base-chinese-finetuned-intent_recognition-biomedical
bert-base-chinese-finetuned-intent_recognition-biomedical is a text classification model from nlp-guild. Use it when you need a label for a piece of text. It is set up for transformers.
fine-tuned bert-base-chinese for intent recognition task on dataset
Downloads · 30 days
18
1% of all-time downloads
All-time downloads
2K
Public
Repo size
818 MB
Likes
5
Public
Click a slice to open those files.
.bin409 MB · 100%
From the Hugging Face model README
fine-tuned bert-base-chinese for intent recognition task on dataset
from transformers import AutoTokenizer, AutoModelForSequenceClassification
from transformers import TextClassificationPipeline
tokenizer = AutoTokenizer.from_pretrained("nlp-guild/bert-base-chinese-finetuned-intent_recognition-biomedical")
model = AutoModelForSequenceClassification.from_pretrained("nlp-guild/bert-base-chinese-finetuned-intent_recognition-biomedical")
nlp = TextClassificationPipeline(model = model, tokenizer = tokenizer)
label_set = [
'定义',
'病因',
'预防',
'临床表现(病症表现)',
'相关病症',
'治疗方法',
'所属科室',
'传染性',
'治愈率',
'禁忌',
'化验/体检方案',
'治疗时间',
'其他'
]
def readable_results(top_k:int, usr_query:str):
raw = nlp(usr_query, top_k = top_k)
def f(x):
index = int(x['label'][6:])
x['label'] = label_set[index]
for i in raw:
f(i)
return raw
readable_results(3,'得了心脏病怎么办')
'''
[{'label': '治疗方法', 'score': 0.9994503855705261},
{'label': '其他', 'score': 0.00018375989748165011},
{'label': '临床表现(病症表现)', 'score': 0.00010841596667887643}]
'''