Upload config
Browse files- config.json +67 -0
- configuration_bionexttager.py +32 -0
config.json
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "michiyasunaga/BioLinkBERT-large",
|
3 |
+
"architectures": [
|
4 |
+
"BioNextTaggerModel"
|
5 |
+
],
|
6 |
+
"args_random_seed": 42,
|
7 |
+
"attention_probs_dropout_prob": 0.1,
|
8 |
+
"augmentation": "unk",
|
9 |
+
"auto_map": {
|
10 |
+
"AutoConfig": "configuration_bionexttager.BioNextTaggerConfig"
|
11 |
+
},
|
12 |
+
"classifier_dropout": null,
|
13 |
+
"context_size": 2,
|
14 |
+
"crf_reduction": "mean",
|
15 |
+
"freeze": false,
|
16 |
+
"gradient_checkpointing": false,
|
17 |
+
"hidden_act": "gelu",
|
18 |
+
"hidden_dropout_prob": 0.1,
|
19 |
+
"hidden_size": 1024,
|
20 |
+
"id2label": {
|
21 |
+
"0": "O",
|
22 |
+
"1": "B-GeneOrGeneProduct",
|
23 |
+
"2": "I-GeneOrGeneProduct",
|
24 |
+
"3": "B-DiseaseOrPhenotypicFeature",
|
25 |
+
"4": "I-DiseaseOrPhenotypicFeature",
|
26 |
+
"5": "B-ChemicalEntity",
|
27 |
+
"6": "I-ChemicalEntity",
|
28 |
+
"7": "B-SequenceVariant",
|
29 |
+
"8": "I-SequenceVariant",
|
30 |
+
"9": "B-OrganismTaxon",
|
31 |
+
"10": "I-OrganismTaxon",
|
32 |
+
"11": "B-CellLine",
|
33 |
+
"12": "I-CellLine"
|
34 |
+
},
|
35 |
+
"initializer_range": 0.02,
|
36 |
+
"intermediate_size": 4096,
|
37 |
+
"label2id": {
|
38 |
+
"B-CellLine": 11,
|
39 |
+
"B-ChemicalEntity": 5,
|
40 |
+
"B-DiseaseOrPhenotypicFeature": 3,
|
41 |
+
"B-GeneOrGeneProduct": 1,
|
42 |
+
"B-OrganismTaxon": 9,
|
43 |
+
"B-SequenceVariant": 7,
|
44 |
+
"I-CellLine": 12,
|
45 |
+
"I-ChemicalEntity": 6,
|
46 |
+
"I-DiseaseOrPhenotypicFeature": 4,
|
47 |
+
"I-GeneOrGeneProduct": 2,
|
48 |
+
"I-OrganismTaxon": 10,
|
49 |
+
"I-SequenceVariant": 8,
|
50 |
+
"O": 0
|
51 |
+
},
|
52 |
+
"layer_norm_eps": 1e-12,
|
53 |
+
"max_position_embeddings": 512,
|
54 |
+
"model_type": "crf-tagger",
|
55 |
+
"model_type_arch": "dense",
|
56 |
+
"num_attention_heads": 16,
|
57 |
+
"num_hidden_layers": 24,
|
58 |
+
"p_augmentation": 0.5,
|
59 |
+
"pad_token_id": 0,
|
60 |
+
"percentage_tags": 0.75,
|
61 |
+
"position_embedding_type": "absolute",
|
62 |
+
"torch_dtype": "float32",
|
63 |
+
"transformers_version": "4.37.2",
|
64 |
+
"type_vocab_size": 2,
|
65 |
+
"use_cache": true,
|
66 |
+
"vocab_size": 28895
|
67 |
+
}
|
configuration_bionexttager.py
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
from transformers import PretrainedConfig, AutoConfig
|
3 |
+
from typing import List
|
4 |
+
|
5 |
+
|
6 |
+
class BioNextTaggerConfig(PretrainedConfig):
|
7 |
+
model_type = "crf-tagger"
|
8 |
+
|
9 |
+
def __init__(
|
10 |
+
self,
|
11 |
+
augmentation = "unk",
|
12 |
+
context_size = 64,
|
13 |
+
percentage_tags = 0.2,
|
14 |
+
p_augmentation = 0.5,
|
15 |
+
crf_reduction = "mean",
|
16 |
+
**kwargs,
|
17 |
+
):
|
18 |
+
self.augmentation = augmentation
|
19 |
+
self.context_size = context_size
|
20 |
+
self.percentage_tags = percentage_tags
|
21 |
+
self.p_augmentation = p_augmentation
|
22 |
+
self.crf_reduction = crf_reduction
|
23 |
+
super().__init__(**kwargs)
|
24 |
+
|
25 |
+
def get_backbonemodel_config(self):
|
26 |
+
backbonemodel_cfg = AutoConfig.from_pretrained(self._name_or_path)#.to_dict()
|
27 |
+
for k in backbonemodel_cfg.to_dict():
|
28 |
+
if hasattr(self, k):
|
29 |
+
setattr(backbonemodel_cfg,k, getattr(self,k))
|
30 |
+
|
31 |
+
return backbonemodel_cfg
|
32 |
+
|