Transformers
ONNX
Safetensors
swinv2_segmenter
retinal-fundus
artery-vein-segmentation
medical-imaging
ophthalmology
swinv2
custom_code
Instructions to use JonathanFhima/RLAD-SwinV2-Large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use JonathanFhima/RLAD-SwinV2-Large with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("JonathanFhima/RLAD-SwinV2-Large", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Load the model config from the single root config.yaml instead of weights/model.yaml
Browse files
infer.py
CHANGED
|
@@ -24,10 +24,10 @@ MASK_ALPHA = 0.65
|
|
| 24 |
|
| 25 |
|
| 26 |
def load_model(weights_dir, device):
|
| 27 |
-
"""Build the segmenter from
|
| 28 |
|
| 29 |
Loaded in bfloat16: that's the precision the model was trained in."""
|
| 30 |
-
model = Swinv2Segmenter(weights_dir / "
|
| 31 |
load_safetensors(model, weights_dir / "model.safetensors")
|
| 32 |
return model.to(device).to(torch.bfloat16).eval()
|
| 33 |
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
def load_model(weights_dir, device):
|
| 27 |
+
"""Build the segmenter from config.yaml (repo root) and load model.safetensors.
|
| 28 |
|
| 29 |
Loaded in bfloat16: that's the precision the model was trained in."""
|
| 30 |
+
model = Swinv2Segmenter(weights_dir.parent / "config.yaml")
|
| 31 |
load_safetensors(model, weights_dir / "model.safetensors")
|
| 32 |
return model.to(device).to(torch.bfloat16).eval()
|
| 33 |
|