File size: 930 Bytes
93ddbd3
28b13fc
 
1c5d410
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from .rad_dino           import BioViLTEncoder
from .projection         import MLPProjection
from .chexpert_classifier import CheXpertClassifier


def __getattr__(name):
    """Lazy-load CXRVisionLanguageModel only when accessed (PEP 562).

    Importing the full VLM eagerly pulls in `peft` (and indirectly its
    dependencies). Sibling imports like `from model.rad_dino import ...`
    must NOT need peft — they're used by the builders / precompute scripts
    that have no LLM. Keeping CXRVisionLanguageModel as a lazy attribute
    preserves `from model import CXRVisionLanguageModel` (train.py /
    evaluate.py / inference.py) while letting peft-free callers import
    sibling modules with no heavy dependency.
    """
    if name == "CXRVisionLanguageModel":
        from .cxr_vlm import CXRVisionLanguageModel
        return CXRVisionLanguageModel
    raise AttributeError(f"module 'model' has no attribute {name!r}")