File size: 1,521 Bytes
1beb628 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
---
license: afl-3.0
language:
- ja
library_name: transformers
pipeline_tag: text-classification
---
# SMM4H-2024 Task 2 Japanese RE
## Overview
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.
Tag set:
* CAUSED
* TREATMENT_FOR
## Usage
```python
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch
text = "サンプルテキスト"
model_name = "yseop/SMM4H2024_Task2b_ja"
id2label = ['O', 'CAUSED', 'TREATMENT_FOR']
with torch.inference_mode():
model = AutoModelForSequenceClassification.from_pretrained(model_name).eval()
tokenizer = AutoTokenizer.from_pretrained(model_name)
encoded_input = tokenizer(text, return_tensors='pt', max_length=512)
output = re_model(**encoded_input).logits
class_id = output.argmax().item()
print(id2label[class_id])
```
## Results
|Relation|tp|fp|fn|precision|recall|f1|
|---|---:|---:|---:|---:|---:|---:|
|CAUSED\|DISORDER\|DISORDER|1|163|38|0.0061|0.0256|0.0099|
|CAUSED\|DISORDER\|FUNCTION|0|70|13|0|0|0|
|CAUSED\|DRUG\|DISORDER|9|196|105|0.0439|0.0789|0.0564|
|CAUSED\|DRUG\|FUNCTION|2|59|7|0.0328|0.2222|0.0571|
|TREATMENT_FOR\|DISORDER\|DISORDER|0|12|0|0|0|0|
|TREATMENT_FOR\|DISORDER\|FUNCTION|0|3|0|0|0|0|
|TREATMENT_FOR\|DRUG\|DISORDER|0|15|91|0|0|0|
|TREATMENT_FOR\|DRUG\|FUNCTION|0|0|1|0|0|0|
|all|12|518|255|0.0226|0.0449|0.0301| |