MedCAT
MedCAT copied to clipboard
Adding functionality for offline loading
This change modifies the BERT model loading logic to support offline initialization from local files only, removing any dependency on online resources.
New behavior:
- If
load_bert_pretrained_weights=True: load pretrained BERT weights (requires internet access). - If
load_bert_pretrained_weights=False: initialize BERT with random weights
Note: we always recommend loading the model weights from the provided model packs. In case user does not want to load the model pack, then using
load_bert_pretrained_weights=Falseis unadvisable, however in our scripts, we always load the model packs.
- If
saved_dir_pathis provided:- Load BERT config from local file in the specified path.
- If
saved_dir_pathis not provided:- Fallback to downloading config from HuggingFace.