v0.3.0 post-implementation audit: resolve all 9 tracked discrepancies
CI / Lint (ruff check) (push) Successful in 27s
CI / Format (ruff format) (push) Successful in 28s
CI / Sync project version with tag (push) Has been skipped
CI / Lint (ruff check) (pull_request) Successful in 36s
CI / Type check (ty) (push) Successful in 39s
CI / Format (ruff format) (pull_request) Successful in 30s
CI / Sync project version with tag (pull_request) Has been skipped
CI / Type check (ty) (pull_request) Successful in 30s
CI / Tests (pull_request) Successful in 2m50s
CI / Tests (push) Successful in 2m58s

Works through docs/v0.3.0-followups.md item by item, closing the gap
between the design doc and the shipped v0.3.0-stage2-autoregressive code:

1. validate.py: 7-tuple batch unpacking, sample_stage1/sample_stage2
   dispatch, stage-2 particle-type-class marginal.
2. Stage-prefixed --stage1-*/--stage2-* CLI flags for train/new-run.
3. Thread stage2_model.k_max through loader/transforms/dataset/pipeline/
   train instead of the hardcoded K_MAX constant.
4. Mixed conditioning.particle.type / conditioning.material.type support
   end-to-end (data pipeline + dwarf warm-cache).
5. conditioning.share_stages = true: one shared ConditionEncoder instance
   across both stages.
6. stage2_model.generator = "ddpm" formally deferred into design doc §11.2
   (was silently unimplemented).
7. giant predict/rollout: implement conditioning.*.type = "onehot" via the
   checkpoint's saved pdg_topn_map/mat_topn_map.
8. network.py's checkpoint-path model_config migration now fails loudly on
   non-zero legacy expert_hidden_dim/expert_n_blocks, matching config.py's
   TOML-load path (§4.2).
9. validate_config now rejects stage2_model.n_sec.mode = "truth" for a
   rollout-capable checkpoint (§9).

Also cleared all pre-existing `ty check` noise (44 -> 0 diagnostics),
mostly a test-helper dict-unpack pattern that made every unrelated
constructor keyword look like a type error.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-07 16:12:58 +02:00
co-authored by Claude Sonnet 5
parent 200c6d243b
commit da7cde3ef9
31 changed files with 1536 additions and 499 deletions
+50 -9
View File
@@ -584,21 +584,19 @@ def test_validate_config_embedding_target_passes_with_embedding_conditioning():
gconfig.validate_config(cfg) # must not raise
def test_validate_config_mixed_particle_material_conditioning_not_supported():
"""The data pipeline doesn't support mixed conditioning types yet, even
though ConditionEncoder itself already can (docs/v0.3.0-design.md §3.1
vs. giant/data/transforms.py's still-single conditioning param)."""
def test_validate_config_mixed_particle_material_conditioning_is_valid():
"""docs/v0.3.0-design.md §3.1: the particle and material conditioning
axes are configured independently and may mix freely — e.g. material
"physical" with particle "embedding" — and the data pipeline
(giant/data/transforms.py) now implements that end-to-end, so
validate_config must not reject it."""
cfg = _cfg_with(
**{
"conditioning.particle.type": "physical",
"conditioning.material.type": "embedding",
}
)
try:
gconfig.validate_config(cfg)
assert False, "expected ValueError"
except ValueError as e:
assert "mixed" in str(e) or "conditioning.material.type" in str(e)
gconfig.validate_config(cfg) # must not raise
def test_validate_config_pdg_router_incompatible_with_physical_conditioning():
@@ -639,6 +637,49 @@ def test_validate_config_stop_token_not_implemented():
assert "stop_token" in str(e)
def test_validate_config_n_sec_truth_rejected_for_rollout_capable_checkpoint():
"""docs/v0.3.0-design.md §9: 'n_sec.mode = "truth" is invalid for a
rollout-capable checkpoint' — both stages active means giant rollout
could load this checkpoint, but 'truth' has no ground truth to draw
n_sec from at rollout time."""
cfg = _cfg_with(
**{
"stage2_model.n_sec.mode": "truth",
"stage1_model.active": True,
"stage2_model.active": True,
}
)
try:
gconfig.validate_config(cfg)
assert False, "expected ValueError"
except ValueError as e:
assert "n_sec.mode" in str(e) and "truth" in str(e)
def test_validate_config_n_sec_truth_allowed_for_stage2_only_checkpoint():
"""'truth' is exactly the standalone stage-2 evaluation mode the design
doc carves out — stage1_model.active = false must still pass."""
cfg = _cfg_with(
**{
"stage2_model.n_sec.mode": "truth",
"stage1_model.active": False,
"stage2_model.active": True,
}
)
gconfig.validate_config(cfg) # must not raise
def test_validate_config_n_sec_truth_allowed_when_stage2_inactive():
cfg = _cfg_with(
**{
"stage2_model.n_sec.mode": "truth",
"stage1_model.active": True,
"stage2_model.active": False,
}
)
gconfig.validate_config(cfg) # must not raise
def test_validate_config_ar_default_markov_always_passes():
"""DEFAULT_CONFIG already has decoder='autoregressive',
history='markov', teacher_forcing='always' — must not raise (v0.3.0