class_docstr: Class for models which are initialised from a path.
  
  Attributes:
      model_path: Path to the model
      name: string identifier for the model. Lowercase letters and numbers.
          No spaces/special characters except dashes.
      description: String description of the model.
      tasks: List of supported task strings
      details: Dictionary of additional details about the model
      init_model: Callable to initialise model from path
      tokenizer_path (optional): Path to the tokenizer
      init_tokenizer (optional): Callable to initialise tokenizer from path
      device (optional): Device for inference. Defaults to "cuda" if available.
code: def __init__(
      self,
      model_path,
      init_model,
      name: str = None,
      description: str = None,
      tasks: List[str] = None,
      details: Dict = None,
      tokenizer_path=None,
      init_tokenizer=None,
      device=None,
  ):
      BaseModel.__init__(
          self,
          None,
          name=name,
          description=description,
          tasks=tasks,
          details=details,
      )
      self.init_model = init_model
      self.init_tokenizer = init_tokenizer
      self.model_path = model_path
      self.tokenizer_path = tokenizer_path
      self._model_device = device
  
      if self._model_device is None:
          self._model_device = (
              "cuda" if torch.cuda.is_available() else "cpu"
          )
  
      # Initialise
      self.model = (
          self.init_model(model_path).eval().to(self._model_device)
      )
  
      # Not all models need tokenizers
      if self.tokenizer_path:
          self.tokenizer = self.init_tokenizer(self.tokenizer_path)
  
imports: from typing import List, Tuple, Dict
  from transformers import AutoModelForPreTraining, AutoTokenizer, AutoModelForSequenceClassification, AdamW
  from torch.utils.data import DataLoader, Subset
  from sentence_transformers import SentenceTransformer
  from functools import partial
  import os
  import torch
  import torch.nn.functional
  import pytorch_lightning
  from pytorch_lightning.callbacks.early_stopping import EarlyStopping
  from pytorch_lightning.utilities.memory import garbage_collection_cuda
label_desc: Use image node_id 1 to create a new PathModel object from inherited base classes: BaseModel with example: obj = PathModel(model_path, init_model, name, description, tasks, details, tokenizer_path, init_tokenizer, device)