init: model card
Browse files
README.md
CHANGED
@@ -1,3 +1,49 @@
|
|
1 |
-
---
|
2 |
-
license: afl-3.0
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: afl-3.0
|
3 |
+
language:
|
4 |
+
- ja
|
5 |
+
library_name: transformers
|
6 |
+
pipeline_tag: text-classification
|
7 |
+
---
|
8 |
+
# SMM4H-2024 Task 2 Japanese RE
|
9 |
+
|
10 |
+
## Overview
|
11 |
+
|
12 |
+
This is a relation extraction model created by fine-tuning [daisaku-s/medtxt_ner_roberta](https://huggingface.co/daisaku-s/medtxt_ner_roberta) on [SMM4H 2024 Task 2b](https://healthlanguageprocessing.org/smm4h-2024/) corpus.
|
13 |
+
|
14 |
+
Tag set:
|
15 |
+
* CAUSED
|
16 |
+
* TREATMENT_FOR
|
17 |
+
|
18 |
+
## Usage
|
19 |
+
|
20 |
+
```python
|
21 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
22 |
+
import torch
|
23 |
+
|
24 |
+
text = "サンプルテキスト"
|
25 |
+
model_name = "yseop/SMM4H2024_Task2b_ja"
|
26 |
+
id2label = ['O', 'CAUSED', 'TREATMENT_FOR']
|
27 |
+
|
28 |
+
with torch.inference_mode():
|
29 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name).eval()
|
30 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
31 |
+
encoded_input = tokenizer(text, return_tensors='pt', max_length=512)
|
32 |
+
output = re_model(**encoded_input).logits
|
33 |
+
class_id = output.argmax().item()
|
34 |
+
print(id2label[class_id])
|
35 |
+
```
|
36 |
+
|
37 |
+
## Results
|
38 |
+
|
39 |
+
|Relation|tp|fp|fn|precision|recall|f1|
|
40 |
+
|---|---:|---:|---:|---:|---:|---:|
|
41 |
+
|CAUSED\|DISORDER\|DISORDER|1|163|38|0.0061|0.0256|0.0099|
|
42 |
+
|CAUSED\|DISORDER\|FUNCTION|0|70|13|0|0|0|
|
43 |
+
|CAUSED\|DRUG\|DISORDER|9|196|105|0.0439|0.0789|0.0564|
|
44 |
+
|CAUSED\|DRUG\|FUNCTION|2|59|7|0.0328|0.2222|0.0571|
|
45 |
+
|TREATMENT_FOR\|DISORDER\|DISORDER|0|12|0|0|0|0|
|
46 |
+
|TREATMENT_FOR\|DISORDER\|FUNCTION|0|3|0|0|0|0|
|
47 |
+
|TREATMENT_FOR\|DRUG\|DISORDER|0|15|91|0|0|0|
|
48 |
+
|TREATMENT_FOR\|DRUG\|FUNCTION|0|0|1|0|0|0|
|
49 |
+
|all|12|518|255|0.0226|0.0449|0.0301|
|