code: def embed(
      self,
      data_set,
      return_proba=False,
      embedding_method=EMBEDDING_METHOD_POOLED,
      module_selector=lambda x: x["fc"],
      pbar="tqdm",
  ):
      if self.model is None:
          raise ValueError(
              "Model is not trained. Please call fit() first."
          )
  
      self.model.eval()
  
      dataset_iter = dataloader(
          data_set.data,
          self.mini_batch_size,
          self._create_collate_fn(),
          train=False,
      )
  
      tensors = []
      proba = []
      with build_pbar_context(
          pbar, tqdm_kwargs={"total": list_length(data_set)}
      ) as pbar:
          for text, *_ in dataset_iter:
              batch_len = text.size(0)
              text = text.to(self.device, non_blocking=True)
  
              if embedding_method == self.EMBEDDING_METHOD_POOLED:
                  embedded = self.model._forward_pooled(text)
                  tensors.extend(
                      embedded.detach()
                      .to("cpu", non_blocking=True)
                      .numpy()
                  )
  
                  if return_proba:
                      sm = F.softmax(
                          self.model._dropout_and_fc(embedded), dim=1
                      )
                      proba.extend(sm.detach().to("cpu").tolist())
                  pbar.update(batch_len)
  
              elif embedding_method == self.EMBEDDING_METHOD_GRADIENT:
                  best_label, sm = self.get_best_and_softmax(
                      proba, text
                  )
                  self.create_embedding(
                      best_label, sm, module_selector, tensors, text
                  )
                  pbar.update(batch_len)
              else:
                  raise ValueError(
                      f"Invalid embedding method: {embedding_method}"
                  )
  
      if return_proba:
          return np.array(tensors), np.array(proba)
  
      return np.array(tensors)
  
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 1 for calling the KimCNNEmbeddingMixin obj's underlying member method code with example usage: obj.embed(data_set, return_proba, embedding_method, module_selector, pbar) and returns: np, np,  np