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: sentence_transformer_model : SetFitModelArguments
      Settings for the sentence transformer model to be used.
  num_classes : int
      Number of classes.
  multi_label : bool, default=False
      If `False`, the classes are mutually exclusive, i.e. the prediction step results in
      exactly one predicted label per instance.
  use_differentiable_head : bool
      Uses a differentiable head instead of a logistic regression for the classification head.
      Corresponds to the keyword argument with the same name in
      `SetFitModel.from_pretrained()`.
  model_kwargs : dict
      Keyword arguments used for the SetFit model. The keyword `use_differentiable_head` is
      excluded and managed by this class. The other keywords are directly passed to
      `SetFitModel.from_pretrained()`.
  
      .. seealso:: `SetFit: src/setfit/modeling.py
                   <https://github.com/huggingface/setfit/blob/main/src/setfit/modeling.py>`_
  
  trainer_kwargs : dict
      Keyword arguments used for the SetFit model. The keyword `batch_size` is excluded and
      is instead controlled by the keyword `mini_batch_size` of this class. The other
      keywords are directly passed to `SetFitTrainer.__init__()`.
  
      .. seealso:: `SetFit: src/setfit/trainer.py
                   <https://github.com/huggingface/setfit/blob/main/src/setfit/trainer.py>`_
  device : str or torch.device, default=None
      Torch device on which the computation will be performed.
docstr_tok: ["sentence_transformer_model",":","SetFitModelArguments","Settings","for","the","sentence","transformer","model","to","be","used",".","num_classes",":","int","Number","of","classes",".","multi_label",":","bool",",","default=False","If","`","False","`",",","the","classes","are","mutually","exclusive",",","i.e",".","the","prediction","step","results","in","exactly","one","predicted","label","per","instance",".","use_differentiable_head",":","bool","Uses","a","differentiable","head","instead","of","a","logistic","regression","for","the","classification","head",".","Corresponds","to","the","keyword","argument","with","the","same","name","in","`","SetFitModel.from_pretrained","(",")","`",".","model_kwargs",":","dict","Keyword","arguments","used","for","the","SetFit","model",".","The","keyword","`","use_differentiable_head","`","is","excluded","and","managed","by","this","class",".","The","other","keywords","are","directly","passed","to","`","SetFitModel.from_pretrained","(",")","`",".","..","seealso",":",":","`","SetFit",":","src\/setfit\/modeling.py","<","https",":","\/\/github.com\/huggingface\/setfit\/blob\/main\/src\/setfit\/modeling.py",">","`","_","trainer_kwargs",":","dict","Keyword","arguments","used","for","the","SetFit","model",".","The","keyword","`","batch_size","`","is","excluded","and","is","instead","controlled","by","the","keyword","`","mini_batch_size","`","of","this","class",".","The","other","keywords","are","directly","passed","to","`","SetFitTrainer.__init__","(",")","`",".","..","seealso",":",":","`","SetFit",":","src\/setfit\/trainer.py","<","https",":","\/\/github.com\/huggingface\/setfit\/blob\/main\/src\/setfit\/trainer.py",">","`","_","device",":","str","or","torch.device",",","default=None","Torch","device","on","which","the","computation","will","be","performed","."]
code: def __init__(
      self,
      setfit_model_args,
      num_classes,
      multi_label=False,
      max_seq_len=512,
      use_differentiable_head=False,
      mini_batch_size=32,
      model_kwargs=dict(),
      trainer_kwargs=dict(),
      device=None,
  ):
      """
      sentence_transformer_model : SetFitModelArguments
          Settings for the sentence transformer model to be used.
      num_classes : int
          Number of classes.
      multi_label : bool, default=False
          If `False`, the classes are mutually exclusive, i.e. the prediction step results in
          exactly one predicted label per instance.
      use_differentiable_head : bool
          Uses a differentiable head instead of a logistic regression for the classification head.
          Corresponds to the keyword argument with the same name in
          `SetFitModel.from_pretrained()`.
      model_kwargs : dict
          Keyword arguments used for the SetFit model. The keyword `use_differentiable_head` is
          excluded and managed by this class. The other keywords are directly passed to
          `SetFitModel.from_pretrained()`.
  
          .. seealso:: `SetFit: src/setfit/modeling.py
                       <https://github.com/huggingface/setfit/blob/main/src/setfit/modeling.py>`_
  
      trainer_kwargs : dict
          Keyword arguments used for the SetFit model. The keyword `batch_size` is excluded and
          is instead controlled by the keyword `mini_batch_size` of this class. The other
          keywords are directly passed to `SetFitTrainer.__init__()`.
  
          .. seealso:: `SetFit: src/setfit/trainer.py
                       <https://github.com/huggingface/setfit/blob/main/src/setfit/trainer.py>`_
      device : str or torch.device, default=None
          Torch device on which the computation will be performed.
      """
      check_optional_dependency("setfit")
  
      self.setfit_model_args = setfit_model_args
      self.num_classes = num_classes
      self.multi_label = multi_label
  
      self.model_kwargs = _check_model_kwargs(model_kwargs)
      self.trainer_kwargs = _check_trainer_kwargs(trainer_kwargs)
  
      model_kwargs = self.model_kwargs.copy()
      if (
          self.multi_label
          and "multi_target_strategy" not in model_kwargs
      ):
          model_kwargs["multi_target_strategy"] = "one-vs-rest"
  
      from_pretrained_options = (
          _get_arguments_for_from_pretrained_model(
              self.setfit_model_args.model_loading_strategy
          )
      )
      self.model = SetFitModel.from_pretrained(
          self.setfit_model_args.sentence_transformer_model,
          use_differentiable_head=use_differentiable_head,
          force_download=from_pretrained_options.force_download,
          local_files_only=from_pretrained_options.local_files_only,
          **model_kwargs,
      )
  
      self.max_seq_len = max_seq_len
      self.use_differentiable_head = use_differentiable_head
      self.mini_batch_size = mini_batch_size
      self.device = device
  
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 1 to create a new SetFitClassification object from inherited base classes: SetFitClassificationEmbeddingMixin, Classifier with example: obj = SetFitClassification(setfit_model_args, num_classes, multi_label, max_seq_len, use_differentiable_head, mini_batch_size, model_kwargs, trainer_kwargs, device)