Views
No views yet
| File | Description |
|---|---|
adapter_model.safetensors | LoRA weights (rank 8, Q&V of the last 6 transformer blocks) + classification head (768→512 proj, LayerNorm, 13 logits) |
adapter_config.json | LoRA hyperparameters (r=8, alpha=16, dropout=0.05) |
calibrated_thresholds.json | Per-class decision thresholds (Youden's J on validation) |
PeftModel.from_pretrained(...) will not work out of the box: the LoRA lives inside the fused qkv projection of a timm-wrapped ViT (visual.trunk), which has no stock PEFT target. You must rebuild the exact architecture before loading weights:open_clip.create_model_and_transforms('microsoft/BiomedCLIP-PubMedBERT_256-vit_base_patch16_224').clip_model.visual).blocks[6..11]). timm backend: wrap blocks[idx].attn.qkv with a module that adds low-rank adapters to the Q and V slices of the fused qkv output (K slice unchanged). LoRA math: output = frozen_linear(x) + (alpha/r) * dropout(x) @ A^T @ B^T.nn.Sequential(LayerNorm(512), Dropout(0.1), Linear(512, 13)) over the encoder output (head input here is 512 — the output of encoder.head.proj).load_state_dict the tensors in adapter_model.safetensors onto the reconstructed state dict.(0.4815, 0.4578, 0.4082) / (0.2686, 0.2613, 0.2758) (BiomedCLIP's own preprocessing stats).model.eval(), torch.no_grad().['enlarged cardiomediastinum', 'cardiomegaly', 'atelectasis', 'consolidation',
'lung edema', 'fracture', 'lung lesion', 'pleural effusion', 'pneumonia',
'pneumothorax', 'support device', 'lung opacity', 'pleural other']sigmoid (no softmax).calibrated_thresholds.json (per-class, not a flat 0.5). If you only need a score, report raw sigmoid outputs.