def test_report_after_finish(session): session.start() session.pause_reporting() session.finish() for _ in range(2): report(loss=1) assert session.get_next() is None
def test_warn_once(): """Checks if session misuse warning is only shown once per function.""" with pytest.warns(UserWarning) as record: assert not load_checkpoint() assert not load_checkpoint() assert not save_checkpoint(x=2) assert not report(x=2) assert not report(x=3) assert not get_dataset_shard() # Should only warn once. assert len(record) == 4
def train_func(): for i in range(2): report(loss=i)
def train_2(): for i in range(2): report(loss=i) train_1()
def train_func(): save_checkpoint(epoch=0) report(epoch=1)
def train_func(): for i in range(2): report(i) return 1