Commit ·
f9aa7ec
1
Parent(s): 61563db
logging added to config creation tools.
Browse files
tools/__pycache__/make_configs.cpython-313.pyc
CHANGED
|
Binary files a/tools/__pycache__/make_configs.cpython-313.pyc and b/tools/__pycache__/make_configs.cpython-313.pyc differ
|
|
|
tools/__pycache__/make_master_configs.cpython-313.pyc
CHANGED
|
Binary files a/tools/__pycache__/make_master_configs.cpython-313.pyc and b/tools/__pycache__/make_master_configs.cpython-313.pyc differ
|
|
|
tools/make_configs.py
CHANGED
|
@@ -72,9 +72,15 @@ def write_configs_from_split_map(
|
|
| 72 |
images_root: Path,
|
| 73 |
) -> None:
|
| 74 |
out_configs_dir.mkdir(parents=True, exist_ok=True)
|
|
|
|
|
|
|
| 75 |
for cfg_name, splits in split_map.items():
|
| 76 |
cfg_dir = out_configs_dir / cfg_name
|
| 77 |
cfg_dir.mkdir(parents=True, exist_ok=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
for split in ("train", "id_test", "ood_test"):
|
| 79 |
write_rows_to_parquet(
|
| 80 |
rows_from_files(splits[split], light_index, images_root),
|
|
@@ -82,6 +88,7 @@ def write_configs_from_split_map(
|
|
| 82 |
split,
|
| 83 |
rows_per_shard,
|
| 84 |
)
|
|
|
|
| 85 |
|
| 86 |
|
| 87 |
def main() -> None:
|
|
@@ -118,8 +125,14 @@ def main() -> None:
|
|
| 118 |
all_split_map = {}
|
| 119 |
all_split_map.update(base_split_map)
|
| 120 |
all_split_map.update(fewshot_split_map)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
|
|
|
|
| 122 |
light_index = build_light_index(str(args.master_dir), args.scan_batch_size)
|
|
|
|
| 123 |
write_configs_from_split_map(
|
| 124 |
split_map=all_split_map,
|
| 125 |
out_configs_dir=out_configs_dir,
|
|
|
|
| 72 |
images_root: Path,
|
| 73 |
) -> None:
|
| 74 |
out_configs_dir.mkdir(parents=True, exist_ok=True)
|
| 75 |
+
total = len(split_map)
|
| 76 |
+
print(f"[make_configs] Writing {total} configs to {out_configs_dir}")
|
| 77 |
for cfg_name, splits in split_map.items():
|
| 78 |
cfg_dir = out_configs_dir / cfg_name
|
| 79 |
cfg_dir.mkdir(parents=True, exist_ok=True)
|
| 80 |
+
train_n = len(splits["train"])
|
| 81 |
+
id_n = len(splits["id_test"])
|
| 82 |
+
ood_n = len(splits["ood_test"])
|
| 83 |
+
print(f"[make_configs] -> {cfg_name} (train={train_n}, id_test={id_n}, ood_test={ood_n})")
|
| 84 |
for split in ("train", "id_test", "ood_test"):
|
| 85 |
write_rows_to_parquet(
|
| 86 |
rows_from_files(splits[split], light_index, images_root),
|
|
|
|
| 88 |
split,
|
| 89 |
rows_per_shard,
|
| 90 |
)
|
| 91 |
+
print(f"[make_configs] <- {cfg_name} done")
|
| 92 |
|
| 93 |
|
| 94 |
def main() -> None:
|
|
|
|
| 125 |
all_split_map = {}
|
| 126 |
all_split_map.update(base_split_map)
|
| 127 |
all_split_map.update(fewshot_split_map)
|
| 128 |
+
print(
|
| 129 |
+
f"[make_configs] Prepared split plans: base={len(base_split_map)} "
|
| 130 |
+
f"fewshot={len(fewshot_split_map)} total={len(all_split_map)}"
|
| 131 |
+
)
|
| 132 |
|
| 133 |
+
print("[make_configs] Building lightweight master index...")
|
| 134 |
light_index = build_light_index(str(args.master_dir), args.scan_batch_size)
|
| 135 |
+
print(f"[make_configs] Indexed {len(light_index)} master rows")
|
| 136 |
write_configs_from_split_map(
|
| 137 |
split_map=all_split_map,
|
| 138 |
out_configs_dir=out_configs_dir,
|
tools/make_master_configs.py
CHANGED
|
@@ -151,9 +151,15 @@ def write_config_from_split_map(
|
|
| 151 |
images_root: Path,
|
| 152 |
) -> None:
|
| 153 |
out_configs_dir.mkdir(parents=True, exist_ok=True)
|
|
|
|
|
|
|
| 154 |
for cfg_name, splits in split_map.items():
|
| 155 |
cfg_dir = out_configs_dir / cfg_name
|
| 156 |
cfg_dir.mkdir(parents=True, exist_ok=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
for split in ("train", "id_test", "ood_test"):
|
| 158 |
write_rows_to_parquet(
|
| 159 |
rows_from_files(splits[split], light_index, images_root),
|
|
@@ -161,6 +167,7 @@ def write_config_from_split_map(
|
|
| 161 |
split,
|
| 162 |
rows_per_shard,
|
| 163 |
)
|
|
|
|
| 164 |
|
| 165 |
|
| 166 |
def build_master_configs(
|
|
@@ -185,7 +192,9 @@ def build_master_configs(
|
|
| 185 |
split_map = collect_base_splits(meta, train_ratio=train_ratio, seed=seed, min_pool=min_pool)
|
| 186 |
|
| 187 |
if write_parquet:
|
|
|
|
| 188 |
light_index = build_light_index(str(master_dir), scan_batch_size)
|
|
|
|
| 189 |
write_config_from_split_map(
|
| 190 |
split_map=split_map,
|
| 191 |
out_configs_dir=out_configs_dir,
|
|
|
|
| 151 |
images_root: Path,
|
| 152 |
) -> None:
|
| 153 |
out_configs_dir.mkdir(parents=True, exist_ok=True)
|
| 154 |
+
total = len(split_map)
|
| 155 |
+
print(f"[make_master_configs] Writing {total} base configs to {out_configs_dir}")
|
| 156 |
for cfg_name, splits in split_map.items():
|
| 157 |
cfg_dir = out_configs_dir / cfg_name
|
| 158 |
cfg_dir.mkdir(parents=True, exist_ok=True)
|
| 159 |
+
train_n = len(splits["train"])
|
| 160 |
+
id_n = len(splits["id_test"])
|
| 161 |
+
ood_n = len(splits["ood_test"])
|
| 162 |
+
print(f"[make_master_configs] -> {cfg_name} (train={train_n}, id_test={id_n}, ood_test={ood_n})")
|
| 163 |
for split in ("train", "id_test", "ood_test"):
|
| 164 |
write_rows_to_parquet(
|
| 165 |
rows_from_files(splits[split], light_index, images_root),
|
|
|
|
| 167 |
split,
|
| 168 |
rows_per_shard,
|
| 169 |
)
|
| 170 |
+
print(f"[make_master_configs] <- {cfg_name} done")
|
| 171 |
|
| 172 |
|
| 173 |
def build_master_configs(
|
|
|
|
| 192 |
split_map = collect_base_splits(meta, train_ratio=train_ratio, seed=seed, min_pool=min_pool)
|
| 193 |
|
| 194 |
if write_parquet:
|
| 195 |
+
print("[make_master_configs] Building lightweight master index...")
|
| 196 |
light_index = build_light_index(str(master_dir), scan_batch_size)
|
| 197 |
+
print(f"[make_master_configs] Indexed {len(light_index)} master rows")
|
| 198 |
write_config_from_split_map(
|
| 199 |
split_map=split_map,
|
| 200 |
out_configs_dir=out_configs_dir,
|