update
This commit is contained in:
44
example/config_no_temporal.json
Normal file
44
example/config_no_temporal.json
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"data_path": "../../dataset/hai/hai-21.03/train1.csv.gz",
|
||||
"data_glob": "../../dataset/hai/hai-21.03/train*.csv.gz",
|
||||
"split_path": "./feature_split.json",
|
||||
"stats_path": "./results/cont_stats.json",
|
||||
"vocab_path": "./results/disc_vocab.json",
|
||||
"out_dir": "./results",
|
||||
"device": "auto",
|
||||
"timesteps": 600,
|
||||
"batch_size": 128,
|
||||
"seq_len": 128,
|
||||
"epochs": 10,
|
||||
"max_batches": 4000,
|
||||
"lambda": 0.7,
|
||||
"lr": 0.0005,
|
||||
"seed": 1337,
|
||||
"log_every": 10,
|
||||
"ckpt_every": 50,
|
||||
"ema_decay": 0.999,
|
||||
"use_ema": true,
|
||||
"clip_k": 5.0,
|
||||
"grad_clip": 1.0,
|
||||
"use_condition": true,
|
||||
"condition_type": "file_id",
|
||||
"cond_dim": 32,
|
||||
"use_tanh_eps": false,
|
||||
"eps_scale": 1.0,
|
||||
"model_time_dim": 128,
|
||||
"model_hidden_dim": 512,
|
||||
"model_num_layers": 2,
|
||||
"model_dropout": 0.1,
|
||||
"model_ff_mult": 2,
|
||||
"model_pos_dim": 64,
|
||||
"model_use_pos_embed": true,
|
||||
"disc_mask_scale": 0.9,
|
||||
"cont_loss_weighting": "inv_std",
|
||||
"cont_loss_eps": 1e-6,
|
||||
"cont_target": "x0",
|
||||
"cont_clamp_x0": 5.0,
|
||||
"shuffle_buffer": 1024,
|
||||
"use_temporal_stage1": false,
|
||||
"sample_batch_size": 8,
|
||||
"sample_seq_len": 128
|
||||
}
|
||||
49
example/config_temporal_strong.json
Normal file
49
example/config_temporal_strong.json
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"data_path": "../../dataset/hai/hai-21.03/train1.csv.gz",
|
||||
"data_glob": "../../dataset/hai/hai-21.03/train*.csv.gz",
|
||||
"split_path": "./feature_split.json",
|
||||
"stats_path": "./results/cont_stats.json",
|
||||
"vocab_path": "./results/disc_vocab.json",
|
||||
"out_dir": "./results",
|
||||
"device": "auto",
|
||||
"timesteps": 600,
|
||||
"batch_size": 128,
|
||||
"seq_len": 128,
|
||||
"epochs": 10,
|
||||
"max_batches": 4000,
|
||||
"lambda": 0.7,
|
||||
"lr": 0.0005,
|
||||
"seed": 1337,
|
||||
"log_every": 10,
|
||||
"ckpt_every": 50,
|
||||
"ema_decay": 0.999,
|
||||
"use_ema": true,
|
||||
"clip_k": 5.0,
|
||||
"grad_clip": 1.0,
|
||||
"use_condition": true,
|
||||
"condition_type": "file_id",
|
||||
"cond_dim": 32,
|
||||
"use_tanh_eps": false,
|
||||
"eps_scale": 1.0,
|
||||
"model_time_dim": 128,
|
||||
"model_hidden_dim": 512,
|
||||
"model_num_layers": 2,
|
||||
"model_dropout": 0.1,
|
||||
"model_ff_mult": 2,
|
||||
"model_pos_dim": 64,
|
||||
"model_use_pos_embed": true,
|
||||
"disc_mask_scale": 0.9,
|
||||
"cont_loss_weighting": "inv_std",
|
||||
"cont_loss_eps": 1e-6,
|
||||
"cont_target": "x0",
|
||||
"cont_clamp_x0": 5.0,
|
||||
"shuffle_buffer": 1024,
|
||||
"use_temporal_stage1": true,
|
||||
"temporal_hidden_dim": 512,
|
||||
"temporal_num_layers": 2,
|
||||
"temporal_dropout": 0.0,
|
||||
"temporal_epochs": 5,
|
||||
"temporal_lr": 0.0005,
|
||||
"sample_batch_size": 8,
|
||||
"sample_seq_len": 128
|
||||
}
|
||||
58
example/run_compare.py
Normal file
58
example/run_compare.py
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Run two configs sequentially and print metric deltas."""
|
||||
|
||||
import argparse
|
||||
import csv
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def run(cmd):
|
||||
print("running:", " ".join(cmd))
|
||||
subprocess.run(cmd, check=True)
|
||||
|
||||
|
||||
def read_last_metrics(path: Path):
|
||||
if not path.exists():
|
||||
return None
|
||||
rows = list(csv.DictReader(path.open()))
|
||||
return rows[-1] if rows else None
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Compare metrics for two configs.")
|
||||
base_dir = Path(__file__).resolve().parent
|
||||
parser.add_argument("--config-a", default=str(base_dir / "config_no_temporal.json"))
|
||||
parser.add_argument("--config-b", default=str(base_dir / "config_temporal_strong.json"))
|
||||
parser.add_argument("--device", default="auto")
|
||||
args = parser.parse_args()
|
||||
|
||||
history = base_dir / "results" / "metrics_history.csv"
|
||||
if history.exists():
|
||||
history.unlink()
|
||||
|
||||
run([sys.executable, str(base_dir / "run_all.py"), "--config", args.config_a, "--device", args.device])
|
||||
a = read_last_metrics(history)
|
||||
run([sys.executable, str(base_dir / "run_all.py"), "--config", args.config_b, "--device", args.device])
|
||||
b = read_last_metrics(history)
|
||||
|
||||
if not a or not b:
|
||||
raise SystemExit("missing metrics_history.csv entries")
|
||||
|
||||
def f(v):
|
||||
return float(v) if v is not None else None
|
||||
|
||||
print("baseline_avg_ks", a["avg_ks"])
|
||||
print("temporal_avg_ks", b["avg_ks"])
|
||||
print("delta_avg_ks", f(b["avg_ks"]) - f(a["avg_ks"]))
|
||||
print("baseline_avg_jsd", a["avg_jsd"])
|
||||
print("temporal_avg_jsd", b["avg_jsd"])
|
||||
print("delta_avg_jsd", f(b["avg_jsd"]) - f(a["avg_jsd"]))
|
||||
print("baseline_avg_lag1_diff", a["avg_lag1_diff"])
|
||||
print("temporal_avg_lag1_diff", b["avg_lag1_diff"])
|
||||
print("delta_avg_lag1_diff", f(b["avg_lag1_diff"]) - f(a["avg_lag1_diff"]))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user