| # Run this as a Python script in the terminal (or via Python shell) | |
| from huggingface_hub import hf_hub_download | |
| import os | |
| os.makedirs("checkpoints", exist_ok=True) | |
| model_files = [ | |
| "MedSAM2_2411.pt", | |
| "MedSAM2_US_Heart.pt", | |
| "MedSAM2_MRI_LiverLesion.pt", | |
| "MedSAM2_CTLesion.pt", | |
| "MedSAM2_latest.pt" | |
| ] | |
| for filename in model_files: | |
| hf_hub_download( | |
| repo_id="wanglab/MedSAM2", | |
| filename=filename, | |
| local_dir="checkpoints", | |
| local_dir_use_symlinks=False | |
| ) | |