Master-Shi commited on
Commit
8edefd6
·
verified ·
1 Parent(s): f2a1bb2

Add files using upload-large-folder tool

Browse files
Files changed (50) hide show
  1. benchmarks/COCO/COCO_attribute.jsonl +0 -0
  2. benchmarks/COCO/COCO_localization.jsonl +0 -0
  3. benchmarks/COCO/val2014/COCO_val2014_000000052238.jpg +3 -0
  4. benchmarks/COCO/val2014/COCO_val2014_000000058472.jpg +3 -0
  5. benchmarks/COCO/val2014/COCO_val2014_000000085160.jpg +3 -0
  6. benchmarks/COCO/val2014/COCO_val2014_000000089761.jpg +3 -0
  7. benchmarks/COCO/val2014/COCO_val2014_000000110906.jpg +3 -0
  8. benchmarks/COCO/val2014/COCO_val2014_000000115796.jpg +3 -0
  9. benchmarks/COCO/val2014/COCO_val2014_000000128262.jpg +3 -0
  10. benchmarks/COCO/val2014/COCO_val2014_000000139872.jpg +3 -0
  11. benchmarks/COCO/val2014/COCO_val2014_000000153392.jpg +3 -0
  12. benchmarks/COCO/val2014/COCO_val2014_000000155885.jpg +3 -0
  13. benchmarks/COCO/val2014/COCO_val2014_000000169849.jpg +3 -0
  14. benchmarks/COCO/val2014/COCO_val2014_000000181506.jpg +3 -0
  15. benchmarks/COCO/val2014/COCO_val2014_000000188308.jpg +3 -0
  16. benchmarks/COCO/val2014/COCO_val2014_000000205883.jpg +3 -0
  17. benchmarks/COCO/val2014/COCO_val2014_000000227224.jpg +3 -0
  18. benchmarks/COCO/val2014/COCO_val2014_000000243775.jpg +3 -0
  19. benchmarks/COCO/val2014/COCO_val2014_000000250870.jpg +3 -0
  20. benchmarks/COCO/val2014/COCO_val2014_000000275657.jpg +3 -0
  21. benchmarks/COCO/val2014/COCO_val2014_000000276458.jpg +3 -0
  22. benchmarks/COCO/val2014/COCO_val2014_000000283147.jpg +3 -0
  23. benchmarks/COCO/val2014/COCO_val2014_000000290165.jpg +3 -0
  24. benchmarks/COCO/val2014/COCO_val2014_000000308555.jpg +3 -0
  25. benchmarks/COCO/val2014/COCO_val2014_000000313130.jpg +3 -0
  26. benchmarks/COCO/val2014/COCO_val2014_000000316596.jpg +3 -0
  27. benchmarks/COCO/val2014/COCO_val2014_000000329957.jpg +3 -0
  28. benchmarks/COCO/val2014/COCO_val2014_000000330098.jpg +3 -0
  29. benchmarks/COCO/val2014/COCO_val2014_000000347648.jpg +3 -0
  30. benchmarks/COCO/val2014/COCO_val2014_000000356094.jpg +3 -0
  31. benchmarks/COCO/val2014/COCO_val2014_000000361238.jpg +3 -0
  32. benchmarks/COCO/val2014/COCO_val2014_000000369323.jpg +3 -0
  33. benchmarks/COCO/val2014/COCO_val2014_000000371529.jpg +3 -0
  34. benchmarks/COCO/val2014/COCO_val2014_000000382288.jpg +3 -0
  35. benchmarks/COCO/val2014/COCO_val2014_000000390975.jpg +3 -0
  36. benchmarks/COCO/val2014/COCO_val2014_000000428881.jpg +3 -0
  37. benchmarks/COCO/val2014/COCO_val2014_000000483553.jpg +3 -0
  38. benchmarks/COCO/val2014/COCO_val2014_000000484915.jpg +3 -0
  39. benchmarks/COCO/val2014/COCO_val2014_000000492552.jpg +3 -0
  40. benchmarks/COCO/val2014/COCO_val2014_000000493022.jpg +3 -0
  41. benchmarks/COCO/val2014/COCO_val2014_000000502844.jpg +3 -0
  42. benchmarks/COCO/val2014/COCO_val2014_000000519703.jpg +3 -0
  43. benchmarks/COCO/val2014/COCO_val2014_000000536791.jpg +3 -0
  44. benchmarks/COCO/val2014/COCO_val2014_000000550864.jpg +3 -0
  45. benchmarks/COCO/val2014/COCO_val2014_000000564851.jpg +3 -0
  46. download_data.py +113 -0
  47. download_sam3_assets.py +89 -0
  48. gpu1_hold_30g.log +2 -0
  49. predownload_models-ori.py +99 -0
  50. predownload_models.py +102 -0
benchmarks/COCO/COCO_attribute.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
benchmarks/COCO/COCO_localization.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
benchmarks/COCO/val2014/COCO_val2014_000000052238.jpg ADDED

Git LFS Details

  • SHA256: 6dbff91e90bc28e20960507c8c65b96e713f2896540e90a7c63c9c535aecbd64
  • Pointer size: 131 Bytes
  • Size of remote file: 143 kB
benchmarks/COCO/val2014/COCO_val2014_000000058472.jpg ADDED

Git LFS Details

  • SHA256: c67870ceff73a0a125aad69d1da69aa6c36e41eca0938f347560d1cd76c3c111
  • Pointer size: 130 Bytes
  • Size of remote file: 64.2 kB
benchmarks/COCO/val2014/COCO_val2014_000000085160.jpg ADDED

Git LFS Details

  • SHA256: 4a66456e7b6324e5fd6bb341943558dc57e40a13760111230421b61ceea2d9e3
  • Pointer size: 131 Bytes
  • Size of remote file: 165 kB
benchmarks/COCO/val2014/COCO_val2014_000000089761.jpg ADDED

Git LFS Details

  • SHA256: 77578f52ee4644ec8ff4d8ffd712116b2ce0a498ae7ed5bd5430dec7b784cdc5
  • Pointer size: 131 Bytes
  • Size of remote file: 189 kB
benchmarks/COCO/val2014/COCO_val2014_000000110906.jpg ADDED

Git LFS Details

  • SHA256: d08fdc9a06c89ac9342557a0df4e498c33f721fb24e7b753ef2765bf3ef22a6d
  • Pointer size: 131 Bytes
  • Size of remote file: 123 kB
benchmarks/COCO/val2014/COCO_val2014_000000115796.jpg ADDED

Git LFS Details

  • SHA256: 48095f5753af2e292aad42d90a74439ae45d515ef0bb8d38a95de2f841bdb53a
  • Pointer size: 131 Bytes
  • Size of remote file: 147 kB
benchmarks/COCO/val2014/COCO_val2014_000000128262.jpg ADDED

Git LFS Details

  • SHA256: 8bcbf68ab9d9eba59d633f64ec37f19961c5a5173561a2d187ecf9a7bb7a148b
  • Pointer size: 131 Bytes
  • Size of remote file: 324 kB
benchmarks/COCO/val2014/COCO_val2014_000000139872.jpg ADDED

Git LFS Details

  • SHA256: 1004f177853f43360869c733685f0994ded85ad297d92a3b82809d2cd70a6669
  • Pointer size: 131 Bytes
  • Size of remote file: 231 kB
benchmarks/COCO/val2014/COCO_val2014_000000153392.jpg ADDED

Git LFS Details

  • SHA256: a3907b5d7fb4528370fcfc0bb309947518f2a84e773f4f9b380c9843ccea7eac
  • Pointer size: 130 Bytes
  • Size of remote file: 54 kB
benchmarks/COCO/val2014/COCO_val2014_000000155885.jpg ADDED

Git LFS Details

  • SHA256: 6deebe54595c32afc959b7f3f88bba76a5c078c2f259fe7db02ecfc5d691927a
  • Pointer size: 131 Bytes
  • Size of remote file: 105 kB
benchmarks/COCO/val2014/COCO_val2014_000000169849.jpg ADDED

Git LFS Details

  • SHA256: 18a30109a1eb3b35e35c90329e4118c01dc8fff5eb38cf94ed20e6559a88343d
  • Pointer size: 131 Bytes
  • Size of remote file: 129 kB
benchmarks/COCO/val2014/COCO_val2014_000000181506.jpg ADDED

Git LFS Details

  • SHA256: bc988dd0248967c4bb27117ae055317cf0197a62f0d73aeb9b98356f8836f68c
  • Pointer size: 131 Bytes
  • Size of remote file: 155 kB
benchmarks/COCO/val2014/COCO_val2014_000000188308.jpg ADDED

Git LFS Details

  • SHA256: 2830bf944d1a3fa9d8830104fe2594c2116344144bcad893fdb7e3f7cadc998f
  • Pointer size: 130 Bytes
  • Size of remote file: 97.2 kB
benchmarks/COCO/val2014/COCO_val2014_000000205883.jpg ADDED

Git LFS Details

  • SHA256: dec8f2a3e09275fc9b531e79d4e2056df48c22ef81252d023e16f4e731fff4c4
  • Pointer size: 130 Bytes
  • Size of remote file: 84.3 kB
benchmarks/COCO/val2014/COCO_val2014_000000227224.jpg ADDED

Git LFS Details

  • SHA256: f3877f0d30fa8819ba92b413595faf98d32e027bc532e941960da63a819ab9fd
  • Pointer size: 131 Bytes
  • Size of remote file: 164 kB
benchmarks/COCO/val2014/COCO_val2014_000000243775.jpg ADDED

Git LFS Details

  • SHA256: 2e76e4eaeaf1c23a65d3c59f40a5c913283913d6b03180d1171e5852eff78137
  • Pointer size: 131 Bytes
  • Size of remote file: 159 kB
benchmarks/COCO/val2014/COCO_val2014_000000250870.jpg ADDED

Git LFS Details

  • SHA256: 0e190c55d3af63aa8ba5fbe7d39021ea0c5e46646a01fbb6a12d7bbb15670ed2
  • Pointer size: 131 Bytes
  • Size of remote file: 226 kB
benchmarks/COCO/val2014/COCO_val2014_000000275657.jpg ADDED

Git LFS Details

  • SHA256: 729dc5dda1c8f45aca7bdd17bd038f1bf9221f1cf7a1a77c0cf870b78d341729
  • Pointer size: 131 Bytes
  • Size of remote file: 169 kB
benchmarks/COCO/val2014/COCO_val2014_000000276458.jpg ADDED

Git LFS Details

  • SHA256: 952c957f5aec141a9ce53fb20879c278247bf886f8e20081e892a66bb3112f07
  • Pointer size: 131 Bytes
  • Size of remote file: 135 kB
benchmarks/COCO/val2014/COCO_val2014_000000283147.jpg ADDED

Git LFS Details

  • SHA256: b72a02b165dff8ee0dc7cd9da449ca6eb96afd86c570e9fbc224a078636313e9
  • Pointer size: 131 Bytes
  • Size of remote file: 154 kB
benchmarks/COCO/val2014/COCO_val2014_000000290165.jpg ADDED

Git LFS Details

  • SHA256: d1d15b2ac781ea48433e71d97e574635243fb0323956f7546a64418d08014b66
  • Pointer size: 131 Bytes
  • Size of remote file: 273 kB
benchmarks/COCO/val2014/COCO_val2014_000000308555.jpg ADDED

Git LFS Details

  • SHA256: d03b830ae0c90868cf2ac089130ba2b19ab50326114bf3013bcd00226c4f9d83
  • Pointer size: 131 Bytes
  • Size of remote file: 217 kB
benchmarks/COCO/val2014/COCO_val2014_000000313130.jpg ADDED

Git LFS Details

  • SHA256: 3572b83c43004ac3616ffc05705971f62da2a35c4031efaae6ffe52d9bafa109
  • Pointer size: 131 Bytes
  • Size of remote file: 168 kB
benchmarks/COCO/val2014/COCO_val2014_000000316596.jpg ADDED

Git LFS Details

  • SHA256: fc1ea2bf602bed5e5774880b610c752181661d5f1dae21a81e742fcdc439815b
  • Pointer size: 131 Bytes
  • Size of remote file: 145 kB
benchmarks/COCO/val2014/COCO_val2014_000000329957.jpg ADDED

Git LFS Details

  • SHA256: e1554f6383e4229de66c509ef86a98850c66634431c018dcb397e09e53cbf838
  • Pointer size: 131 Bytes
  • Size of remote file: 173 kB
benchmarks/COCO/val2014/COCO_val2014_000000330098.jpg ADDED

Git LFS Details

  • SHA256: f369fd13ef75776bca4999cbe40672c3030b6f959241f78753431ed454447a5d
  • Pointer size: 131 Bytes
  • Size of remote file: 159 kB
benchmarks/COCO/val2014/COCO_val2014_000000347648.jpg ADDED

Git LFS Details

  • SHA256: e713dd37d891cb4defc88d43e125dfddbe9ee40aa6b96c6e1a684a1f665e94d9
  • Pointer size: 131 Bytes
  • Size of remote file: 191 kB
benchmarks/COCO/val2014/COCO_val2014_000000356094.jpg ADDED

Git LFS Details

  • SHA256: 8395d0b485c3a2c218178bb7190a8030a2db742f363539a914c892d1617584da
  • Pointer size: 131 Bytes
  • Size of remote file: 134 kB
benchmarks/COCO/val2014/COCO_val2014_000000361238.jpg ADDED

Git LFS Details

  • SHA256: d353d745084e986af44b6bb9b2fc4cbf5f412ed913294ffc774ec3d83e49f87d
  • Pointer size: 131 Bytes
  • Size of remote file: 189 kB
benchmarks/COCO/val2014/COCO_val2014_000000369323.jpg ADDED

Git LFS Details

  • SHA256: 237736cd6cfbb668e9b5e99cd08a826f63b79e53f76a7beb57dfd562a0914551
  • Pointer size: 130 Bytes
  • Size of remote file: 98 kB
benchmarks/COCO/val2014/COCO_val2014_000000371529.jpg ADDED

Git LFS Details

  • SHA256: 1db0c839e7060314fa73cefcf19d616a4ced1e295b1b6f891c61f122fb448484
  • Pointer size: 131 Bytes
  • Size of remote file: 234 kB
benchmarks/COCO/val2014/COCO_val2014_000000382288.jpg ADDED

Git LFS Details

  • SHA256: 3c6abd2d3336be6b2716e8534c7cad744a4c021639a7a29c42816fffa5d89ac0
  • Pointer size: 131 Bytes
  • Size of remote file: 164 kB
benchmarks/COCO/val2014/COCO_val2014_000000390975.jpg ADDED

Git LFS Details

  • SHA256: 99d6a8d824196c26bf826ca40decb3379e36082e58b4e19fc1491d311f1093ff
  • Pointer size: 131 Bytes
  • Size of remote file: 188 kB
benchmarks/COCO/val2014/COCO_val2014_000000428881.jpg ADDED

Git LFS Details

  • SHA256: 7684a98407b859f0dec9ea5c55b751dcf85b1f5d24a0831ac46c25ef0de596ec
  • Pointer size: 131 Bytes
  • Size of remote file: 146 kB
benchmarks/COCO/val2014/COCO_val2014_000000483553.jpg ADDED

Git LFS Details

  • SHA256: c4b174976e383ee409222a86addd97de2d04354dd70a8aac76fd4c593de4bdba
  • Pointer size: 131 Bytes
  • Size of remote file: 234 kB
benchmarks/COCO/val2014/COCO_val2014_000000484915.jpg ADDED

Git LFS Details

  • SHA256: b1ca53c854c4534e868537f813710919273a993f52610f0c623b4d57ccf03609
  • Pointer size: 131 Bytes
  • Size of remote file: 216 kB
benchmarks/COCO/val2014/COCO_val2014_000000492552.jpg ADDED

Git LFS Details

  • SHA256: a9286a0314cd8079fc17b4b3bca9446d1443ebae2b8a73a21e2fda7ffed509bd
  • Pointer size: 131 Bytes
  • Size of remote file: 173 kB
benchmarks/COCO/val2014/COCO_val2014_000000493022.jpg ADDED

Git LFS Details

  • SHA256: 1f0444199877cd962d3228140cc7dd552737e4741664f5fbb76fad8bb6f72344
  • Pointer size: 131 Bytes
  • Size of remote file: 151 kB
benchmarks/COCO/val2014/COCO_val2014_000000502844.jpg ADDED

Git LFS Details

  • SHA256: c26637edffa80553681086135954548ce0791646f0b1df214e4c6620c3aab7f9
  • Pointer size: 131 Bytes
  • Size of remote file: 156 kB
benchmarks/COCO/val2014/COCO_val2014_000000519703.jpg ADDED

Git LFS Details

  • SHA256: b597baeb66c12ed13d759a35b2e7a6e6dee2af8c34c11b58bed8c335417931b8
  • Pointer size: 131 Bytes
  • Size of remote file: 196 kB
benchmarks/COCO/val2014/COCO_val2014_000000536791.jpg ADDED

Git LFS Details

  • SHA256: c17e69e5f5787e0aa68de9b93b0e111b8c9e59a9f5cfc4ca3ac95a72899e2607
  • Pointer size: 131 Bytes
  • Size of remote file: 203 kB
benchmarks/COCO/val2014/COCO_val2014_000000550864.jpg ADDED

Git LFS Details

  • SHA256: 2a1f0da6b9d197fd6d58f05e21da47f82b1f41e73d68aba1020ff178dc1f53fe
  • Pointer size: 131 Bytes
  • Size of remote file: 100 kB
benchmarks/COCO/val2014/COCO_val2014_000000564851.jpg ADDED

Git LFS Details

  • SHA256: b4d652d31b99ddc29822ce3db39a9717e41072e2252325897323ecd83632642b
  • Pointer size: 131 Bytes
  • Size of remote file: 160 kB
download_data.py ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Download multiple datasets from Hugging Face and COCO."""
2
+
3
+ import argparse
4
+ import os
5
+ import sys
6
+ from huggingface_hub import snapshot_download
7
+
8
+
9
+ COCO_VAL_URL = "http://images.cocodataset.org/zips/val2014.zip"
10
+
11
+
12
+ def download_huggingface_dataset(repo_id: str, output_dir: str, use_auth_token: bool) -> str:
13
+ os.makedirs(output_dir, exist_ok=True)
14
+ print(f"Downloading Hugging Face dataset {repo_id} to '{output_dir}'...")
15
+ local_dir = snapshot_download(
16
+ repo_id=repo_id,
17
+ repo_type="dataset",
18
+ local_dir=output_dir,
19
+ use_auth_token=use_auth_token,
20
+ )
21
+ print(f"Finished: {repo_id} -> {local_dir}\n")
22
+ return local_dir
23
+
24
+
25
+ def download_file(url: str, output_path: str) -> None:
26
+ try:
27
+ import requests
28
+ except ImportError:
29
+ import urllib.request
30
+
31
+ print("requests not found, falling back to urllib.request")
32
+ urllib.request.urlretrieve(url, output_path)
33
+ return
34
+
35
+ print(f"Downloading file from {url} to '{output_path}'...")
36
+ with requests.get(url, stream=True) as response:
37
+ response.raise_for_status()
38
+ total_size = int(response.headers.get("content-length", 0))
39
+ downloaded = 0
40
+ chunk_size = 8192
41
+ with open(output_path, "wb") as f:
42
+ for chunk in response.iter_content(chunk_size=chunk_size):
43
+ if chunk:
44
+ f.write(chunk)
45
+ downloaded += len(chunk)
46
+ if total_size:
47
+ percent = downloaded * 100 / total_size
48
+ print(f"\rDownloaded {downloaded}/{total_size} bytes ({percent:.1f}%)", end="")
49
+ if total_size:
50
+ print()
51
+ print(f"Finished: {output_path}\n")
52
+
53
+
54
+ def main():
55
+ parser = argparse.ArgumentParser(description="Download VGMED, Medical Multimodal Evaluation Data, and COCO 2014 val images.")
56
+ parser.add_argument(
57
+ "--output-dir",
58
+ default="/home/jinhua/ExplainableVQA/benchmarks",
59
+ help="Base output directory for all downloads. Default: downloads",
60
+ )
61
+ parser.add_argument(
62
+ "--use-auth-token",
63
+ action="store_true",
64
+ help="Use HF authentication token from HUGGINGFACE_HUB_TOKEN environment variable if required.",
65
+ )
66
+ parser.add_argument(
67
+ "--skip-vgmed",
68
+ action="store_true",
69
+ help="Skip downloading guimeng-liu/VGMED.",
70
+ )
71
+ parser.add_argument(
72
+ "--skip-med-eval",
73
+ action="store_true",
74
+ help="Skip downloading FreedomIntelligence/Medical_Multimodal_Evaluation_Data.",
75
+ )
76
+ parser.add_argument(
77
+ "--skip-coco",
78
+ action="store_true",
79
+ help="Skip downloading COCO 2014 validation images.",
80
+ )
81
+ parser.add_argument(
82
+ "--coco-url",
83
+ default=COCO_VAL_URL,
84
+ help="COCO 2014 val images download URL. Default is the official val2014 zip URL.",
85
+ )
86
+ args = parser.parse_args()
87
+
88
+ base_dir = os.path.abspath(args.output_dir)
89
+ os.makedirs(base_dir, exist_ok=True)
90
+
91
+ if not args.skip_vgmed:
92
+ download_huggingface_dataset(
93
+ repo_id="guimeng-liu/VGMED",
94
+ output_dir=os.path.join(base_dir, "VGMED"),
95
+ use_auth_token=args.use_auth_token,
96
+ )
97
+
98
+ if not args.skip_med_eval:
99
+ download_huggingface_dataset(
100
+ repo_id="FreedomIntelligence/Medical_Multimodal_Evaluation_Data",
101
+ output_dir=os.path.join(base_dir, "Medical_Multimodal_Evaluation_Data"),
102
+ use_auth_token=args.use_auth_token,
103
+ )
104
+
105
+ if not args.skip_coco:
106
+ coco_target = os.path.join(base_dir, "val2014.zip")
107
+ download_file(args.coco_url, coco_target)
108
+
109
+ print("All requested downloads completed.")
110
+
111
+
112
+ if __name__ == "__main__":
113
+ main()
download_sam3_assets.py ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Download the external assets needed by MedSAM3 that are not part of the
3
+ git repo itself (sam3.pt is too large to commit; bpe_simple_vocab_16e6.txt.gz
4
+ ships with OpenAI's CLIP repo, not this one; the LoRA weights are the
5
+ project's own released checkpoint on HuggingFace):
6
+
7
+ - facebook/sam3 model weights -> models/sam3.pt (via ModelScope, ~3.45GB)
8
+ - CLIP BPE vocab -> models/bpe_simple_vocab_16e6.txt.gz
9
+ - MedSAM3-v1 LoRA weights -> models/best_lora_weights.pt (huggingface.co/lal-Joey/MedSAM3_v1)
10
+
11
+ Usage:
12
+ python download_sam3_assets.py
13
+ """
14
+
15
+ import os
16
+ import shutil
17
+ import urllib.request
18
+
19
+ MODELS_DIR = "/home/jinhua/ExplainableVQA/HuatuoGPT-Vision-Abla/MedSAM3/models"
20
+
21
+ BPE_VOCAB_URL = "https://raw.githubusercontent.com/facebookresearch/sam3/main/sam3/assets/bpe_simple_vocab_16e6.txt.gz"
22
+ BPE_VOCAB_PATH = os.path.join(MODELS_DIR, "bpe_simple_vocab_16e6.txt.gz")
23
+
24
+ SAM3_WEIGHTS_PATH = os.path.join(MODELS_DIR, "sam3.pt")
25
+
26
+ LORA_REPO_ID = "lal-Joey/MedSAM3_v1"
27
+ LORA_WEIGHTS_PATH = os.path.join(MODELS_DIR, "best_lora_weights.pt")
28
+
29
+
30
+ def download_bpe_vocab():
31
+ if os.path.exists(BPE_VOCAB_PATH):
32
+ print(f"[Skip] {BPE_VOCAB_PATH} already exists.")
33
+ return
34
+ print(f"==> Downloading CLIP BPE vocab from {BPE_VOCAB_URL}")
35
+ os.makedirs(MODELS_DIR, exist_ok=True)
36
+ urllib.request.urlretrieve(BPE_VOCAB_URL, BPE_VOCAB_PATH)
37
+ print(f"[Done] Saved to {BPE_VOCAB_PATH}")
38
+
39
+
40
+ def download_sam3_weights():
41
+ if os.path.exists(SAM3_WEIGHTS_PATH):
42
+ print(f"[Skip] {SAM3_WEIGHTS_PATH} already exists.")
43
+ return
44
+ from modelscope import snapshot_download
45
+
46
+ print("==> Downloading facebook/sam3 weights via ModelScope (~3.45GB)")
47
+ model_dir = snapshot_download("facebook/sam3")
48
+ print(f" Downloaded to {model_dir}")
49
+
50
+ src = os.path.join(model_dir, "sam3.pt")
51
+ if not os.path.exists(src):
52
+ candidates = [f for f in os.listdir(model_dir) if f.endswith(".pt")]
53
+ if not candidates:
54
+ raise FileNotFoundError(f"No .pt file found in {model_dir}")
55
+ src = os.path.join(model_dir, candidates[0])
56
+
57
+ os.makedirs(MODELS_DIR, exist_ok=True)
58
+ shutil.copy(src, SAM3_WEIGHTS_PATH)
59
+ print(f"[Done] Copied to {SAM3_WEIGHTS_PATH}")
60
+
61
+
62
+ def download_lora_weights():
63
+ if os.path.exists(LORA_WEIGHTS_PATH):
64
+ print(f"[Skip] {LORA_WEIGHTS_PATH} already exists.")
65
+ return
66
+ from huggingface_hub import snapshot_download
67
+
68
+ print(f"==> Downloading LoRA weights from huggingface.co/{LORA_REPO_ID}")
69
+ repo_dir = snapshot_download(repo_id=LORA_REPO_ID)
70
+ print(f" Downloaded to {repo_dir}")
71
+
72
+ candidates = [f for f in os.listdir(repo_dir) if f.endswith(".pt")]
73
+ if not candidates:
74
+ raise FileNotFoundError(f"No .pt file found in {repo_dir}")
75
+ src = os.path.join(repo_dir, candidates[0])
76
+
77
+ os.makedirs(MODELS_DIR, exist_ok=True)
78
+ shutil.copy(src, LORA_WEIGHTS_PATH)
79
+ print(f"[Done] Copied to {LORA_WEIGHTS_PATH}")
80
+
81
+
82
+ def main():
83
+ download_bpe_vocab()
84
+ download_sam3_weights()
85
+ download_lora_weights()
86
+
87
+
88
+ if __name__ == "__main__":
89
+ main()
gpu1_hold_30g.log ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ nohup: ignoring input
2
+ GPU 1: holding 30 GiB for 1 hour
predownload_models-ori.py ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Pre-download all HuggingFace model repos used by:
3
+ - MedEvalKit/eval_scripts/grounding/diff_region/*.sh (grounding diff-region analysis)
4
+
5
+ Downloads go to a custom HuggingFace cache directory
6
+ (/home/jinhua/ExplainableVQA/checkpoint/models) instead of the default
7
+ ~/.cache/huggingface. As long as HF_HOME points to this same directory at
8
+ load time, `from_pretrained(repo_id, ...)` will transparently hit this cache
9
+ instead of re-downloading - it behaves exactly like the normal HF cache,
10
+ just relocated.
11
+
12
+ Each repo is retried several times with resume (snapshot_download skips files
13
+ already fully downloaded and resumes partial ones), since mirrors like
14
+ hf-mirror.com often time out near the end of large files.
15
+
16
+ Usage:
17
+ python predownload_models_to_checkpoint.py
18
+ """
19
+
20
+ import os
21
+ import time
22
+
23
+ # Custom cache location - from_pretrained(repo_id) will read from here as
24
+ # long as HF_HOME is set to the same path when the model is actually loaded.
25
+ #os.environ.setdefault("HF_HOME", "/home/jinhua/ExplainableVQA/checkpoint/models")
26
+
27
+ # Use the hf-mirror.com mirror (much faster from China than huggingface.co directly).
28
+ #os.environ.setdefault("HF_ENDPOINT", "https://hf-mirror.com")
29
+
30
+ # Raise the default 10s timeout - hf-mirror.com often stalls on the final
31
+ # etag/HEAD check for large files.
32
+ os.environ.setdefault("HF_HUB_DOWNLOAD_TIMEOUT", "60")
33
+
34
+ # Disable the Xet backend: it generates a fresh random temp file on every
35
+ # resume instead of continuing the previous .incomplete file, so interrupted
36
+ # downloads restart from 0 instead of resuming.
37
+ os.environ.setdefault("HF_HUB_DISABLE_XET", "1")
38
+
39
+ from huggingface_hub import snapshot_download
40
+
41
+ REPO_IDS = [
42
+ # ---- MedEvalKit/eval_scripts/grounding/diff_region/*.sh ----
43
+ # "Qwen/Qwen2.5-VL-3B-Instruct", # Qwen2.5VL-3B
44
+ # "Qwen/Qwen2.5-VL-7B-Instruct", # Qwen2.5VL-7B
45
+ # "Qwen/Qwen2.5-VL-32B-Instruct", # Qwen2.5VL-32B
46
+ "llava-hf/llava-1.5-7b-hf", # LLaVA-7B
47
+ "llava-hf/llava-1.5-13b-hf", # LLaVA-13B
48
+ # "microsoft/llava-med-v1.5-mistral-7b", # LLaVA-Med-7B
49
+ # "FreedomIntelligence/HuatuoGPT-Vision-7B", # HuatuoGPT-V-7B
50
+ # "FreedomIntelligence/HuatuoGPT-Vision-34B", # HuatuoGPT-V-34B
51
+ # "google/medgemma-4b-it", # MedGemma-4B-IT
52
+ # "google/medgemma-27b-it", # MedGemma-27B-IT (gated repo, multimodal variant)
53
+ ]
54
+
55
+ DATASET_REPO_IDS = []
56
+
57
+ MAX_RETRIES = 10
58
+ RETRY_DELAY_SECONDS = 5
59
+
60
+
61
+ def download_with_retries(repo_id, repo_type="model"):
62
+ for attempt in range(1, MAX_RETRIES + 1):
63
+ try:
64
+ snapshot_download(repo_id=repo_id, repo_type=repo_type, resume_download=True)
65
+ return True
66
+ except Exception as e:
67
+ print(f" attempt {attempt}/{MAX_RETRIES} failed: {e}")
68
+ if attempt < MAX_RETRIES:
69
+ time.sleep(RETRY_DELAY_SECONDS)
70
+ return False
71
+
72
+
73
+ def main():
74
+ #print(f"HF_HOME = {os.environ['HF_HOME']}")
75
+
76
+ failed = []
77
+ for repo_id in REPO_IDS:
78
+ print(f"==> Downloading {repo_id}")
79
+ if not download_with_retries(repo_id):
80
+ failed.append(repo_id)
81
+ print(f" GAVE UP: {repo_id}")
82
+
83
+ for repo_id in DATASET_REPO_IDS:
84
+ print(f"==> Downloading dataset {repo_id}")
85
+ if not download_with_retries(repo_id, repo_type="dataset"):
86
+ failed.append(repo_id)
87
+ print(f" GAVE UP: {repo_id}")
88
+
89
+ print("\n==== Summary ====")
90
+ if failed:
91
+ print("Failed repos (re-run this script to resume them):")
92
+ for repo_id in failed:
93
+ print(f" - {repo_id}")
94
+ else:
95
+ print("All repos downloaded successfully.")
96
+
97
+
98
+ if __name__ == "__main__":
99
+ main()
predownload_models.py ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Pre-download all HuggingFace model repos used by:
3
+ - MedEvalKit/eval_scripts/grounding/diff_region/*.sh (grounding diff-region analysis)
4
+
5
+ Downloads go to a custom HuggingFace cache directory
6
+ (/home/jinhua/ExplainableVQA/checkpoint/models) instead of the default
7
+ ~/.cache/huggingface. As long as HF_HOME points to this same directory at
8
+ load time, `from_pretrained(repo_id, ...)` will transparently hit this cache
9
+ instead of re-downloading - it behaves exactly like the normal HF cache,
10
+ just relocated.
11
+
12
+ Each repo is retried several times with resume (snapshot_download skips files
13
+ already fully downloaded and resumes partial ones), since mirrors like
14
+ hf-mirror.com often time out near the end of large files.
15
+
16
+ Usage:
17
+ python predownload_models_to_checkpoint.py
18
+ """
19
+
20
+ import os
21
+ import time
22
+
23
+ # Custom cache location - from_pretrained(repo_id) will read from here as
24
+ # long as HF_HOME is set to the same path when the model is actually loaded.
25
+ #os.environ.setdefault("HF_HOME", "/home/jinhua/ExplainableVQA/checkpoint/models")
26
+
27
+ # Use the hf-mirror.com mirror (much faster from China than huggingface.co directly).
28
+ #os.environ.setdefault("HF_ENDPOINT", "https://hf-mirror.com")
29
+
30
+ # Raise the default 10s timeout - hf-mirror.com often stalls on the final
31
+ # etag/HEAD check for large files.
32
+ os.environ.setdefault("HF_HUB_DOWNLOAD_TIMEOUT", "60")
33
+
34
+ # Disable the Xet backend: it generates a fresh random temp file on every
35
+ # resume instead of continuing the previous .incomplete file, so interrupted
36
+ # downloads restart from 0 instead of resuming.
37
+ os.environ.setdefault("HF_HUB_DISABLE_XET", "1")
38
+
39
+ from huggingface_hub import snapshot_download
40
+
41
+ REPO_IDS = [
42
+ # ---- MedEvalKit/eval_scripts/grounding/diff_region/*.sh ----
43
+ # "Qwen/Qwen2.5-VL-3B-Instruct", # Qwen2.5VL-3B
44
+ # "Qwen/Qwen2.5-VL-7B-Instruct", # Qwen2.5VL-7B
45
+ # "Qwen/Qwen2.5-VL-32B-Instruct", # Qwen2.5VL-32B
46
+ # "llava-hf/llava-1.5-7b-hf", # LLaVA-7B
47
+ # "llava-hf/llava-1.5-13b-hf", # LLaVA-13B
48
+ # "microsoft/llava-med-v1.5-mistral-7b", # LLaVA-Med-7B
49
+ # "FreedomIntelligence/HuatuoGPT-Vision-7B", # HuatuoGPT-V-7B
50
+ # "FreedomIntelligence/HuatuoGPT-Vision-34B", # HuatuoGPT-V-34B
51
+ # "google/medgemma-4b-it", # MedGemma-4B-IT
52
+ # "google/medgemma-27b-it", # MedGemma-27B-IT (gated repo, multimodal variant)
53
+ "Qwen/Qwen3-VL-2B-Instruct", # Qwen3VL-2B
54
+ "Qwen/Qwen3-VL-4B-Instruct", # Qwen3VL-4B
55
+ "Qwen/Qwen3-VL-8B-Instruct", # Qwen3VL-8B
56
+ ]
57
+
58
+ DATASET_REPO_IDS = []
59
+
60
+ MAX_RETRIES = 10
61
+ RETRY_DELAY_SECONDS = 5
62
+
63
+
64
+ def download_with_retries(repo_id, repo_type="model"):
65
+ for attempt in range(1, MAX_RETRIES + 1):
66
+ try:
67
+ snapshot_download(repo_id=repo_id, repo_type=repo_type, resume_download=True)
68
+ return True
69
+ except Exception as e:
70
+ print(f" attempt {attempt}/{MAX_RETRIES} failed: {e}")
71
+ if attempt < MAX_RETRIES:
72
+ time.sleep(RETRY_DELAY_SECONDS)
73
+ return False
74
+
75
+
76
+ def main():
77
+ #print(f"HF_HOME = {os.environ['HF_HOME']}")
78
+
79
+ failed = []
80
+ for repo_id in REPO_IDS:
81
+ print(f"==> Downloading {repo_id}")
82
+ if not download_with_retries(repo_id):
83
+ failed.append(repo_id)
84
+ print(f" GAVE UP: {repo_id}")
85
+
86
+ for repo_id in DATASET_REPO_IDS:
87
+ print(f"==> Downloading dataset {repo_id}")
88
+ if not download_with_retries(repo_id, repo_type="dataset"):
89
+ failed.append(repo_id)
90
+ print(f" GAVE UP: {repo_id}")
91
+
92
+ print("\n==== Summary ====")
93
+ if failed:
94
+ print("Failed repos (re-run this script to resume them):")
95
+ for repo_id in failed:
96
+ print(f" - {repo_id}")
97
+ else:
98
+ print("All repos downloaded successfully.")
99
+
100
+
101
+ if __name__ == "__main__":
102
+ main()