medcat.utils.relation_extraction.bert.model

Module Contents

Classes

BertModel_RelationExtraction

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_RelationExtraction

BertModel class for RelCAT

Parameters:
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:
Returns:

BaseModel_RelationExtraction – The loaded model.

Return type:

BertModel_RelationExtraction