EmergentTwilight's picture
download
raw
2.27 kB
"""Build the fixed-grid ThinkMorph cache and project the existing IDVal5 split."""
from __future__ import annotations
import argparse
import json
import subprocess
import sys
from pathlib import Path
from .reuse_split_view import reuse_split_view
def main() -> None:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--source-root", type=Path, default=Path("data/ThinkMorph"))
parser.add_argument("--model-path", type=Path, default=Path("models/UniAR-SFT"))
parser.add_argument("--full-cache", type=Path, required=True)
parser.add_argument("--assignment-view", type=Path, required=True)
parser.add_argument("--development-view", type=Path, required=True)
parser.add_argument("--run-dir", type=Path, required=True)
parser.add_argument("--nproc-per-node", type=int, default=4)
args = parser.parse_args()
subprocess.run(
[
sys.executable,
"-m",
"torch.distributed.run",
"--standalone",
f"--nproc-per-node={args.nproc_per_node}",
"-m",
"thinkmorph_sft.prepare_cache",
"--source-root",
str(args.source_root),
"--model-path",
str(args.model_path),
"--output-root",
str(args.full_cache),
"--attn",
"flash_attention_2",
"--image-preprocessing-profile",
"understanding_input_grid16_target",
"--target-canvas-size",
"512",
"--target-background",
"128",
"--auto-resume",
],
check=True,
)
report = reuse_split_view(
args.full_cache,
args.assignment_view,
args.development_view,
)
args.run_dir.mkdir(parents=True, exist_ok=True)
(args.run_dir / "cache_result.json").write_text(
json.dumps(report, ensure_ascii=False, indent=2) + "\n"
)
print(
json.dumps(
{
"status": "complete",
"full_cache": str(args.full_cache),
"development_view": str(args.development_view),
"counts": report["counts"],
}
),
flush=True,
)
if __name__ == "__main__":
main()

Xet Storage Details

Size:
2.27 kB
·
Xet hash:
d6722db3376ce2da11adf2cdeac59ff0b7e50a26991e43d3439d82ae6a201fe3

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.