code: def _fit_main(
      self,
      sub_train,
      sub_valid,
      weights,
      early_stopping,
      model_selection,
      optimizer,
      scheduler,
  ):
      if self.model is None:
          encountered_num_classes = get_num_labels(sub_train.y)
  
          if self.num_classes is None:
              self.num_classes = encountered_num_classes
  
          self.initialize_kimcnn_model(sub_train)
  
      _check_optimizer_and_scheduler_config(optimizer, scheduler)
      scheduler = scheduler if scheduler is not None else None
  
      optimizer, scheduler = self._get_optimizer_and_scheduler(
          optimizer, scheduler, self.num_epochs, sub_train
      )
  
      self.model = self.model.to(self.device)
      with tempfile.TemporaryDirectory(
          dir=get_tmp_dir_base()
      ) as tmp_dir:
          self._train(
              sub_train,
              sub_valid,
              weights,
              early_stopping,
              model_selection,
              optimizer,
              scheduler,
              tmp_dir,
          )
          self._perform_model_selection(optimizer, model_selection)
  
      return self
  
imports: import datetime
  import logging
  import tempfile
  import numpy
  from functools import partial
  from sklearn.preprocessing import MultiLabelBinarizer
  from small_text.classifiers.classification import EmbeddingMixin
  from small_text.integrations.pytorch.classifiers.base import PytorchClassifier
  from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
  from small_text.integrations.pytorch.models.kimcnn import KimCNN
  from small_text.utils.classification import get_splits
  from small_text.utils.context import build_pbar_context
  from small_text.utils.data import check_training_data, list_length
  from small_text.utils.annotations import early_stopping_deprecation_warning
  from small_text.utils.labels import csr_to_list, get_num_labels
  from small_text.utils.datetime import format_timedelta
  from small_text.utils.logging import verbosity_logger, VERBOSITY_MORE_VERBOSE
  from small_text.utils.system import get_tmp_dir_base
label_desc: Use image node_id 3 for calling the KimCNNClassifier obj's underlying member method code with example usage: obj._fit_main(sub_train, sub_valid, weights, early_stopping, model_selection, optimizer, scheduler) and returns: self