Matthew Ford commited on
Commit ·
19ac1ec
1
Parent(s): e19ba67
feat: --structural-source flag in eval_v6 for arm-matched evaluation
Browse filesA checkpoint must be evaluated with the same structural embedding block it was
trained on, else a 269-dim POM model receives 151-dim Morgan tokens (dim
mismatch) or vice-versa. Threads the flag into make_validation_dataset.
Former-commit-id: 54339a2eb63ed92e327534b0da854f5393452ac7
Former-commit-id: b632b352e772479c193b7047aec8c2be507228ad
- scripts/eval_v6.py +4 -2
scripts/eval_v6.py
CHANGED
|
@@ -38,6 +38,7 @@ def parse_args() -> argparse.Namespace:
|
|
| 38 |
parser.add_argument("--batch-size", type=int, default=8)
|
| 39 |
parser.add_argument("--seed", type=int, default=42)
|
| 40 |
parser.add_argument("--train-ratio", type=float, default=DEFAULT_TRAIN_RATIO, help="Molecule-disjoint train molecule ratio used to rebuild the 15% holdout validation set.")
|
|
|
|
| 41 |
parser.add_argument("--output", default="metrics_v6_current.json", help="Metrics JSON output path.")
|
| 42 |
parser.add_argument(
|
| 43 |
"--hf-repo",
|
|
@@ -80,12 +81,13 @@ def sha256_file(path: str | Path) -> str:
|
|
| 80 |
return digest.hexdigest()
|
| 81 |
|
| 82 |
|
| 83 |
-
def make_validation_dataset(records: list[dict[str, Any]], *, train_ratio: float, seed: int) -> FragranceTrajectoryDataset:
|
| 84 |
split = create_molecule_disjoint_split_from_records(records, train_ratio=train_ratio, seed=seed)
|
| 85 |
genre_map = {genre: idx for idx, genre in enumerate(DEFAULT_GENRES)}
|
| 86 |
return FragranceTrajectoryDataset(
|
| 87 |
records=split["validation"],
|
| 88 |
use_embedding_fallback=True,
|
|
|
|
| 89 |
genre_map=genre_map,
|
| 90 |
)
|
| 91 |
|
|
@@ -148,7 +150,7 @@ def evaluate(args: argparse.Namespace) -> dict[str, Any]:
|
|
| 148 |
heads.eval()
|
| 149 |
|
| 150 |
records = read_records(args.data)
|
| 151 |
-
val_dataset = make_validation_dataset(records, train_ratio=args.train_ratio, seed=args.seed)
|
| 152 |
val_loader = DataLoader(
|
| 153 |
val_dataset,
|
| 154 |
batch_size=args.batch_size,
|
|
|
|
| 38 |
parser.add_argument("--batch-size", type=int, default=8)
|
| 39 |
parser.add_argument("--seed", type=int, default=42)
|
| 40 |
parser.add_argument("--train-ratio", type=float, default=DEFAULT_TRAIN_RATIO, help="Molecule-disjoint train molecule ratio used to rebuild the 15% holdout validation set.")
|
| 41 |
+
parser.add_argument("--structural-source", choices=["morgan", "openpom_256"], default="morgan", help="Structural embedding block matching the checkpoint's training arm.")
|
| 42 |
parser.add_argument("--output", default="metrics_v6_current.json", help="Metrics JSON output path.")
|
| 43 |
parser.add_argument(
|
| 44 |
"--hf-repo",
|
|
|
|
| 81 |
return digest.hexdigest()
|
| 82 |
|
| 83 |
|
| 84 |
+
def make_validation_dataset(records: list[dict[str, Any]], *, train_ratio: float, seed: int, structural_source: str = "morgan") -> FragranceTrajectoryDataset:
|
| 85 |
split = create_molecule_disjoint_split_from_records(records, train_ratio=train_ratio, seed=seed)
|
| 86 |
genre_map = {genre: idx for idx, genre in enumerate(DEFAULT_GENRES)}
|
| 87 |
return FragranceTrajectoryDataset(
|
| 88 |
records=split["validation"],
|
| 89 |
use_embedding_fallback=True,
|
| 90 |
+
structural_source=structural_source,
|
| 91 |
genre_map=genre_map,
|
| 92 |
)
|
| 93 |
|
|
|
|
| 150 |
heads.eval()
|
| 151 |
|
| 152 |
records = read_records(args.data)
|
| 153 |
+
val_dataset = make_validation_dataset(records, train_ratio=args.train_ratio, seed=args.seed, structural_source=args.structural_source)
|
| 154 |
val_loader = DataLoader(
|
| 155 |
val_dataset,
|
| 156 |
batch_size=args.batch_size,
|