code: def _perform_model_selection(self, optimizer, model_selection):
      model_selection_result = model_selection.select()
      if model_selection_result is not None:
          self.model.load_state_dict(
              torch.load(model_selection_result.model_path)
          )
          optimizer_path = (
              model_selection_result.model_path.with_suffix(
                  ".pt.optimizer"
              )
          )
          optimizer.load_state_dict(torch.load(optimizer_path))
  
imports: import logging
  import warnings
  from abc import abstractmethod
  from functools import partial
  from pathlib import Path
  from small_text.classifiers.classification import Classifier
  from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
  from small_text.training.early_stopping import EarlyStopping, NoopEarlyStopping, EarlyStoppingOrCondition
  from small_text.training.metrics import Metric
  from small_text.training.model_selection import ModelSelection, NoopModelSelection
  from small_text.utils.classification import empty_result, prediction_result
label_desc: Use image node_id 2 for calling the PytorchModelSelectionMixin obj's underlying member method code with example usage: obj._perform_model_selection(optimizer, model_selection) without return types