Record verified GINO starts, separate follow-up bindings, and audited 1b screen

This commit is contained in:
NewMeltAssist committed 2026-11-19 16:30:26 +08:00
1 parent ae873999f0
commit db87b0f54b
30 files changed
+3861

No files matched your search

+108
View File
@@ -0,0 +1,108 @@
"""Prepare a grouped two-fold GINO-Greif entry from frozen H2 metadata."""
import argparse
import json
import math
from pathlib import Path
import track_b_gino_formal as reference
from track_b_gino_shapenet_entry import BASE, checked, read, save, sha
ROOT = BASE / 'artifacts/track-b-gino-greif-preparation-2026-11-19'
STATUS = 'PREPARED_PENDING_ADAPTER_REVIEW_TIMING_AND_PHASE_PROJECTION'
PILOT = BASE / 'artifacts/phase2-h2-pilot-2026-11-17/contract.json'
QUERY = Path('/home/frank14f/MeltMind-runs/phase2-h2-s2-postfit-2026-11-17/contract.json')
PHASE_TERMINAL = BASE / 'artifacts/phase3-item1b-fold0-labelled-recovery-2026-11-19/complete.json'
PINS = {
str(PILOT): '9f616974fb01f8f5cab6233273d541b3e53f5975f3632db45ab4676f911fba7b',
str(QUERY): '0bd03f42c3b2db5bef26708b2ef873edfe674f724b59bc4b4de8641980d8d330',
str(PHASE_TERMINAL): '631a4c679d94466af71ff79e72cb3066c073eaa7d68030805419ff28a74b476e',
}
ROLES = ('learning', 'validation', 'test')
CAP = 200 * 3600
def grouped_folds(pilot, query):
included = {row['case']: row for row in query['rows'] if row['included']}
fold_records = {}
for fold in (0, 1):
data = pilot['folds'][fold]
if data['fold'] != fold or any(pilot['geometry'][case]['protocol'] != 'grouped' for case in included):
raise ValueError('Frozen grouped Greif protocol required')
owners = {}
sizes = {}
for role in ROLES:
cases = data[role]
if len(set(cases)) != len(cases):
raise ValueError('Duplicate grouped role member')
for case in cases:
row = included[case]
family = row['component_id']
assigned = [item['role'] for item in row['assignments'] if item['fold'] == fold]
if assigned != [role] or owners.setdefault(family, role) != role:
raise ValueError(f'Grouped family or role crossed a boundary in fold {fold}')
sizes[role] = len(cases)
if set().union(*(set(data[role]) for role in ROLES)) != set(included):
raise ValueError(f'Incomplete frozen support for fold {fold}')
fold_records[str(fold)] = dict(counts=sizes, clock_coefficient=data['c'],
clock_sha256=data['clock_sha256'],
parts={role: data[role] for role in ROLES})
return fold_records
def project(phase_charged, approvals, epoch_seconds_by_fold, epochs, overhead_gpu_seconds):
if set(approvals) != {'gino_shapenet', 'h2_pressure', 'other_unsettled'}:
raise ValueError('List all three other phase-3 reservations exactly once')
if set(epoch_seconds_by_fold) != {'0', '1'} or type(epochs) is not int or epochs <= 0:
raise ValueError('Each frozen fold needs its own measured full epoch')
basis = list(epoch_seconds_by_fold.values())
amounts = [phase_charged, overhead_gpu_seconds, *approvals.values()]
if (any(not math.isfinite(v) or v < 0 for v in amounts)
or any(not math.isfinite(v) or v <= 0 for v in basis)):
raise ValueError('Missing or invalid budget terms')
greif = math.ceil(1.25 * sum(basis) * 2 * epochs + overhead_gpu_seconds)
phase_total = phase_charged + sum(approvals.values()) + greif
return dict(greif_projection_gpu_seconds=greif, phase_projection_gpu_seconds=phase_total,
phase_cap_gpu_seconds=CAP, within_phase_cap=phase_total <= CAP)
def binding():
pilot, query, terminal = (read(checked(path, PINS[str(path)])) for path in (PILOT, QUERY, PHASE_TERMINAL))
folds = grouped_folds(pilot, query)
reference_formal = reference.contract()
timing = reference_formal['formal']['timing']
prior = terminal['cumulative_phase3_gpu_seconds']
return dict(status=STATUS, handoff='h-539a65e1', working_entry='preparation_only',
folds=folds, seeds=[0, 1],
jobs=[dict(fold=fold, seed=seed) for fold in (0, 1) for seed in (0, 1)],
sources=PINS,
reuse_h2=dict(features='original 19 standardized on each fold learning only', geometry='full retained tet nodes',
mass='original positive nodal mass', input_clock='original FP64 Vf and frozen learning c',
train_target='same normalized residual as H2 candidate', readout='same cF and seconds decode',
case_query='original fixed PPS/query multiplicity and raw IDs', target_reads_in_preparation=0),
adapter_candidate=dict(status='NEEDS_SCIENTIFIC_REVIEW',
method='propose GNO/FNO/GNO with same node features carried into and out of the latent grid',
open=['latent grid and feature transport', 'training epochs and learning schedule',
'phase pool and test target access sequencing']),
projection=dict(settled_phase3_through_1b_gpu_seconds=prior,
gino_measurement_once_gpu_seconds=timing['prior_measurement_gpu_seconds'],
gino_shapenet_formal_reserve_gpu_seconds=40000, h2_pressure_unsettled_max_gpu_seconds=40000,
phase_cap_gpu_seconds=CAP, measured_greif_epoch_seconds=None,
complete_projection=None, status='BLOCKED_PENDING_COMPLETE_PHASE_PROJECTION'),
production_guard_limits=reference_formal['limits'],
launch_authorized=False,
code_sha256={str(path): sha(path) for path in (
Path(__file__).resolve(), reference.SOURCES/'phase2_h2_data.py',
reference.SOURCES/'phase2_residual_math.py', reference.SOURCES/'track_b_gino_formal_guard.py')})
if __name__ == '__main__':
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--write-binding', action='store_true')
args = parser.parse_args()
c = binding()
if args.write_binding:
ROOT.mkdir(exist_ok=False)
save(ROOT/'preparation-binding.json', c)
print(json.dumps({key: c[key] for key in ('status', 'jobs', 'projection', 'launch_authorized')}, indent=2))
+102
View File
@@ -0,0 +1,102 @@
"""Prepare the H2-P ShapeNet611 comparison without opening the pressure archive."""
import argparse
import math
from pathlib import Path
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import connected_components
import torch
from torch import nn
import track_b_gino_formal as reference
from phase2_h2_model import H2Geo, edge_attributes
from track_b_gino_shapenet_entry import BASE, save, sha
ROOT = BASE / 'artifacts/track-b-h2-pressure-preparation-2026-11-19'
STATUS = 'PREPARED_PENDING_INPUT_REVIEW_AND_MEASURED_COST'
class PressureH2(H2Geo):
"""Use the shared H2 blocks with a three-coordinate input and direct pressure output."""
def __init__(self):
super().__init__()
self.encoder[0] = nn.Linear(3, 64)
self.head[0] = nn.Linear(67, 64)
def surface(points, triangles, lower, upper):
points = np.asarray(points, dtype=np.float64)
faces = np.asarray(triangles)
if (points.ndim != 2 or points.shape[1] != 3 or not np.isfinite(points).all()
or faces.ndim != 2 or faces.shape[1] != 3 or len(faces) == 0
or faces.dtype.kind not in 'iu' or np.any(faces < 0) or np.any(faces >= len(points))):
raise ValueError('Original ordered triangle mesh required')
lo, hi = np.asarray(lower, dtype=np.float64), np.asarray(upper, dtype=np.float64)
if (lo.shape != (3,) or hi.shape != (3,) or not np.isfinite(lo).all()
or not np.isfinite(hi).all() or not np.all(hi > lo)):
raise ValueError('Fixed ShapeNet normalization bounds required')
xyz = points[faces]
area = np.linalg.norm(np.cross(xyz[:, 1] - xyz[:, 0], xyz[:, 2] - xyz[:, 0]), axis=1) / 2
mass = np.bincount(faces.ravel(), weights=np.repeat(area / 3, 3), minlength=len(points))
if not np.isfinite(area).all() or np.any(area <= 0) or np.any(mass <= 0):
raise ValueError('Every original vertex needs positive incident triangle area')
edges = np.concatenate((faces[:, [0, 1]], faces[:, [1, 2]], faces[:, [2, 0]]))
edges = np.unique(np.concatenate((edges, edges[:, ::-1])), axis=0)
receiver, sender = edges.T
graph = csr_matrix((np.ones(len(receiver)), (receiver, sender)), shape=(len(points), len(points)))
_, components = connected_components(graph, directed=False)
attributes, _ = edge_attributes(points, mass, receiver, sender)
# CFDSDFDataModule's original affine coordinate map to [-1, 1].
x = 2 * (points - lo) / (hi - lo) - 1
return tuple(torch.from_numpy(value) for value in (
x.astype(np.float32), mass.astype(np.float32), receiver.astype(np.int64),
sender.astype(np.int64), attributes, components.astype(np.int64)))
def project(epoch_seconds, overhead_gpu_seconds, cap=40000):
if (not math.isfinite(epoch_seconds) or epoch_seconds <= 0
or not math.isfinite(overhead_gpu_seconds) or overhead_gpu_seconds < 0):
raise ValueError('Measured full H2-P epoch and a declared overhead reserve required')
gpu = math.ceil(1.25 * 3 * 100 * epoch_seconds + overhead_gpu_seconds)
return dict(train_plus_margin_gpu_seconds=1.25 * 3 * 100 * epoch_seconds,
overhead_gpu_seconds=overhead_gpu_seconds, projected_gpu_seconds=gpu,
matched_maximum_gpu_seconds=cap, within_matched_cap=gpu <= cap)
def binding():
gino = reference.contract()
return dict(status=STATUS, handoff='h-539a65e1', identity='H2-P',
working_entry='preparation_only', seeds=[0, 1, 2], candidate_epochs_per_seed=100,
raw_paper_data=gino['paper_data'], source_mapping=gino['mapping_audit'], split_receipt=gino['split_receipt'],
split=gino['split'], reference_comparison=dict(path=gino['comparison_contract'], sha256=gino['comparison_contract_sha256']),
same_case_metric=gino['protocol']['metric'],
candidate_geometry=dict(vertex_order='exact source PLY', node_inputs=['x', 'y', 'z'],
edges='original triangle edges both directions', nodal_mass='one-third incident triangle area',
message_components='connected components of original edges', pressure_readout='direct scalar per original node',
molding_inputs=[], scientific_model='four shared 64-wide H2 graph/token blocks'),
custody=dict(prepared_target_reads=0, fit_target_reads=0, final_unique_target_reads=111,
all_three_checkpoints_before_final_score=True),
timing=dict(complete_learning_cases=500, formal_cap_max_gpu_seconds=40000, factor=1.25,
measurement_result=None, status='BLOCKED_NO_H2_P_GUARD_CERTIFIED_EPOCH'),
production_guard_limits=gino['limits'],
launch_authorized=False,
code_sha256={str(path): sha(path) for path in (
Path(__file__).resolve(), reference.SOURCES/'phase2_h2_model.py',
reference.SOURCES/'track_b_gino_formal_guard.py')})
if __name__ == '__main__':
import json
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--write-binding', action='store_true')
args = parser.parse_args()
c = binding()
if args.write_binding:
ROOT.mkdir(exist_ok=False)
save(ROOT/'preparation-binding.json', c)
print(json.dumps({key: c[key] for key in ('status', 'identity', 'timing', 'launch_authorized')}, indent=2))