File size: 1,528 Bytes
9475d42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

import os, shutil, subprocess, sys
td = r"/workspace/TabDiff"
name = r"pipeline_n3"
src = r"/work/output-Benchmark-trainonly-v1/n3/tabdiff/tabdiff-n3-20260504_204815/tabular_bundle/pipeline_n3"
dst_data = os.path.join(td, "data", name)
dst_syn = os.path.join(td, "synthetic", name)
shutil.rmtree(dst_data, ignore_errors=True)
shutil.copytree(src, dst_data)
os.makedirs(dst_syn, exist_ok=True)
for fn in ("real.csv", "test.csv", "val.csv"):
    shutil.copy(os.path.join(src, fn), os.path.join(dst_syn, fn))
os.chdir(td)
os.environ["PYTHONPATH"] = td + os.pathsep + os.environ.get("PYTHONPATH", "")
subprocess.check_call([
    sys.executable, "-m", "tabdiff.main",
    "--dataname", name, "--mode", "test", "--gpu", "0",
    "--no_wandb", "--exp_name", r"adapter_learnable",
    "--ckpt_path", r"/workspace/TabDiff/tabdiff/ckpt/pipeline_n3/adapter_learnable/model_800.pt",
    "--num_samples_to_generate", str(int(3918)),
])
# test() 写入 tabdiff/result/<dataname>/<exp>/<epoch>/samples.csv
import glob as g
base = os.path.join(td, "tabdiff", "result", name, r"adapter_learnable")
best = None
best_t = -1.0
for root, _, files in os.walk(base):
    if "samples.csv" in files:
        p = os.path.join(root, "samples.csv")
        t = os.path.getmtime(p)
        if t > best_t:
            best_t = t
            best = p
if not best:
    raise SystemExit("tabdiff: no samples.csv under " + base)
shutil.copy(best, r"/work/output-Benchmark-trainonly-v1/n3/tabdiff/tabdiff-n3-20260504_204815/tabdiff-n3-3918-20260504_210307.csv")