blob: 026eb016fc0d158e05846d55d570826ca94a558f (
plain)
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
38
39
40
41
42
43
44
45
|
#!/usr/bin/env python3
"""Static smoke checks for the frozen B1 registry and author patch."""
import json
from pathlib import Path
import sys
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT / "experiments"))
from contrastive_bias_b1 import BIAS_PATCH, bias_cells, jobs, registry_sha256
def main():
rows = jobs("/frozen/author/python")
cells = bias_cells()
assert len(rows) == len(cells) == 17
assert sum(row["kind"] == "common" for row in rows) == 1
assert sum(row["kind"] == "fixed" for row in rows) == 6
assert sum(row["kind"] == "activity" for row in rows) == 9
assert sum(row["rule"] == "innovation" for row in rows) == 5
for row in rows:
command = row["command"]
assert command[0] == "/frozen/author/python"
assert command[command.index("--seeds") + 1] == "1988"
assert command[command.index("--test-policy") + 1] == "none"
assert command[command.index("--num-epochs") + 1] == "20"
assert command[command.index("--model") + 1] == "miniCNN"
if row["rule"] == "none":
assert "--dp-bias-rule" not in command
else:
assert command[command.index("--dp-bias-rule") + 1] == row["rule"]
patch = BIAS_PATCH.read_text(encoding="utf-8")
for token in (
"create_dp_bias_auxiliary", "dp_bias_differences",
"train_dp_bias_epoch", "instruction_observations_for_predictor",
):
assert token in patch
print(json.dumps({
"status": "passed", "num_cells": len(rows),
"registry_sha256": registry_sha256(rows),
}, indent=2, sort_keys=True))
if __name__ == "__main__":
main()
|