Views
No views yet
google/siglip-so400m-patch14-384, fine-tuned end-to-end.1152 → 2) on top of the encoder's CLS token, with dropout before the head.siglip_loss in the state dict),
used only for an auxiliary contrastive image-text alignment loss during training.
It is not used at inference time — forward() only calls image_encoder and cls_head.| File | Purpose |
|---|---|
best_model.pt | Full training checkpoint (classifier weights + auxiliary branch + optimizer/scheduler state). |
modeling.py, alignment.py, embedder.py | Model definition matching the checkpoint exactly. |
infer.py | Quick-start CLI: run the classifier on one or more images. |
demo_app.py | Local interactive Gradio demo (image upload → prediction). |
train.py | Trainer script reproducing the paper's training procedure. |
training_config.json | Exact hyperparameters used for this checkpoint. |
requirements.txt, requirements-train.txt, requirements-demo.txt | Pinned dependency versions for infer.py, train.py, and demo_app.py respectively. |
1pip install huggingface_hub
2huggingface-cli download kavin-aravindhan/vit-oct-wamd infer.py requirements.txt --local-dir .
3pip install -r requirements.txt
4python infer.py path/to/scan.pngrequirements.txt pins torch/transformers/huggingface_hub to the exact
versions used to produce best_model.pt — an unpinned pip install transformers can resolve to a version whose SiglipVisionModel uses
different internal parameter names, which will fail to load this
checkpoint's state dict.path/to/scan.png: wet_amd (confidence=0.513)1from huggingface_hub import hf_hub_download
2import sys, os, torch
3
4repo_id = "kavin-aravindhan/vit-oct-wamd"
5local_dir = os.path.dirname(hf_hub_download(repo_id=repo_id, filename="modeling.py"))
6for f in ["alignment.py", "embedder.py", "best_model.pt"]:
7 hf_hub_download(repo_id=repo_id, filename=f, local_dir=local_dir)
8
9sys.path.insert(0, local_dir)
10from modeling import load_model, IMAGE_SIZE
11
12model = load_model(os.path.join(local_dir, "best_model.pt"), device="cuda") # or "cpu"infer.py for the exact image preprocessing (resize to 384×384, normalize to [-1, 1]).1pip install huggingface_hub
2huggingface-cli download kavin-aravindhan/vit-oct-wamd demo_app.py requirements-demo.txt --local-dir .
3pip install -r requirements-demo.txt
4python demo_app.pyrequirements-demo.txt pins a specific gradio + transformers +
huggingface_hub + pydantic/starlette/fastapi combination verified to work
together end-to-end — gradio's latest releases require huggingface_hub>=1.0,
which conflicts with the transformers==4.53.0 needed to load the
checkpoint, and an unpinned newer pydantic/starlette paired with older
gradio breaks page rendering outright.train.py is a cleaned-up, parameterized version of the exact script used
to train this checkpoint — same architecture, loss, hyperparameters (500-trial
Optuna search, see training_config.json), and augmentation recipe.1pip install -r requirements-train.txt
2python train.py --tfrecord-path /path/to/.tfrecord --output-dir ./runs/my_run| Hyperparameter | Value |
|---|---|
| Image encoder | google/siglip-so400m-patch14-384 |
| Text encoder (auxiliary branch) | google-t5/t5-base |
| Batch size | 8 |
| Learning rate | 1e-4 |
| Weight decay | 1.6e-6 |
| Alpha (loss mixing, cls vs. alignment) | 0.884 |
| Dropout | 0.057 |
| Epochs | 50 (early stopping patience 20) |