| 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}") |
|
|