ksuit.utils.training.training_iteration¶
Classes¶
Module Contents¶
- class ksuit.utils.training.training_iteration.TrainingIteration(epoch=None, update=None, sample=None)¶
-
- epoch = None¶
- update = None¶
- sample = None¶
- copy()¶
Creates a copy of a TrainingIteration object.
- Return type:
- property specified_properties_count: int¶
Counts the number of specified (non-None) properties.
- Return type:
- get_n_equal_properties(other)¶
Counts the number of equal properties between two TrainingIteration objects.
- Parameters:
other (TrainingIteration) – The other TrainingIteration object to compare with.
- Return type:
- to_fully_specified(updates_per_epoch, effective_batch_size)¶
Converts the TrainingIteration object to a fully specified TrainingIteration object. This method calculates the missing properties based on the specified ones.
- Parameters:
- Return type:
- has_same_specified_properties(other)¶
Checks if the specified properties of two TrainingIteration objects are the same.
- Parameters:
other (TrainingIteration) – The other TrainingIteration object to compare with.
- Return type:
- static from_string(value)¶
Converts a training iteration string into a TrainingIteration object.
The training iteration string should be in the format “E{epoch}_U{update}_S{sample}”. For instance: E5_U12_S123 corresponds to TrainingIteration(epoch=5, update=12, sample=123).
- Parameters:
value (str) – The TrainingIteration string to convert.
- Return type:
- static contains_string(source)¶
Checks if the source string contains a training iteration string.
- static find_string(source)¶
Checks if the source string contains a training iteration string and returns it.
- static from_filename(fname)¶
Creates a TrainingIteration object from a filename that contains a training iteration string.
- Parameters:
fname (str) – The filename to extract the training iteration string from.
- Returns:
The created object.
- Return type:
- static to_fully_specified_from_filenames(directory, training_iteration, prefix=None, suffix=None)¶
Converts a minimally specified TrainingIteration to a fully specified one from filenames in a given folder. The first file containing a training iteration string and optionally starting with prefix or ending with suffix is used.
- Parameters:
directory (str) – The directory containing training iteration files.
training_iteration (TrainingIteration) – The TrainingIteration object to match against.
prefix (str | None) – Optional prefix to filter files.
suffix (str | None) – Optional suffix to filter files.
- Returns:
The created object.
- Return type:
- Raises:
FileNotFoundError – If no matching file is found.
- to_target_specification(target)¶
Creates a new object that matches the target specification.
Example:
` self=TrainingIteration(epoch=6, update=12, sample=123)` target=TrainingIteration(epoch=5) print(self.to_target_specification(target)) TrainingIteration(epoch=6) `:param target: The target TrainingIteration object to match against.- Returns:
The created object.
- Return type:
- Parameters:
target (TrainingIteration)