Module saev.test_training
Functions
def test_one_training_step(monkeypatch)
def test_one_training_step_matryoshka(monkeypatch)
-
A minimal end-to-end training-loop smoke test for the Matryoshka objective.
def test_split_cfgs_no_bad_keys()
def test_split_cfgs_on_multiple_keys_with_multiple_per_key()
def test_split_cfgs_on_single_key()
def test_split_cfgs_on_single_key_with_multiple_per_key()
Classes
class DummyDS (n, d)
-
An abstract class representing a :class:
Dataset
.All datasets that represent a map from keys to data samples should subclass it. All subclasses should overwrite :meth:
__getitem__
, supporting fetching a data sample for a given key. Subclasses could also optionally overwrite :meth:__len__
, which is expected to return the size of the dataset by many :class:~torch.utils.data.Sampler
implementations and the default options of :class:~torch.utils.data.DataLoader
. Subclasses could also optionally implement :meth:__getitems__
, for speedup batched samples loading. This method accepts list of indices of samples of batch and returns list of samples.Note
:class:
~torch.utils.data.DataLoader
by default constructs an index sampler that yields integral indices. To make it work with a map-style dataset with non-integral indices/keys, a custom sampler must be provided.Expand source code
class DummyDS(torch.utils.data.Dataset): def __init__(self, n, d): self.x = torch.randn(n, d) def __getitem__(self, i): return dict(act=self.x[i]) def __len__(self): return len(self.x)
Ancestors
- torch.utils.data.dataset.Dataset
- typing.Generic