class_docstr: Base class for training runner implementations.
docstr: Initialize trainer from given state dict and input directory.
  :param trainer: The trainer to initialize.
  :param state_dict_dump_file: The state dict dump file relative to input_dir.
  :param input_dir: The directory to load the state dict from.
docstr_tok: ["Initialize","trainer","from","given","state","dict","and","input","directory",".",":","param","trainer",":","The","trainer","to","initialize",".",":","param","state_dict_dump_file",":","The","state","dict","dump","file","relative","to","input_dir",".",":","param","input_dir",":","The","directory","to","load","the","state","dict","from","."]
code: def _init_trainer_from_input_dir(
      cls, trainer: Trainer, state_dict_dump_file: str, input_dir: str
  ) -> None:
      """Initialize trainer from given state dict and input directory.
      :param trainer: The trainer to initialize.
      :param state_dict_dump_file: The state dict dump file relative to input_dir.
      :param input_dir: The directory to load the state dict from.
      """
      with SwitchWorkingDirectoryToInput(input_dir):
          if os.path.exists(state_dict_dump_file):
              BColors.print_colored(
                  f"Trainer and model initialized from '{state_dict_dump_file}' of run '{input_dir}'!",
                  BColors.OKGREEN,
              )
              trainer.load_state(state_dict_dump_file)
          else:
              BColors.print_colored(
                  "Model initialized with random weights! ",
                  BColors.OKGREEN,
              )
  
imports: import logging
  import os
  import dataclasses
  from typing import Optional, Callable, Union
  import omegaconf
  from omegaconf import DictConfig
  from maze.core.env.structured_env import StructuredEnv
  from maze.core.env.structured_env_spaces_mixin import StructuredEnvSpacesMixin
  from maze.core.utils.config_utils import EnvFactory, SwitchWorkingDirectoryToInput
  from maze.core.utils.factory import Factory
  from maze.core.wrappers.observation_normalization.normalization_strategies.base import StructuredStatisticsType
  from maze.core.utils.seeding import set_seeds_globally, MazeSeeding
  from maze.core.wrappers.observation_normalization.observation_normalization_utils import obtain_normalization_statistics, make_normalized_env_factory
  from maze.core.wrappers.observation_normalization.observation_normalization_wrapper import ObservationNormalizationWrapper
  from maze.core.wrappers.wrapper_factory import WrapperFactory
  from maze.perception.models.model_composer import BaseModelComposer
  from maze.perception.models.space_config import SpacesConfig
  from maze.runner import Runner
  from maze.train.trainers.common.model_selection.best_model_selection import BestModelSelection
  from maze.train.trainers.common.trainer import Trainer
  from maze.utils.bcolors import BColors
  from maze.utils.log_stats_utils import setup_logging
label_desc: Use image node_id 3 for calling the TrainingRunner obj's underlying member method code with example usage: obj._init_trainer_from_input_dir(cls, trainer, state_dict_dump_file, input_dir) without return types