MedCAT icon indicating copy to clipboard operation
MedCAT copied to clipboard

Adding functionality for offline loading

Open shubham-s-agarwal opened this issue 5 months ago • 0 comments

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=False is unadvisable, however in our scripts, we always load the model packs.

  • If saved_dir_path is provided:
    • Load BERT config from local file in the specified path.
  • If saved_dir_path is not provided:
    • Fallback to downloading config from HuggingFace.

shubham-s-agarwal avatar Jul 23 '25 14:07 shubham-s-agarwal