medcat.utils.relation_extraction.bert.model
Module Contents
Classes
BertModel class for RelCAT |
- class medcat.utils.relation_extraction.bert.model.BertModel_RelationExtraction(pretrained_model_name_or_path, relcat_config, model_config)
Bases:
medcat.utils.relation_extraction.models.BaseModel_RelationExtractionBertModel class for RelCAT
- Parameters:
pretrained_model_name_or_path (str) –
relcat_config (medcat.config_rel_cat.ConfigRelCAT) –
model_config (medcat.utils.relation_extraction.bert.config.BertConfig_RelationExtraction) –
- name = 'bertmodel_relcat'
- log
- __init__(pretrained_model_name_or_path, relcat_config, model_config)
Class to hold the BERT model + model_config
- Parameters:
pretrained_model_name_or_path (str) – 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_config (ConfigRelCAT) – relcat config.
model_config (BertConfig_RelationExtraction) – HF bert config for model.
- classmethod load(pretrained_model_name_or_path, relcat_config, model_config, **kwargs)
Load the model from the given path
- Parameters:
pretrained_model_name_or_path (str) – path to load the model from.
relcat_config (ConfigRelCAT) – relcat config.
model_config (BaseConfig_RelationExtraction) – The model-specific config.
- Returns:
BaseModel_RelationExtraction – The loaded model.
- Return type: