docstr: Helper method to choose an evaluator for the model based on the type
  of model, whether it has label or not and the number of sentences per example.
  If neither label or number_of_sentences is set, it's assumed that evaluator_cls
  is passed (via update_config).
  
  Args:
      label: The label type, None should be passed if there is no label.
      number_of_sentences: Number of sentences (two or three normally).
      evaluator_cls: Class to set without "best guess".
docstr_tok: ["Helper","method","to","choose","an","evaluator","for","the","model","based","on","the","type","of","model",",","whether","it","has","label","or","not","and","the","number","of","sentences","per","example",".","If","neither","label","or","number_of_sentences","is","set",",","it","'s","assumed","that","evaluator_cls","is","passed","(","via","update_config",")",".","Args",":","label",":","The","label","type",",","None","should","be","passed","if","there","is","no","label",".","number_of_sentences",":","Number","of","sentences","(","two","or","three","normally",")",".","evaluator_cls",":","Class","to","set","without","``","best","guess","''","."]
code: def _set_evaluator(
      self,
      label: Optional[Union[int, float]] = None,
      number_of_sentences: int = None,
      evaluator_cls=None,
  ) -> None:
      """
      Helper method to choose an evaluator for the model based on the type
      of model, whether it has label or not and the number of sentences per example.
      If neither label or number_of_sentences is set, it's assumed that evaluator_cls
      is passed (via update_config).
  
      Args:
          label: The label type, None should be passed if there is no label.
          number_of_sentences: Number of sentences (two or three normally).
          evaluator_cls: Class to set without "best guess".
      """
      if evaluator_cls:
          # When the user wants to set an evaluator on its own
          if self._eval_dataset:
              self._logger.warning(
                  "No `eval_dataset` found, `evaluator` cannot be set."
              )
          else:
              try:
                  self.trainer_kwargs[
                      "evaluator"
                  ] = evaluator_cls.from_input_examples(
                      self._eval_dataset
                  )
              except AttributeError:
                  # For the moment it's easier (and covers most of the cases?) to allow only
                  # a subset of the evaluators defined in sentence-transformers, inform
                  # the user the one selected is not allowed.
                  self.trainer_kwargs["evaluator"] = None
                  self._logger.warning(
                      "Currently only developed evaluators that implement `cls.from_input_examples` can be set."
                  )
      else:
          if label:
              if number_of_sentences == 2:
                  if isinstance(label, int):
                      # This should work, but for some reason in the tests with default values
                      # the classes cannot be instantiated, need some time to review.
                      # if self._cross_encoder:
                      #     from sentence_transformers.cross_encoder.evaluation import CEBinaryClassificationEvaluator
                      #     self.trainer_kwargs["evaluator"] = CEBinaryClassificationEvaluator.from_input_examples(self._eval_dataset)
                      # else:
                      #     from sentence_transformers.evaluation import BinaryClassificationEvaluator
                      #     self.trainer_kwargs["evaluator"] = BinaryClassificationEvaluator.from_input_examples(self._eval_dataset)
                      self.trainer_kwargs["evaluator"] = None
  
                  else:
                      if self._cross_encoder:
                          from sentence_transformers.cross_encoder.evaluation import (
                              CECorrelationEvaluator,
                          )
  
                          self.trainer_kwargs[
                              "evaluator"
                          ] = CECorrelationEvaluator.from_input_examples(
                              self._eval_dataset
                          )
                      else:
                          from sentence_transformers.evaluation import (
                              EmbeddingSimilarityEvaluator,
                          )
  
                          self.trainer_kwargs[
                              "evaluator"
                          ] = EmbeddingSimilarityEvaluator.from_input_examples(
                              self._eval_dataset
                          )
  
              else:
                  from sentence_transformers.evaluation import (
                      TripletEvaluator,
                  )
  
                  self.trainer_kwargs[
                      "evaluator"
                  ] = TripletEvaluator.from_input_examples(
                      self._eval_dataset
                  )
          else:
              if number_of_sentences == 3:
                  from sentence_transformers.evaluation import (
                      TripletEvaluator,
                  )
  
                  self.trainer_kwargs[
                      "evaluator"
                  ] = TripletEvaluator.from_input_examples(
                      self._eval_dataset
                  )
              else:
                  # Hard to choose one here
                  self.trainer_kwargs["evaluator"] = None
  
file_path: argilla/src/argilla/client/feedback/training/frameworks/sentence_transformers.py
imports: import logging
  from typing import TYPE_CHECKING, List, Optional, Tuple, Union
  from argilla.client.feedback.training.base import ArgillaTrainerSkeleton
  from argilla.client.feedback.training.schemas.base import TrainingTaskForSentenceSimilarity
  from argilla.training.utils import filter_allowed_args, get_default_args
  from argilla.utils.dependency import require_dependencies
label_desc: Use image node_id 4 for calling the ArgillaSentenceTransformersTrainer obj's underlying member method code with example usage: obj._set_evaluator(label, number_of_sentences, evaluator_cls) without return types