v0.3.0 step 6: sample.py/rollout.py AR generation + class->PDG decode
CI / Format (ruff format) (push) Successful in 36s
CI / Lint (ruff check) (push) Successful in 38s
CI / Sync project version with tag (push) Has been skipped
CI / Type check (ty) (push) Failing after 45s
CI / Lint (ruff check) (pull_request) Successful in 41s
CI / Tests (push) Has been skipped
CI / Format (ruff format) (pull_request) Successful in 35s
CI / Sync project version with tag (pull_request) Has been skipped
CI / Type check (ty) (pull_request) Failing after 37s
CI / Tests (pull_request) Has been skipped
CI / Format (ruff format) (push) Successful in 36s
CI / Lint (ruff check) (push) Successful in 38s
CI / Sync project version with tag (push) Has been skipped
CI / Type check (ty) (push) Failing after 45s
CI / Lint (ruff check) (pull_request) Successful in 41s
CI / Tests (push) Has been skipped
CI / Format (ruff format) (pull_request) Successful in 35s
CI / Sync project version with tag (pull_request) Has been skipped
CI / Type check (ty) (pull_request) Failing after 37s
CI / Tests (pull_request) Has been skipped
- giant/sample.py: fix every sampler's call convention against
Stage1Model/Stage2OneShot's actual forward signatures (was still
calling model(x, t, cond_cont, cond_cat) positionally); add
sample_secondaries_ar (free-running AR loop, unsnapped history feature)
and sample_stage1/sample_stage2/resolve_n_sec dispatch helpers that read
each stage's generator_kind/decoder off the model instance itself.
- giant/particles.py: decode_topn_class (argmax + other_policy) and
decode_embedding_nearest (L1-snap + distance) turn a secondary's
"onehot"/"embedding" type prediction into a concrete PDG.
- giant/rollout.py: decode_secondary_identity routes all three
particle_type.target values to real mass/charge; per-stage generator
dispatch (drops the single shared `mode` string, adds ddpm support);
L1DistCollector accumulates the §11.3 embedding-distance diagnostic.
- giant/cli.py: drop the onehot/embedding-target rejection gate (narrowed
to the still-unimplemented conditioning.particle/material.type=onehot
axis); fix the dead model_cfg.get("mode") bug in predict/rollout.
- giant/analysis/: new type_embedding_l1_distance PlotSpec, wired through
the rollout YAML sidecar (no live-model call needed, unlike
router_gating -- the histogram is already pre-aggregated at rollout
time).
- Un-xfail every test that was blocked on this step (test_rollout.py,
test_flow.py, test_wgan.py, test_phase2.py, test_router.py,
test_validate.py); add test_sample.py, test_type_embedding_distance.py.
Known follow-up: giant/validate.py still unpacks the training val-batch
as a stale 6-tuple and doesn't use the new per-stage dispatch, so
marginal validation during training degrades gracefully with a warning
rather than working -- not in this step's scope.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+19
-18
@@ -6,14 +6,14 @@ import yaml
|
||||
|
||||
from giant.cli import (
|
||||
_CEPH_PREDICTIONS,
|
||||
_check_v030_onehot_support,
|
||||
_check_conditioning_onehot_support,
|
||||
_resolve_prediction_output,
|
||||
_write_prediction_ref,
|
||||
)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# _check_v030_onehot_support
|
||||
# _check_conditioning_onehot_support
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -29,42 +29,43 @@ def _nested_model_cfg(
|
||||
}
|
||||
|
||||
|
||||
def test_check_v030_onehot_support_allows_physical():
|
||||
_check_v030_onehot_support(_nested_model_cfg(), "predict") # no raise
|
||||
def test_check_conditioning_onehot_support_allows_physical():
|
||||
_check_conditioning_onehot_support(_nested_model_cfg(), "predict") # no raise
|
||||
|
||||
|
||||
def test_check_v030_onehot_support_rejects_onehot_particle_conditioning():
|
||||
def test_check_conditioning_onehot_support_rejects_onehot_particle_conditioning():
|
||||
cfg = _nested_model_cfg(particle_type="onehot")
|
||||
with pytest.raises(typer.Exit):
|
||||
_check_v030_onehot_support(cfg, "predict")
|
||||
_check_conditioning_onehot_support(cfg, "predict")
|
||||
|
||||
|
||||
def test_check_v030_onehot_support_rejects_onehot_material_conditioning():
|
||||
def test_check_conditioning_onehot_support_rejects_onehot_material_conditioning():
|
||||
cfg = _nested_model_cfg(material_type="onehot")
|
||||
with pytest.raises(typer.Exit):
|
||||
_check_v030_onehot_support(cfg, "rollout")
|
||||
_check_conditioning_onehot_support(cfg, "rollout")
|
||||
|
||||
|
||||
def test_check_v030_onehot_support_rejects_onehot_particle_type_target():
|
||||
def test_check_conditioning_onehot_support_allows_onehot_particle_type_target():
|
||||
"""stage2_model.particle_type.target="onehot" is implemented (v0.3.0
|
||||
step 6, giant.rollout.decode_secondary_identity) — it's a separate axis
|
||||
from conditioning.particle.type, which this guard doesn't gate at all."""
|
||||
cfg = _nested_model_cfg(target="onehot")
|
||||
with pytest.raises(typer.Exit):
|
||||
_check_v030_onehot_support(cfg, "predict")
|
||||
_check_conditioning_onehot_support(cfg, "predict") # no raise
|
||||
|
||||
|
||||
def test_check_v030_onehot_support_rejects_embedding_particle_type_target():
|
||||
def test_check_conditioning_onehot_support_allows_embedding_particle_type_target():
|
||||
cfg = _nested_model_cfg(
|
||||
particle_type="embedding", material_type="embedding", target="embedding"
|
||||
)
|
||||
with pytest.raises(typer.Exit):
|
||||
_check_v030_onehot_support(cfg, "predict")
|
||||
_check_conditioning_onehot_support(cfg, "predict") # no raise
|
||||
|
||||
|
||||
def test_check_v030_onehot_support_is_noop_for_v02_flat_model_config():
|
||||
def test_check_conditioning_onehot_support_is_noop_for_v02_flat_model_config():
|
||||
"""A v0.2 checkpoint's flat model_config has conditioning as a plain
|
||||
string, not a dict — never onehot/embedding-target, so this must be a
|
||||
silent no-op rather than crash on `.get("particle")` against a string."""
|
||||
string, not a dict — never onehot, so this must be a silent no-op rather
|
||||
than crash on `.get("particle")` against a string."""
|
||||
cfg = {"conditioning": "embedding", "mode": "flow"}
|
||||
_check_v030_onehot_support(cfg, "predict") # no raise
|
||||
_check_conditioning_onehot_support(cfg, "predict") # no raise
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user