Runs the full training and validation routine.
(
self,
training_config: Optional[TrainingConfig] = None,
validation_config: Optional[ValidationConfig] = None,
checkpoint_config: Optional[CheckpointConfig] = None,
callbacks: Optional[Union[Callback, List[Callback]]] = None,
max_steps: int = 100,
)
| 220 | raise NotImplementedError() |
| 221 | |
| 222 | def fit( |
| 223 | self, |
| 224 | training_config: Optional[TrainingConfig] = None, |
| 225 | validation_config: Optional[ValidationConfig] = None, |
| 226 | checkpoint_config: Optional[CheckpointConfig] = None, |
| 227 | callbacks: Optional[Union[Callback, List[Callback]]] = None, |
| 228 | max_steps: int = 100, |
| 229 | ): |
| 230 | """ Runs the full training and validation routine. |
| 231 | """ |
| 232 | self._max_steps = max_steps |
| 233 | self._sub_models = self._get_and_check_sub_models( |
| 234 | training_config, validation_config, checkpoint_config, callbacks |
| 235 | ) |
| 236 | if len(self._sub_models) == 0: |
| 237 | return |
| 238 | if self._checkpoint_model.is_valid: |
| 239 | self._checkpoint_model.load() |
| 240 | for step_idx in range(0, self._max_steps): |
| 241 | for sub_model in self._sub_models: |
| 242 | try: |
| 243 | sub_model.step(step_idx) |
| 244 | except Exception as e: |
| 245 | print( |
| 246 | "Model step_idx {} {} failed.".format(step_idx, sub_model.name) |
| 247 | ) |
| 248 | raise e |
| 249 | |
| 250 | def method_overrided(self, method_name: str = None) -> bool: |
| 251 | return getattr(self.__class__, method_name) != getattr(Model, method_name) |
nothing calls this directly
no test coverage detected