class_docstr: A classifier that operates through Sentence Transformer Finetuning (SetFit, [TRE+22]_).
  
  This class is a wrapper which encapsulates the
  `Hugging Face SetFit implementation <https://github.com/huggingface/setfit>_` .
  
  .. note ::
     This strategy requires the optional dependency `setfit`.
  
  .. versionadded:: 1.2.0
docstr: Trains the model using the given train set.
  
  Parameters
  ----------
  train_set : TextDataset
      A dataset used for training the model.
  validation_set : TextDataset or None, default None
      A dataset used for validation during training.
  setfit_train_kwargs : dict
      Additional keyword arguments that are passed to `SetFitTrainer.train()`
  
  Returns
  -------
  self : SetFitClassification
      Returns the current classifier with a fitted model.
docstr_tok: ["Trains","the","model","using","the","given","train","set",".","Parameters","--","--","--","--","--","train_set",":","TextDataset","A","dataset","used","for","training","the","model",".","validation_set",":","TextDataset","or","None",",","default","None","A","dataset","used","for","validation","during","training",".","setfit_train_kwargs",":","dict","Additional","keyword","arguments","that","are","passed","to","`","SetFitTrainer.train","(",")","`","Returns","--","--","--","-","self",":","SetFitClassification","Returns","the","current","classifier","with","a","fitted","model","."]
code: def fit(
      self, train_set, validation_set=None, setfit_train_kwargs=dict()
  ):
      """Trains the model using the given train set.
  
      Parameters
      ----------
      train_set : TextDataset
          A dataset used for training the model.
      validation_set : TextDataset or None, default None
          A dataset used for validation during training.
      setfit_train_kwargs : dict
          Additional keyword arguments that are passed to `SetFitTrainer.train()`
  
      Returns
      -------
      self : SetFitClassification
          Returns the current classifier with a fitted model.
      """
      setfit_train_kwargs = _check_train_kwargs(setfit_train_kwargs)
      if validation_set is None:
          train_set = _truncate_texts(
              self.model, self.max_seq_len, train_set
          )[0]
      else:
          train_set, validation_set = _truncate_texts(
              self.model, self.max_seq_len, train_set, validation_set
          )
  
      x_valid = validation_set.x if validation_set is not None else None
      y_valid = validation_set.y if validation_set is not None else None
  
      if self.multi_label:
          y_valid = (
              _multi_label_list_to_multi_hot(
                  csr_to_list(y_valid), self.num_classes
              )
              if y_valid is not None
              else None
          )
          y_train = _multi_label_list_to_multi_hot(
              csr_to_list(train_set.y), self.num_classes
          )
  
          sub_train, sub_valid = self._get_train_and_valid_sets(
              train_set.x, y_train, x_valid, y_valid
          )
      else:
          y_valid = (
              y_valid.tolist()
              if isinstance(y_valid, np.ndarray)
              else y_valid
          )
          sub_train, sub_valid = self._get_train_and_valid_sets(
              train_set.x, train_set.y, x_valid, y_valid
          )
  
      if self.use_differentiable_head:
          raise NotImplementedError
      else:
          self.model.model_body.to(self.device)
          return self._fit(sub_train, sub_valid, setfit_train_kwargs)
  
imports: import types
  import numpy
  from sklearn.exceptions import NotFittedError
  from sklearn.utils.validation import check_is_fitted
  from small_text.base import check_optional_dependency
  from small_text.classifiers.classification import Classifier, EmbeddingMixin
  from small_text.exceptions import UnsupportedOperationException
  from small_text.utils.classification import empty_result, _multi_label_list_to_multi_hot, prediction_result
  from small_text.utils.context import build_pbar_context
  from small_text.utils.labels import csr_to_list
  from small_text.integrations.transformers.classifiers.base import ModelLoadingStrategy
label_desc: Use image node_id 2 for calling the SetFitClassification obj's underlying member method code with example usage: obj.fit(train_set, validation_set, setfit_train_kwargs) and returns: self