ksuit.utils.training.training_iteration ======================================= .. py:module:: ksuit.utils.training.training_iteration Classes ------- .. autoapisummary:: ksuit.utils.training.training_iteration.TrainingIteration Module Contents --------------- .. py:class:: TrainingIteration(epoch = None, update = None, sample = None) .. py:attribute:: epoch :value: None .. py:attribute:: update :value: None .. py:attribute:: sample :value: None .. py:method:: copy() Creates a copy of a TrainingIteration object. .. py:property:: specified_properties_count :type: int Counts the number of specified (non-None) properties. .. py:property:: is_fully_specified :type: bool Checks if all properties are specified. .. py:property:: is_minimally_specified :type: bool Checks if at least one property is specified. .. py:method:: get_n_equal_properties(other) Counts the number of equal properties between two TrainingIteration objects. :param other: The other TrainingIteration object to compare with. .. py:method:: 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. :param updates_per_epoch: The number of updates per epoch. :param effective_batch_size: The effective batch size used in the training process. .. py:method:: has_same_specified_properties(other) Checks if the specified properties of two TrainingIteration objects are the same. :param other: The other TrainingIteration object to compare with. .. py:method:: from_string(value) :staticmethod: 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)`. :param value: The TrainingIteration string to convert. .. py:method:: contains_string(source) :staticmethod: Checks if the source string contains a training iteration string. :param source: The source string to check. :returns: True if the source string contains a training iteration string, False otherwise. :rtype: bool .. py:method:: find_string(source) :staticmethod: Checks if the source string contains a training iteration string and returns it. :param source: The source string to check. :returns: The found TrainingIteration string. :rtype: str .. py:method:: from_filename(fname) :staticmethod: Creates a TrainingIteration object from a filename that contains a training iteration string. :param fname: The filename to extract the training iteration string from. :returns: The created object. :rtype: TrainingIteration .. py:method:: to_fully_specified_from_filenames(directory, training_iteration, prefix = None, suffix = None) :staticmethod: 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. :param directory: The directory containing training iteration files. :param training_iteration: The TrainingIteration object to match against. :param prefix: Optional prefix to filter files. :param suffix: Optional suffix to filter files. :returns: The created object. :rtype: TrainingIteration :raises FileNotFoundError: If no matching file is found. .. py:method:: 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. :rtype: TrainingIteration