Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 50d8368415 | |||
| 95d5fc6d89 | |||
| b8bd1ec982 | |||
| 70d018982b | |||
| 8d1c29efdd | |||
| 516a8a9ee1 |
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
[tool.bumpversion]
|
[tool.bumpversion]
|
||||||
current_version = "0.3.14"
|
current_version = "0.3.15"
|
||||||
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
|
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
|
||||||
serialize = ["{major}.{minor}.{patch}"]
|
serialize = ["{major}.{minor}.{patch}"]
|
||||||
search = "{current_version}"
|
search = "{current_version}"
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [0.3.15] - 2026-08-28
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Perf: defer heavy imports in giant/dwarf CLIs until commands run
|
||||||
|
|
||||||
## [0.3.14] - 2026-08-28
|
## [0.3.14] - 2026-08-28
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@@ -113,6 +113,8 @@ Secondary energies are a **stick-breaking partition of the `e_sec` budget** from
|
|||||||
|
|
||||||
**v0.3.0 — Stage-2 autoregressive redesign (implemented, released; on `master` since 2026-08-13):** motivated by the 2026-08-03 WGAN rollout benchmark, which failed specifically at the secondary-species level (zero photon secondaries, ~4M hallucinated `-14` muon antineutrinos). Stage 2 became autoregressive in descending-energy order with teacher forcing, and the particle-type representation went back to **categorical** (`particle_type.target = "onehot"`), reversing the 2026-07-17 continuous `(log-mass, charge)` target. The config break (`[conditioning]`/`[stage1_model]`/`[stage2_model]`/`[train]` replacing the flat `train.mode` + `[model]`) makes per-stage generators, stage-2-only training, and one-shot-vs-autoregressive comparison all expressible, and the `network.py` refactor into composable parts (encoder × trunk × objective) also makes routed WGAN work for the first time.
|
**v0.3.0 — Stage-2 autoregressive redesign (implemented, released; on `master` since 2026-08-13):** motivated by the 2026-08-03 WGAN rollout benchmark, which failed specifically at the secondary-species level (zero photon secondaries, ~4M hallucinated `-14` muon antineutrinos). Stage 2 became autoregressive in descending-energy order with teacher forcing, and the particle-type representation went back to **categorical** (`particle_type.target = "onehot"`), reversing the 2026-07-17 continuous `(log-mass, charge)` target. The config break (`[conditioning]`/`[stage1_model]`/`[stage2_model]`/`[train]` replacing the flat `train.mode` + `[model]`) makes per-stage generators, stage-2-only training, and one-shot-vs-autoregressive comparison all expressible, and the `network.py` refactor into composable parts (encoder × trunk × objective) also makes routed WGAN work for the first time.
|
||||||
|
|
||||||
|
**Baseline benchmark (done, 2026-08-26):** `configs/baseline.toml`'s first full rollout-vs-Geant4 validation (`analysis_341dfb14`, checkpoint `20260814_1743_s2-flow_h512_s2h512_bs36864_ep50/best.pt`, epoch 50/50). Confirms the v0.3.0 pivot fixed the species collapse — zero photon secondaries / hallucinated `-14` muon antineutrinos are both gone (γ at 95% of truth, no `-14` in the top species) — and rules out `conditioning.*.type = "physical"` as the cause, since this checkpoint pairs it with `flow`/no-router and still doesn't collapse. Bulk shower observables are close to Geant4 (total deposited energy +1.9%, containment depth-90%/95% both 0.986×), but steps/event now *over*-shoots by 1.32× (the opposite sign from every pre-v0.3.0 checkpoint), no hadronic/nuclear secondaries are produced at all, and event-to-event energy variance is ~16× too narrow. Writeup: `/home/lars/knowledge-base/experiments/giant-baseline-flow-ar-rollout-validation.md`.
|
||||||
|
|
||||||
v0.2 configs and checkpoints are auto-migrated (`config.migrate_config`, `model._legacy._migrate_legacy_model_config`, both drawing on shared facts in `giant/_migration.py`). **v0.2 checkpoint-loading support has no expiry decided yet**: `/ceph` still holds pre-v0.3.0 checkpoints and analysis runs referencing them, so don't delete or substantially alter either migration function or `tests/legacy/network_v02_snapshot.py` (the frozen v0.2 snapshot they're tested against) without an explicit decision to do so first.
|
v0.2 configs and checkpoints are auto-migrated (`config.migrate_config`, `model._legacy._migrate_legacy_model_config`, both drawing on shared facts in `giant/_migration.py`). **v0.2 checkpoint-loading support has no expiry decided yet**: `/ceph` still holds pre-v0.3.0 checkpoints and analysis runs referencing them, so don't delete or substantially alter either migration function or `tests/legacy/network_v02_snapshot.py` (the frozen v0.2 snapshot they're tested against) without an explicit decision to do so first.
|
||||||
|
|
||||||
**Faster-eval architectures — both implemented, neither validated.** Target is a ~10× native-Geant4 eval budget; no eval-latency number exists for any configuration yet, so that budget is unverified across the board.
|
**Faster-eval architectures — both implemented, neither validated.** Target is a ~10× native-Geant4 eval budget; no eval-latency number exists for any configuration yet, so that budget is unverified across the board.
|
||||||
|
|||||||
+15
-5
@@ -29,11 +29,21 @@
|
|||||||
# capacity overfitting is not the binding constraint, and every recent
|
# capacity overfitting is not the binding constraint, and every recent
|
||||||
# run used 0.0.
|
# run used 0.0.
|
||||||
#
|
#
|
||||||
# Known weak spots this baseline is expected to *exhibit* (they are the
|
# Known weak spots, now measured against this exact config rather than
|
||||||
# reason for the comparisons, not a reason to retune this file): every model
|
# extrapolated from the pre-v0.3 field (analysis_341dfb14, best.pt @ epoch
|
||||||
# on record under-produces steps per event by ~2x (rollout ~7e4 vs Geant4
|
# 50/50, full writeup: knowledge-base/experiments/
|
||||||
# ~1.4e5) and secondaries per event by 2-3.5x (~2-3e4 vs 7.2e4), and n_sec
|
# giant-baseline-flow-ar-rollout-validation.md). Unlike every pre-v0.3
|
||||||
# head accuracy sits at 0.863-0.867 regardless of size or objective.
|
# checkpoint (which under-produced steps/event by 1.6-5x), this baseline
|
||||||
|
# OVER-produces steps/event by 1.32x (1.86e5 vs Geant4 1.41e5) and
|
||||||
|
# under-produces secondaries/event by 0.84x (5.97e4 vs 7.14e4) — the sign on
|
||||||
|
# steps flipped with the v0.3 autoregressive pivot, so don't assume it still
|
||||||
|
# undershoots. Secondary-species hallucination (zero photons, hallucinated
|
||||||
|
# `-14` muon antineutrinos) that broke every prior checkpoint is gone; the
|
||||||
|
# remaining species gap is a total absence of hadronic/nuclear secondaries
|
||||||
|
# (protons, neutrons, ion recoils), not miscalibration of the ones produced.
|
||||||
|
# Total deposited energy/event is +1.9% high but its event-to-event spread is
|
||||||
|
# ~16x too narrow (31 MeV vs Geant4's 491 MeV). Per-step deposited energy is
|
||||||
|
# the worst per-step marginal (KS 0.179 vs 0.004-0.071 for the others).
|
||||||
|
|
||||||
[meta]
|
[meta]
|
||||||
# REQUIRED. Without it config.migrate_config reads this file as v0.2 and
|
# REQUIRED. Without it config.migrate_config reads this file as v0.2 and
|
||||||
|
|||||||
+49
-30
@@ -1,21 +1,19 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
import math
|
import math
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import re
|
import re
|
||||||
from typing import Optional
|
from typing import TYPE_CHECKING, Optional
|
||||||
import uuid as uuid_mod
|
import uuid as uuid_mod
|
||||||
|
|
||||||
import numpy as np
|
|
||||||
import yaml
|
|
||||||
import torch
|
|
||||||
import typer
|
import typer
|
||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
|
|
||||||
import pyarrow as pa
|
if TYPE_CHECKING:
|
||||||
import pyarrow.parquet as pq
|
import numpy as np
|
||||||
from tqdm import tqdm
|
|
||||||
|
|
||||||
from giant import config as gconfig
|
from giant import config as gconfig
|
||||||
from giant.constants import (
|
from giant.constants import (
|
||||||
@@ -25,30 +23,11 @@ from giant.constants import (
|
|||||||
PREDICT_SCHEMA_VERSION_KEY,
|
PREDICT_SCHEMA_VERSION_KEY,
|
||||||
ROLLOUT_COORD_VALUE,
|
ROLLOUT_COORD_VALUE,
|
||||||
)
|
)
|
||||||
from giant.data.loader import (
|
|
||||||
event_id_offset,
|
# giant.materials only pulls in numpy (no torch/pandas), and MATERIAL_PROPERTIES
|
||||||
find_parquet_files,
|
# is needed at decoration time below (a Typer option default), so it can't be
|
||||||
iter_file_chunks,
|
# deferred into a command body like the rest of this module's heavy imports.
|
||||||
iter_cond_chunks,
|
|
||||||
)
|
|
||||||
from giant.data.transforms import (
|
|
||||||
build_features,
|
|
||||||
build_cond_features,
|
|
||||||
energy_simplex_decode,
|
|
||||||
inv_local_frame_rotation,
|
|
||||||
inv_log_transform,
|
|
||||||
reconstruct_post_pos,
|
|
||||||
)
|
|
||||||
from giant.checkpoint_io import CheckpointCompatibilityError, load_for_inference
|
|
||||||
from giant.geometry import GeometryOracle
|
|
||||||
from giant.materials import MATERIAL_PROPERTIES
|
from giant.materials import MATERIAL_PROPERTIES
|
||||||
from giant.pipeline import run_train_job
|
|
||||||
from giant.rollout import (
|
|
||||||
L1DistCollector,
|
|
||||||
decode_secondary_identity,
|
|
||||||
rollout as run_rollout,
|
|
||||||
)
|
|
||||||
from giant.sample import resolve_n_sec, sample_stage1, sample_stage2
|
|
||||||
|
|
||||||
app = typer.Typer(no_args_is_help=True)
|
app = typer.Typer(no_args_is_help=True)
|
||||||
|
|
||||||
@@ -210,6 +189,8 @@ def _write_prediction_ref(
|
|||||||
comment: str | None = None,
|
comment: str | None = None,
|
||||||
) -> Path:
|
) -> Path:
|
||||||
"""Write a YAML sidecar in the checkpoint directory and return its path."""
|
"""Write a YAML sidecar in the checkpoint directory and return its path."""
|
||||||
|
import yaml
|
||||||
|
|
||||||
ref = {
|
ref = {
|
||||||
"prediction_id": pred_uuid,
|
"prediction_id": pred_uuid,
|
||||||
"output": str(out),
|
"output": str(out),
|
||||||
@@ -639,6 +620,10 @@ def train(
|
|||||||
] = None,
|
] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Train the GIANT surrogate model."""
|
"""Train the GIANT surrogate model."""
|
||||||
|
import torch
|
||||||
|
|
||||||
|
from giant.pipeline import run_train_job
|
||||||
|
|
||||||
batch_size_auto = False
|
batch_size_auto = False
|
||||||
batch_size_value: Optional[int] = None
|
batch_size_value: Optional[int] = None
|
||||||
if batch_size is not None:
|
if batch_size is not None:
|
||||||
@@ -1048,6 +1033,25 @@ def predict(
|
|||||||
] = None,
|
] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Run trained model on a parquet file and save predictions."""
|
"""Run trained model on a parquet file and save predictions."""
|
||||||
|
import numpy as np
|
||||||
|
import pyarrow as pa
|
||||||
|
import pyarrow.parquet as pq
|
||||||
|
import torch
|
||||||
|
from tqdm import tqdm
|
||||||
|
|
||||||
|
from giant.checkpoint_io import CheckpointCompatibilityError, load_for_inference
|
||||||
|
from giant.data.loader import event_id_offset, find_parquet_files, iter_cond_chunks, iter_file_chunks
|
||||||
|
from giant.data.transforms import (
|
||||||
|
build_cond_features,
|
||||||
|
build_features,
|
||||||
|
energy_simplex_decode,
|
||||||
|
inv_local_frame_rotation,
|
||||||
|
inv_log_transform,
|
||||||
|
reconstruct_post_pos,
|
||||||
|
)
|
||||||
|
from giant.rollout import decode_secondary_identity
|
||||||
|
from giant.sample import resolve_n_sec, sample_stage1, sample_stage2
|
||||||
|
|
||||||
batch_size_auto = False
|
batch_size_auto = False
|
||||||
batch_size_value: Optional[int] = None
|
batch_size_value: Optional[int] = None
|
||||||
if batch_size.strip().lower() == "auto":
|
if batch_size.strip().lower() == "auto":
|
||||||
@@ -1343,6 +1347,10 @@ def _seed_from_data(files: list[Path], n_events: int | None) -> dict[str, np.nda
|
|||||||
the codebase's convention for the primary (a secondary always carries less
|
the codebase's convention for the primary (a secondary always carries less
|
||||||
energy than its parent). See giant/analysis/reduce.py:entry_axis.
|
energy than its parent). See giant/analysis/reduce.py:entry_axis.
|
||||||
"""
|
"""
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
from giant.data.loader import event_id_offset, iter_cond_chunks
|
||||||
|
|
||||||
best_E: dict[int, float] = {}
|
best_E: dict[int, float] = {}
|
||||||
best: dict[int, tuple] = {}
|
best: dict[int, tuple] = {}
|
||||||
for file_idx, path in enumerate(files):
|
for file_idx, path in enumerate(files):
|
||||||
@@ -1447,6 +1455,17 @@ def rollout(
|
|||||||
] = None,
|
] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Roll the surrogate forward into full showers (autoregressive)."""
|
"""Roll the surrogate forward into full showers (autoregressive)."""
|
||||||
|
import numpy as np
|
||||||
|
import pyarrow as pa
|
||||||
|
import pyarrow.parquet as pq
|
||||||
|
import torch
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
from giant.checkpoint_io import CheckpointCompatibilityError, load_for_inference
|
||||||
|
from giant.data.loader import find_parquet_files
|
||||||
|
from giant.geometry import GeometryOracle
|
||||||
|
from giant.rollout import L1DistCollector, rollout as run_rollout
|
||||||
|
|
||||||
if seed is not None:
|
if seed is not None:
|
||||||
torch.manual_seed(seed)
|
torch.manual_seed(seed)
|
||||||
np.random.seed(seed)
|
np.random.seed(seed)
|
||||||
|
|||||||
+17
-4
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
import difflib
|
import difflib
|
||||||
import hashlib
|
import hashlib
|
||||||
@@ -10,12 +12,12 @@ from dataclasses import dataclass, field
|
|||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
import numpy as np
|
|
||||||
import torch
|
|
||||||
|
|
||||||
from giant._migration import V02_FIXED_FACTS, V02_MODEL_KEY_TO_STAGES, reject_legacy_router_expert_sizing
|
from giant._migration import V02_FIXED_FACTS, V02_MODEL_KEY_TO_STAGES, reject_legacy_router_expert_sizing
|
||||||
from giant.model.history import HISTORY_REGISTRY
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
import torch
|
||||||
|
|
||||||
|
|
||||||
class Conditioning(str, Enum):
|
class Conditioning(str, Enum):
|
||||||
@@ -941,6 +943,8 @@ def git_hash() -> str:
|
|||||||
|
|
||||||
|
|
||||||
def auto_device() -> torch.device:
|
def auto_device() -> torch.device:
|
||||||
|
import torch
|
||||||
|
|
||||||
if torch.cuda.is_available():
|
if torch.cuda.is_available():
|
||||||
return torch.device("cuda")
|
return torch.device("cuda")
|
||||||
if torch.backends.mps.is_available():
|
if torch.backends.mps.is_available():
|
||||||
@@ -986,6 +990,8 @@ def estimate_batch_size(
|
|||||||
inference (e.g. `predict`), which uses a much lower per-sample memory
|
inference (e.g. `predict`), which uses a much lower per-sample memory
|
||||||
calibration since there's no backward graph or optimizer state.
|
calibration since there's no backward graph or optimizer state.
|
||||||
"""
|
"""
|
||||||
|
import torch
|
||||||
|
|
||||||
if device.type != "cuda":
|
if device.type != "cuda":
|
||||||
raise ValueError(f"--batch-size auto is only supported on cuda devices, got {device.type!r}")
|
raise ValueError(f"--batch-size auto is only supported on cuda devices, got {device.type!r}")
|
||||||
device_index = device.index if device.index is not None else torch.cuda.current_device()
|
device_index = device.index if device.index is not None else torch.cuda.current_device()
|
||||||
@@ -1680,6 +1686,8 @@ def validate_config(cfg: dict, *, resume: bool = False) -> None:
|
|||||||
"'energy_desc' (the only implemented ordering; see "
|
"'energy_desc' (the only implemented ordering; see "
|
||||||
"AutoregressiveConfig.order's docstring)"
|
"AutoregressiveConfig.order's docstring)"
|
||||||
)
|
)
|
||||||
|
from giant.model.history import HISTORY_REGISTRY
|
||||||
|
|
||||||
history = _get_path(cfg, "stage2_model.autoregressive.history")
|
history = _get_path(cfg, "stage2_model.autoregressive.history")
|
||||||
if history not in HISTORY_REGISTRY:
|
if history not in HISTORY_REGISTRY:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
@@ -1881,6 +1889,9 @@ def resolve_default_out_dir(cfg: dict, base: Path = Path("checkpoints")) -> Path
|
|||||||
|
|
||||||
|
|
||||||
def seed_everything(seed: int) -> None:
|
def seed_everything(seed: int) -> None:
|
||||||
|
import numpy as np
|
||||||
|
import torch
|
||||||
|
|
||||||
random.seed(seed)
|
random.seed(seed)
|
||||||
np.random.seed(seed)
|
np.random.seed(seed)
|
||||||
torch.manual_seed(seed)
|
torch.manual_seed(seed)
|
||||||
@@ -1934,6 +1945,8 @@ def build_run_meta(
|
|||||||
n_val_events: int,
|
n_val_events: int,
|
||||||
n_train_steps: int,
|
n_train_steps: int,
|
||||||
) -> dict:
|
) -> dict:
|
||||||
|
import torch
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"config_version": CONFIG_VERSION,
|
"config_version": CONFIG_VERSION,
|
||||||
"git_hash": git_hash(),
|
"git_hash": git_hash(),
|
||||||
|
|||||||
+34
-14
@@ -5,6 +5,8 @@ simulation-fanout tools into one Typer app so there's a single command name
|
|||||||
(and `--help`) to remember instead of five differently-hyphenated ones.
|
(and `--help`) to remember instead of five differently-hyphenated ones.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -14,20 +16,15 @@ import typer
|
|||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
|
|
||||||
from giant.config import Conditioning
|
from giant.config import Conditioning
|
||||||
from giant.tools.bump_dataset_version import (
|
|
||||||
run_bump_gen,
|
# DATA_DEFAULT/SCAN_DIR_DEFAULT are Typer option defaults (evaluated at
|
||||||
run_bump_schema,
|
# decoration time below), so that one name has to stay eager — the module
|
||||||
run_create_manifest,
|
# itself is stdlib-only, so it costs nothing. Every other giant.tools.*
|
||||||
run_status,
|
# import here is deferred into the one command body that uses it, since
|
||||||
run_update_manifest,
|
# several (steps_to_parquet: uproot/awkward/polars; warm_setup_cache:
|
||||||
)
|
# giant.pipeline -> torch; geometry_oracle: pandas) are expensive and
|
||||||
from giant.tools.create_root_files import run_make_root
|
# `dwarf --help`/tab-completion shouldn't pay for all of them upfront.
|
||||||
from giant.tools.geometry_oracle import run_build_geometry_oracle
|
from giant.tools.hparam_scan import DATA_DEFAULT, SCAN_DIR_DEFAULT
|
||||||
from giant.tools.hparam_scan import DATA_DEFAULT, SCAN_DIR_DEFAULT, run_hparam_scan
|
|
||||||
from giant.tools.migrate_geant_steps import run_migration
|
|
||||||
from giant.tools.steps_to_parquet import convert_steps_to_parquet
|
|
||||||
from giant.tools.steps_to_parquet_parallel import run_parallel_job
|
|
||||||
from giant.tools.warm_setup_cache import run_warm_setup_cache
|
|
||||||
|
|
||||||
app = typer.Typer(no_args_is_help=True)
|
app = typer.Typer(no_args_is_help=True)
|
||||||
|
|
||||||
@@ -121,6 +118,9 @@ def convert(
|
|||||||
] = None,
|
] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Convert ROOT Steps tree(s) to Parquet."""
|
"""Convert ROOT Steps tree(s) to Parquet."""
|
||||||
|
from giant.tools.steps_to_parquet import convert_steps_to_parquet
|
||||||
|
from giant.tools.steps_to_parquet_parallel import run_parallel_job
|
||||||
|
|
||||||
if jobs < 1:
|
if jobs < 1:
|
||||||
typer.echo("error: --jobs must be >= 1", err=True)
|
typer.echo("error: --jobs must be >= 1", err=True)
|
||||||
raise typer.Exit(1)
|
raise typer.Exit(1)
|
||||||
@@ -183,6 +183,8 @@ def migrate(
|
|||||||
] = False,
|
] = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""One-time migration into the versioned raw/processed/pools/derived layout."""
|
"""One-time migration into the versioned raw/processed/pools/derived layout."""
|
||||||
|
from giant.tools.migrate_geant_steps import run_migration
|
||||||
|
|
||||||
run_migration(str(root), execute=execute, copy=copy)
|
run_migration(str(root), execute=execute, copy=copy)
|
||||||
|
|
||||||
|
|
||||||
@@ -207,6 +209,8 @@ def bump_gen(
|
|||||||
root: Annotated[Path, typer.Option("--root", help="Dataset root")] = _DATASET_ROOT_DEFAULT,
|
root: Annotated[Path, typer.Option("--root", help="Dataset root")] = _DATASET_ROOT_DEFAULT,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Cut a new raw generation."""
|
"""Cut a new raw generation."""
|
||||||
|
from giant.tools.bump_dataset_version import run_bump_gen
|
||||||
|
|
||||||
run_bump_gen(
|
run_bump_gen(
|
||||||
kind=kind,
|
kind=kind,
|
||||||
reason=reason,
|
reason=reason,
|
||||||
@@ -240,6 +244,8 @@ def bump_schema(
|
|||||||
root: Annotated[Path, typer.Option("--root", help="Dataset root")] = _DATASET_ROOT_DEFAULT,
|
root: Annotated[Path, typer.Option("--root", help="Dataset root")] = _DATASET_ROOT_DEFAULT,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Cut a new schema within a gen."""
|
"""Cut a new schema within a gen."""
|
||||||
|
from giant.tools.bump_dataset_version import run_bump_schema
|
||||||
|
|
||||||
run_bump_schema(
|
run_bump_schema(
|
||||||
kind=kind,
|
kind=kind,
|
||||||
gen=gen,
|
gen=gen,
|
||||||
@@ -257,6 +263,8 @@ def status(
|
|||||||
root: Annotated[Path, typer.Option("--root", help="Dataset root")] = _DATASET_ROOT_DEFAULT,
|
root: Annotated[Path, typer.Option("--root", help="Dataset root")] = _DATASET_ROOT_DEFAULT,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""List existing gens/schemas per kind."""
|
"""List existing gens/schemas per kind."""
|
||||||
|
from giant.tools.bump_dataset_version import run_status
|
||||||
|
|
||||||
run_status(str(root))
|
run_status(str(root))
|
||||||
|
|
||||||
|
|
||||||
@@ -281,6 +289,8 @@ def update_manifest(
|
|||||||
] = False,
|
] = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Repoint manifest(s) to a new gen and/or schema, verifying all target files exist."""
|
"""Repoint manifest(s) to a new gen and/or schema, verifying all target files exist."""
|
||||||
|
from giant.tools.bump_dataset_version import run_update_manifest
|
||||||
|
|
||||||
run_update_manifest([str(m) for m in manifests], schema=schema, execute=execute, gen=gen)
|
run_update_manifest([str(m) for m in manifests], schema=schema, execute=execute, gen=gen)
|
||||||
|
|
||||||
|
|
||||||
@@ -311,6 +321,8 @@ def create_manifest(
|
|||||||
] = False,
|
] = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Create a new manifest from a list of parquet files."""
|
"""Create a new manifest from a list of parquet files."""
|
||||||
|
from giant.tools.bump_dataset_version import run_create_manifest
|
||||||
|
|
||||||
run_create_manifest(
|
run_create_manifest(
|
||||||
[str(f) for f in files],
|
[str(f) for f in files],
|
||||||
execute=execute,
|
execute=execute,
|
||||||
@@ -358,6 +370,8 @@ def make_root(
|
|||||||
] = False,
|
] = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Generate new ROOT shards via a minicalosim executable."""
|
"""Generate new ROOT shards via a minicalosim executable."""
|
||||||
|
from giant.tools.create_root_files import run_make_root
|
||||||
|
|
||||||
_warn_if_exceeds_shared_quota(jobs, "--jobs")
|
_warn_if_exceeds_shared_quota(jobs, "--jobs")
|
||||||
run_make_root(
|
run_make_root(
|
||||||
executable=executable,
|
executable=executable,
|
||||||
@@ -423,6 +437,8 @@ def build_geometry_oracle(
|
|||||||
] = 2000,
|
] = 2000,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Fit a position -> (material, layer_id) oracle for `giant rollout`."""
|
"""Fit a position -> (material, layer_id) oracle for `giant rollout`."""
|
||||||
|
from giant.tools.geometry_oracle import run_build_geometry_oracle
|
||||||
|
|
||||||
run_build_geometry_oracle(
|
run_build_geometry_oracle(
|
||||||
data=data,
|
data=data,
|
||||||
out=out,
|
out=out,
|
||||||
@@ -515,6 +531,8 @@ def warm_cache(
|
|||||||
such entry across every run) skips straight to training. See
|
such entry across every run) skips straight to training. See
|
||||||
giant/data/setup_cache.py.
|
giant/data/setup_cache.py.
|
||||||
"""
|
"""
|
||||||
|
from giant.tools.warm_setup_cache import run_warm_setup_cache
|
||||||
|
|
||||||
flag_overrides = {
|
flag_overrides = {
|
||||||
"--val-fraction": val_fraction,
|
"--val-fraction": val_fraction,
|
||||||
"--seed": seed,
|
"--seed": seed,
|
||||||
@@ -557,6 +575,8 @@ def hparam_scan(
|
|||||||
dry_run: Annotated[bool, typer.Option("--dry-run")] = False,
|
dry_run: Annotated[bool, typer.Option("--dry-run")] = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Grid-scan dropout x n_blocks x hidden_dim via sequential `giant train` runs."""
|
"""Grid-scan dropout x n_blocks x hidden_dim via sequential `giant train` runs."""
|
||||||
|
from giant.tools.hparam_scan import run_hparam_scan
|
||||||
|
|
||||||
run_hparam_scan(data=data, scan_dir=scan_dir, seed=seed, dry_run=dry_run)
|
run_hparam_scan(data=data, scan_dir=scan_dir, seed=seed, dry_run=dry_run)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "giant"
|
name = "giant"
|
||||||
version = "0.3.14"
|
version = "0.3.15"
|
||||||
description = "Geant4 step-function surrogate via conditional flow matching"
|
description = "Geant4 step-function surrogate via conditional flow matching"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.12"
|
requires-python = ">=3.12"
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ def _invoke_and_capture_cfg(monkeypatch, tmp_path: Path, args: list[str]) -> dic
|
|||||||
def _fake_run_train_job(*, data, cfg, out_dir, **kwargs):
|
def _fake_run_train_job(*, data, cfg, out_dir, **kwargs):
|
||||||
captured["cfg"] = cfg
|
captured["cfg"] = cfg
|
||||||
|
|
||||||
monkeypatch.setattr(cli, "run_train_job", _fake_run_train_job)
|
monkeypatch.setattr("giant.pipeline.run_train_job", _fake_run_train_job)
|
||||||
|
|
||||||
result = runner.invoke(
|
result = runner.invoke(
|
||||||
cli.app,
|
cli.app,
|
||||||
@@ -125,7 +125,7 @@ def test_stage2_init_from_and_freeze_flags_land_in_cfg_and_dont_touch_stage1(mon
|
|||||||
|
|
||||||
|
|
||||||
def test_batch_size_invalid_string_errors(monkeypatch, tmp_path):
|
def test_batch_size_invalid_string_errors(monkeypatch, tmp_path):
|
||||||
monkeypatch.setattr(cli, "run_train_job", lambda *a, **kw: None)
|
monkeypatch.setattr("giant.pipeline.run_train_job", lambda *a, **kw: None)
|
||||||
result = runner.invoke(
|
result = runner.invoke(
|
||||||
cli.app,
|
cli.app,
|
||||||
["train", "dummy.parquet", "--out", str(tmp_path / "run"), "--batch-size", "not-a-number"],
|
["train", "dummy.parquet", "--out", str(tmp_path / "run"), "--batch-size", "not-a-number"],
|
||||||
@@ -140,7 +140,7 @@ def test_out_dir_resolution_prefers_explicit_out_over_resume(monkeypatch, tmp_pa
|
|||||||
def _fake_run_train_job(*, data, cfg, out_dir, **kwargs):
|
def _fake_run_train_job(*, data, cfg, out_dir, **kwargs):
|
||||||
captured["out_dir"] = out_dir
|
captured["out_dir"] = out_dir
|
||||||
|
|
||||||
monkeypatch.setattr(cli, "run_train_job", _fake_run_train_job)
|
monkeypatch.setattr("giant.pipeline.run_train_job", _fake_run_train_job)
|
||||||
|
|
||||||
resume_dir = tmp_path / "resumed_run"
|
resume_dir = tmp_path / "resumed_run"
|
||||||
resume_dir.mkdir()
|
resume_dir.mkdir()
|
||||||
@@ -161,7 +161,7 @@ def test_out_dir_resolution_falls_back_to_resume_parent(monkeypatch, tmp_path):
|
|||||||
def _fake_run_train_job(*, data, cfg, out_dir, **kwargs):
|
def _fake_run_train_job(*, data, cfg, out_dir, **kwargs):
|
||||||
captured["out_dir"] = out_dir
|
captured["out_dir"] = out_dir
|
||||||
|
|
||||||
monkeypatch.setattr(cli, "run_train_job", _fake_run_train_job)
|
monkeypatch.setattr("giant.pipeline.run_train_job", _fake_run_train_job)
|
||||||
|
|
||||||
resume_dir = tmp_path / "resumed_run"
|
resume_dir = tmp_path / "resumed_run"
|
||||||
resume_dir.mkdir()
|
resume_dir.mkdir()
|
||||||
@@ -178,7 +178,7 @@ def test_out_dir_resolution_defaults_when_neither_out_nor_resume_given(monkeypat
|
|||||||
def _fake_run_train_job(*, data, cfg, out_dir, **kwargs):
|
def _fake_run_train_job(*, data, cfg, out_dir, **kwargs):
|
||||||
captured["out_dir"] = out_dir
|
captured["out_dir"] = out_dir
|
||||||
|
|
||||||
monkeypatch.setattr(cli, "run_train_job", _fake_run_train_job)
|
monkeypatch.setattr("giant.pipeline.run_train_job", _fake_run_train_job)
|
||||||
monkeypatch.chdir(tmp_path)
|
monkeypatch.chdir(tmp_path)
|
||||||
|
|
||||||
result = runner.invoke(cli.app, ["train", "dummy.parquet"])
|
result = runner.invoke(cli.app, ["train", "dummy.parquet"])
|
||||||
@@ -192,7 +192,7 @@ def test_batch_size_auto_estimates_and_echoes(monkeypatch, tmp_path):
|
|||||||
def _fake_run_train_job(*, data, cfg, out_dir, num_workers, **kwargs):
|
def _fake_run_train_job(*, data, cfg, out_dir, num_workers, **kwargs):
|
||||||
captured["batch_size"] = cfg["train"]["batch_size"]
|
captured["batch_size"] = cfg["train"]["batch_size"]
|
||||||
|
|
||||||
monkeypatch.setattr(cli, "run_train_job", _fake_run_train_job)
|
monkeypatch.setattr("giant.pipeline.run_train_job", _fake_run_train_job)
|
||||||
monkeypatch.setattr(cli.gconfig, "estimate_batch_size", lambda hidden_dim, n_blocks, device: 123)
|
monkeypatch.setattr(cli.gconfig, "estimate_batch_size", lambda hidden_dim, n_blocks, device: 123)
|
||||||
|
|
||||||
result = runner.invoke(
|
result = runner.invoke(
|
||||||
|
|||||||
Reference in New Issue
Block a user