medcat.components.addons.relation_extraction.bert.model
Classes:
-
RelExtrBertModel–BertModel class for RelCAT
Attributes:
-
logger–
RelExtrBertModel
RelExtrBertModel(pretrained_model_name_or_path: str, relcat_config: ConfigRelCAT, model_config: RelExtrBertConfig)
Bases: RelExtrBaseModel
BertModel class for RelCAT
Class to hold the BERT model + model_config
Parameters:
-
(pretrained_model_name_or_pathstr) –path to load the model from, this can be a HF model i.e: "bert-base-uncased", if left empty, it is normally assumed that a model is loaded from 'model.dat' using the RelCAT.load() method. So if you are initializing/training a model from scratch be sure to base it on some model.
-
(relcat_configConfigRelCAT) –relcat config.
-
(model_configUnion[RelExtrBaseConfig | RelExtrBertConfig]) –HF bert config for model.
Methods:
Attributes:
-
drop_out– -
hf_model– -
model_config(RelExtrBertConfig) – -
name– -
pretrained_model_name_or_path(str) – -
relcat_config(ConfigRelCAT) –
Source code in medcat-v2/medcat/components/addons/relation_extraction/bert/model.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
drop_out
instance-attribute
drop_out = Dropout(dropout)
hf_model
instance-attribute
hf_model = BertModel(hf_model_config)
name
class-attribute
instance-attribute
name = 'bertmodel_relcat'
pretrained_model_name_or_path
instance-attribute
pretrained_model_name_or_path: str = pretrained_model_name_or_path
load_specific
classmethod
load_specific(pretrained_model_name_or_path: str, relcat_config: ConfigRelCAT, model_config: RelExtrBertConfig, **kwargs) -> RelExtrBertModel
Source code in medcat-v2/medcat/components/addons/relation_extraction/bert/model.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |