docstr: Initialize the `_ArgillaSpaCyTrainerBase` class.
  
  Args:
      dataset: A `spacy.tokens.DocBin` object or a tuple of `spacy.tokens.DocBin` objects.
      record_class:
          A `TextClassificationRecord`, `TokenClassificationRecord`, or `Text2TextRecord`
          object. Defaults to None.
      seed: A `int` with the seed for the random number generator. Defaults to None.
      multi_label: A `bool` indicating whether the task is multi-label or not. Defaults to False.
      language:
          A `str` with the `spaCy` language code e.g. "en". See all the supported languages and their
          codes in `spaCy` at https://spacy.io/usage/models#languages. Defaults to None.
      gpu_id:
          the GPU ID to use. Defaults to -1, which means that the CPU will be used by default.
          GPU IDs start in 0, which stands for the default GPU in the system, if available.
      model:
          A `str` with the `spaCy` model name to use. If it contains vectors it
          can also be used for training/fine-tuning, e.g. "en_core_web_lg"
          contains vectors, while "en_core_web_sm" doesn't. Defaults to None.
      optimize:
          A `str` with the optimization strategy to use. Either "efficiency" or "accuracy".
          Defaults to "efficiency", which means that the model will be smaller, faster,
          and use less memory, but it will be less accurate. If "accuracy" is used, the model
          will be larger, slower, and use more memory, but it will be more accurate.
          Defaults to "efficiency".
  
  Raises:
      NotImplementedError: If the `record_class` is not supported or if the
          `init_training_args` method has not been implemented.
docstr_tok: ["Initialize","the","`","_ArgillaSpaCyTrainerBase","`","class",".","Args",":","dataset",":","A","`","spacy.tokens.DocBin","`","object","or","a","tuple","of","`","spacy.tokens.DocBin","`","objects",".","record_class",":","A","`","TextClassificationRecord","`",",","`","TokenClassificationRecord","`",",","or","`","Text2TextRecord","`","object",".","Defaults","to","None",".","seed",":","A","`","int","`","with","the","seed","for","the","random","number","generator",".","Defaults","to","None",".","multi_label",":","A","`","bool","`","indicating","whether","the","task","is","multi-label","or","not",".","Defaults","to","False",".","language",":","A","`","str","`","with","the","`","spaCy","`","language","code","e.g",".","``","en","''",".","See","all","the","supported","languages","and","their","codes","in","`","spaCy","`","at","https",":","\/\/spacy.io\/usage\/models","#","languages",".","Defaults","to","None",".","gpu_id",":","the","GPU","ID","to","use",".","Defaults","to","-1",",","which","means","that","the","CPU","will","be","used","by","default",".","GPU","IDs","start","in","0",",","which","stands","for","the","default","GPU","in","the","system",",","if","available",".","model",":","A","`","str","`","with","the","`","spaCy","`","model","name","to","use",".","If","it","contains","vectors","it","can","also","be","used","for","training\/fine-tuning",",","e.g",".","``","en_core_web_lg","''","contains","vectors",",","while","``","en_core_web_sm","''","does","n't",".","Defaults","to","None",".","optimize",":","A","`","str","`","with","the","optimization","strategy","to","use",".","Either","``","efficiency","''","or","``","accuracy","''",".","Defaults","to","``","efficiency","''",",","which","means","that","the","model","will","be","smaller",",","faster",",","and","use","less","memory",",","but","it","will","be","less","accurate",".","If","``","accuracy","''","is","used",",","the","model","will","be","larger",",","slower",",","and","use","more","memory",",","but","it","will","be","more","accurate",".","Defaults","to","``","efficiency","''",".","Raises",":","NotImplementedError",":","If","the","`","record_class","`","is","not","supported","or","if","the","`","init_training_args","`","method","has","not","been","implemented","."]
code: def __init__(
      self,
      language: Optional[str] = None,
      gpu_id: Optional[int] = -1,
      model: Optional[str] = None,
      optimize: Literal["efficiency", "accuracy"] = "efficiency",
      *args,
      **kwargs,
  ) -> None:
      """Initialize the `_ArgillaSpaCyTrainerBase` class.
  
      Args:
          dataset: A `spacy.tokens.DocBin` object or a tuple of `spacy.tokens.DocBin` objects.
          record_class:
              A `TextClassificationRecord`, `TokenClassificationRecord`, or `Text2TextRecord`
              object. Defaults to None.
          seed: A `int` with the seed for the random number generator. Defaults to None.
          multi_label: A `bool` indicating whether the task is multi-label or not. Defaults to False.
          language:
              A `str` with the `spaCy` language code e.g. "en". See all the supported languages and their
              codes in `spaCy` at https://spacy.io/usage/models#languages. Defaults to None.
          gpu_id:
              the GPU ID to use. Defaults to -1, which means that the CPU will be used by default.
              GPU IDs start in 0, which stands for the default GPU in the system, if available.
          model:
              A `str` with the `spaCy` model name to use. If it contains vectors it
              can also be used for training/fine-tuning, e.g. "en_core_web_lg"
              contains vectors, while "en_core_web_sm" doesn't. Defaults to None.
          optimize:
              A `str` with the optimization strategy to use. Either "efficiency" or "accuracy".
              Defaults to "efficiency", which means that the model will be smaller, faster,
              and use less memory, but it will be less accurate. If "accuracy" is used, the model
              will be larger, slower, and use more memory, but it will be more accurate.
              Defaults to "efficiency".
  
      Raises:
          NotImplementedError: If the `record_class` is not supported or if the
              `init_training_args` method has not been implemented.
      """
      require_dependencies("spacy")
      super().__init__(*args, **kwargs)
      import spacy
  
      self._model = model
  
      if self._model is None:
          self._model = "en_core_web_sm"
          self._logger.warning(
              f"No model defined. Using the default model {self._model}."
          )
  
      if self._record_class == TokenClassificationRecord:
          self._column_mapping = {
              "text": "text",
              "token": "tokens",
              "ner_tags": "ner_tags",
          }
          self._spacy_pipeline_components = ["ner"]
      elif self._record_class == TextClassificationRecord:
          if self._multi_label:
              self._column_mapping = {
                  "text": "text",
                  "binarized_label": "label",
              }
              self._spacy_pipeline_components = ["textcat_multilabel"]
          else:
              self._column_mapping = {"text": "text", "label": "label"}
              self._spacy_pipeline_components = ["textcat"]
      else:
          raise NotImplementedError(
              "`rg.Text2TextRecord` is not supported yet."
          )
  
      self._train_dataset, self._eval_dataset = (
          self._dataset
          if isinstance(self._dataset, tuple) and len(self._dataset) > 1
          else (self._dataset, None)
      )
      self._train_dataset_path = "./train.spacy"
      self._eval_dataset_path = (
          "./dev.spacy" if self._eval_dataset else "./train.spacy"
      )
  
      self.language = language or "en"
      self.optimize = optimize
  
      self.gpu_id = gpu_id
      self.use_gpu = False
      if self.gpu_id != -1:
          self.use_gpu = spacy.prefer_gpu(self.gpu_id)
  
      if self.use_gpu:
          try:
              require_dependencies("torch")
              self.has_torch = True
          except Exception:
              self.has_torch = False
  
          try:
              require_dependencies("tensorflow")
              self.has_tensorflow = True
          except Exception:
              self.has_tensorflow = False
  
          if not self.has_torch and not self.has_tensorflow:
              self._logger(
                  "Either `torch` or `tensorflow` need to be installed to use the"
                  " GPU, since any of those is required as the GPU allocator. Falling"
                  " back to the CPU."
              )
              self.use_gpu = False
              self.gpu_id = -1
  
      self.init_training_args()
  
imports: import logging
  import sys
  from pathlib import Path
  from typing import Any, Dict, List, Literal, Optional, Union
  from pydantic import BaseModel
  from argilla.client.models import TextClassificationRecord, TokenClassificationRecord
  from argilla.training.base import ArgillaTrainerSkeleton
  from argilla.utils.dependency import require_dependencies
label_desc: Use image node_id 1 to create a new _ArgillaSpaCyTrainerBase object from inherited base classes: ArgillaTrainerSkeleton with example: obj = _ArgillaSpaCyTrainerBase(language, gpu_id, model, optimize)