Views
No views yet
1import torch
2from transformers import AutoTokenizer, DebertaV2ForSequenceClassification
3
4class MLayerDebertaV2ForSequenceClassification(
5 DebertaV2ForSequenceClassification
6):
7 def __init__(self, config, **kwargs):
8 super().__init__(config)
9 self.classifier = torch.nn.Sequential(
10 torch.nn.Linear(config.hidden_size, 512),
11 torch.nn.GELU(),
12 torch.nn.Linear(512, 256),
13 torch.nn.GELU(),
14 torch.nn.Dropout(0.5),
15 torch.nn.Linear(256, 2)
16 )
17
18tokenizer = AutoTokenizer.from_pretrained(
19 "OU-Advacheck/deberta-v3-base-daigenc-mgt1a"
20)
21model = MLayerDebertaV2ForSequenceClassification.from_pretrained(
22 "OU-Advacheck/deberta-v3-base-daigenc-mgt1a"
23)
24model.eval()
25
26inputs = tokenizer(
27 ['Hello, Thanks for sharing your health concern with us. I have gone through your query and here are your answers: 1. If you have regular cycles, there is no further need to use any medication to regulate cycles. 2. Establishment of regular ovulation and timing of intercourse properly is necessary. 3. If you want to conceive quickly, you have to get further evaluation and plan management. Hope this helps.',
28 'He might have small intestinal TB rather than stomach TB. Amoebas also involves small intestine/some part of large intestine. If he has taken medicines for both diseases in form of a Complete Course, he should be fine. U can go for an oral+iv contrast CT scan of him. Now, the diagnosis of a lax cardiac can be confirmed by an upper GI endoscopy with manometry (if available). Lax cardiac may cause acidity with reflux.'],
29 max_length=512,
30 truncation=True,
31 padding="max_length",
32 return_tensors="pt"
33)
34
35torch.softmax(
36 model(**inputs)[0], dim=1
37).detach().cpu()[:, 1].tolist()| Model | Main Score (F1 Macro) | Auxiliary Score (F1 Micro) |
|---|---|---|
| MTL DeBERTa-v3-base (our) | 0.8307 | 0.8311 |
| Single-task DeBERTa-v30-base | 0.7852 | 0.7891 |
| baseline | 0.7342 | 0.7343 |
0 - human, 1 - machine. Model was fine-tuned with 2 stages on a single NVIDIA RTX 3090 GPU with hyperparameters described in our paper.1@misc{gritsai2024advacheckgenaidetectiontask,
2 title={Advacheck at GenAI Detection Task 1: AI Detection Powered by Domain-Aware Multi-Tasking},
3 author={German Gritsai and Anastasia Voznyuk and Ildar Khabutdinov and Andrey Grabovoy},
4 year={2024},
5 eprint={2411.11736},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL},
8 url={https://arxiv.org/abs/2411.11736},
9}