stage_data.py
python · 17 lines · Exact bytes
Version & provenance · theory-cm7
Recorded SHA-256 652e1d27cbef9e0b9a3f38f70e9dde8a37b519bdbb92634ea911a3194d3a2f95Rendered SHA-256 652e1d27cbef9e0b9a3f38f70e9dde8a37b519bdbb92634ea911a3194d3a2f95
Apache-2.0 original project code; dependencies retain their own licenses. License notes. Line links are stable within this snapshot. CM-7 completed implementation source; original and public rendered hashes recorded. Host-specific paths use /work placeholders; inspect reproduction instructions before running. Separate Rust helper retains its GPL license.
1import sys,time
2from pathlib import Path
3import numpy as np
4import torch
5from reader import Data,Ledger
6sys.path.append(str(Path(__file__).resolve().parent.parent/'cm6-curriculum-v1'))
7from composite import Plan as BasePlan,start_prefetch,phase,tensors
8sys.path.insert(0,str(Path(__file__).resolve().parent))
9ExposureLedger=Ledger
10def open_curriculum(root,adapter_directory=None):return Data(Path(root)/'manifest.json',verify=True)
11class Plan(BasePlan):
12 def load(self,step,pin):
13 began=time.perf_counter();ids=self.indices(step);rows=self.data.take(ids)
14 kinds=np.asarray([2,1,0])[self.data.schedule[ids]['kind']]
15 tags=rows['source'].astype(np.int64)*9+phase(rows)*3+kinds
16 return tensors(rows,pin),torch.from_numpy(np.ascontiguousarray(tags)),time.perf_counter()-began
17