docstr: Trains the model.
docstr_tok: ["Trains","the","model","."]
code: def train(self, output_dir: Optional[str] = None) -> None:
      """
      Trains the model.
      """
      from torch.utils.data import DataLoader
  
      self.init_model()
  
      if self.data_kwargs["dataset_type"]:
          dataloader = DataLoader(
              dataset=self.data_kwargs["dataset_type"](
                  self._train_dataset
              ),
              batch_size=self.data_kwargs["batch_size"],
          )
      else:
          dataloader = DataLoader(
              dataset=self._train_dataset,
              batch_size=self.data_kwargs["batch_size"],
          )
  
      train_loss = self._loss_cls(self._trainer)
  
      if self._cross_encoder:
          train_objectives = dataloader
      else:
          train_objectives = [(dataloader, train_loss)]
  
      self._trainer.fit(train_objectives, **self.trainer_kwargs)
  
      if output_dir is not None:
          self.save(output_dir)
  
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 7 for calling the ArgillaSentenceTransformersTrainer obj's underlying member method code with example usage: obj.train(output_dir) without return types