Update README.md
Browse files
README.md
CHANGED
@@ -12,6 +12,37 @@ CT-BERT-JPN is a Japanese BERT-based model for multilabel classification of abno
|
|
12 |
|
13 |
This model is based on [BERT base Japanese v3](https://huggingface.co/tohoku-nlp/bert-base-japanese-v3), and has been fine-tuned on the [CT-RATE-JPN](https://huggingface.co/datasets/YYama0/CT-RATE-JPN) dataset, which provides Japanese translations of radiology reports from the [CT-RATE]((https://huggingface.co/datasets/ibrahimhamamci/CT-RATE)) dataset. The training data consists of deduplicated radiology reports with corresponding abnormality labels.
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
## Model Performance
|
16 |
|
17 |
Coming soon...
|
|
|
12 |
|
13 |
This model is based on [BERT base Japanese v3](https://huggingface.co/tohoku-nlp/bert-base-japanese-v3), and has been fine-tuned on the [CT-RATE-JPN](https://huggingface.co/datasets/YYama0/CT-RATE-JPN) dataset, which provides Japanese translations of radiology reports from the [CT-RATE]((https://huggingface.co/datasets/ibrahimhamamci/CT-RATE)) dataset. The training data consists of deduplicated radiology reports with corresponding abnormality labels.
|
14 |
|
15 |
+
## How to Use
|
16 |
+
|
17 |
+
```
|
18 |
+
!pip install fugashi unidic_lite
|
19 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
20 |
+
import torch
|
21 |
+
|
22 |
+
# Load the model and tokenizer from Hugging Face Hub
|
23 |
+
model_name = "YYama0/CT-BERT-JPN"
|
24 |
+
model = AutoModelForSequenceClassification.from_pretrained(
|
25 |
+
model_name,
|
26 |
+
num_labels=18,
|
27 |
+
problem_type="multi_label_classification"
|
28 |
+
)
|
29 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
30 |
+
|
31 |
+
# Define the inference function
|
32 |
+
def infer(input_texts):
|
33 |
+
inputs = tokenizer(input_texts, padding=True, truncation=True, return_tensors="pt")
|
34 |
+
model.eval()
|
35 |
+
with torch.no_grad():
|
36 |
+
outputs = model(**inputs)
|
37 |
+
logits = outputs.logits
|
38 |
+
probs = torch.sigmoid(logits)
|
39 |
+
return probs
|
40 |
+
|
41 |
+
# Run inference
|
42 |
+
input_texts = ["縦隔の構造は、未造影であったため最適とは言えません。左胸壁にはペースメーカーの電極があり、心室下壁まで延びています。気管および両主気管支の管腔は開いています。気管および両主気管支の管腔に閉塞性病変は認められませんでした。上行大動脈の直径は38mmで、わずかに拡張しています。主肺動脈の直径は38mmで、拡張が見られます。胸部大動脈および冠動脈壁には石灰化した動脈硬化症の変化が観察されました。心臓のサイズは著しく増大しています。縦隔および両側肺門部に病理的サイズおよび外観のリンパ節は認められませんでした。肺野条件で検査したところ、両肺に軽度の気腫性変化が見られました。両側気管支周囲の肥厚が認められました。両側胸膜葉の間には、右側で17mm、左側で13mmのわずかな胸水が認められ、右葉間裂まで及んでいます。撮影範囲の上腹部では、肝臓の輪郭が不規則です。肝実質疾患の評価を推奨します。腹部大動脈の直径は32mmで、紡錘状に拡張しています。腹部大動脈の壁には石灰化した動脈硬化症の変化が見られました。骨構造には変性変化が観察されました。溶解性の破壊病変は認められませんでした。"]
|
43 |
+
probs = infer(input_texts)
|
44 |
+
```
|
45 |
+
|
46 |
## Model Performance
|
47 |
|
48 |
Coming soon...
|