GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test(od): keep the od-base island hook test within memory and time · CortexLM/hypertrain@47d843f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • tests/layout
    • test_od_island_v2.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎tests/layout/test_od_island_v2.py‎

Copy file name to clipboardExpand all lines: tests/layout/test_od_island_v2.py
+10-5Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import hashlib
34
import importlib.util
45
from pathlib import Path
56

@@ -103,7 +104,9 @@ def test_od_objectives_layout_reference_and_hooks(objective: str, n: int, zero1:
103104
seen = [[] for _ in range(n)]
104105

105106
def hook(ctx: TraceContext, x: torch.Tensor) -> torch.Tensor:
106-
raw = x.detach().cpu().contiguous().reshape(-1).view(torch.uint8).numpy().tobytes()
107+
raw = hashlib.sha256(
108+
x.detach().cpu().contiguous().reshape(-1).view(torch.uint8).numpy()
109+
).digest()
107110
seen[ctx.rank].append((ctx, raw))
108111
return x
109112

@@ -121,7 +124,9 @@ def hook(ctx: TraceContext, x: torch.Tensor) -> torch.Tensor:
121124
repeated = [[] for _ in range(n)]
122125

123126
def capture(ctx: TraceContext, x: torch.Tensor) -> torch.Tensor:
124-
raw = x.detach().cpu().contiguous().reshape(-1).view(torch.uint8).numpy().tobytes()
127+
raw = hashlib.sha256(
128+
x.detach().cpu().contiguous().reshape(-1).view(torch.uint8).numpy()
129+
).digest()
125130
repeated[ctx.rank].append((ctx, raw))
126131
return x
127132

@@ -133,9 +138,9 @@ def capture(ctx: TraceContext, x: torch.Tensor) -> torch.Tensor:
133138
if objective != "mlm":
134139
mlm = TrainConfig.from_manifest_v2(od_manifest("mlm", 1, False))
135140
extended = extend_params(init_params(mlm.model), cfg.model)
136-
assert all(
137-
torch.equal(extended[k], init_params(mlm.model)[k]) for k in init_params(mlm.model)
138-
)
141+
# One independent re-init, not one per key: od-base init is ~3 s.
142+
stage_a = init_params(mlm.model)
143+
assert all(torch.equal(extended[k], stage_a[k]) for k in stage_a)
139144
pots = emulate(
140145
n,
141146
lambda c: honeypot_island(Honeypot(w.training.coord_pubkey, "honest"), w, c, theta, a, get),

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.