Archived
Record ten-part results and fix bounded pilot timing and AMP handling
This commit is contained in:
1 parent
f8a6ed3f81
commit
cdb52988c3
42 files changed
+31677
-77
No files matched your search
@@ -2,7 +2,10 @@ import unittest
|
||||
from unittest.mock import patch
|
||||
import numpy as np
|
||||
import torch
|
||||
from run_s2_pilot_training import LearningBases,load_part
|
||||
from run_s2_pilot_training import LearningBases,load_part,read_part_arrays
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
from freeze_g1_components import sha
|
||||
|
||||
|
||||
class PilotEntrySealTests(unittest.TestCase):
|
||||
@@ -17,6 +20,23 @@ class PilotEntrySealTests(unittest.TestCase):
|
||||
with patch('run_s2_pilot_training.sha') as hasher,patch('run_s2_pilot_training.np.load') as loader:
|
||||
with self.assertRaises(PermissionError):load_part(dict(case='c'),self.roles,torch.device('cpu'))
|
||||
hasher.assert_not_called();loader.assert_not_called()
|
||||
def test_probe_uses_zero_target_without_opening_missing_label(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root=Path(tmp);np.save(root/'base.npy',np.ones((3,10),dtype=np.float64))
|
||||
np.savez(root/'queries.npz',eligible_s2=[True,False,True],anchor_ids=[0,1,2],g=np.ones((3,2)),edge_summary=np.ones((3,4)),multiplicity=[2,3,4])
|
||||
record=dict(case='a',nodes=3,preparation_root=str(root),label_path=str(root/'must-not-exist.npz'),
|
||||
input_sha256={p:sha(root/p) for p in ['base.npy','queries.npz']})
|
||||
data=read_part_arrays(record,self.roles,synthetic_targets=True)
|
||||
self.assertIsNone(data['truth_seconds']);np.testing.assert_array_equal(data['target'],[0.,0.])
|
||||
self.assertEqual(data['base'].dtype,np.float64)
|
||||
record['case']='b'
|
||||
with patch('run_s2_pilot_training.sha') as hasher:
|
||||
with self.assertRaises(PermissionError):read_part_arrays(record,self.roles,synthetic_targets=True)
|
||||
hasher.assert_not_called()
|
||||
def test_learning_standardizer_uses_cached_full_precision_array(self):
|
||||
values=np.array([[1.+2**-40]*10]);bases=LearningBases({},['a'],self.roles,cache={'a':{'base':values}})
|
||||
with patch('run_s2_pilot_training.np.load') as loader:
|
||||
self.assertIs(bases['a'],values);loader.assert_not_called()
|
||||
|
||||
|
||||
if __name__=='__main__':unittest.main(verbosity=2)
|
||||
Reference in new issue
Block a user