code: def _train_func(self, sub_train_, weights, optimizer, scheduler):
      train_loss = 0.0
      train_acc = 0.0
  
      data = sub_train_.data
      if weights is not None:
          data = [d + (weights[i],) for i, d in enumerate(data)]
  
      train_iter = dataloader(
          data,
          self.mini_batch_size,
          self._create_collate_fn(
              use_sample_weights=weights is not None
          ),
      )
  
      for i, (text, cls, weight) in enumerate(train_iter):
          loss, acc = self._train_single_batch(
              text, cls, weight, optimizer
          )
          scheduler.step()
  
          train_loss += loss
          train_acc += acc
  
      return train_loss / len(sub_train_), train_acc / len(sub_train_)
  
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 8 for calling the KimCNNClassifier obj's underlying member method code with example usage: obj._train_func(sub_train_, weights, optimizer, scheduler) and returns: unknown,  unknown