class_docstr: Base Task superclass used to implement new tasks.
  
  Attributes:
      model: Model name string for the task in use.
      local: Run locally. Defaults to False.
      api_key: Backprop API key for non-local inference.
      device: Device to run inference on. Defaults to "cuda" if available.
      models: All supported models for a given task (pulls from config).
      default_local_model: Which model the task will default to if initialized with none provided: Defined per-task.
class_docstr_tok: ["Base","Task","superclass","used","to","implement","new","tasks",".","Attributes",":","model",":","Model","name","string","for","the","task","in","use",".","local",":","Run","locally",".","Defaults","to","False",".","api_key",":","Backprop","API","key","for","non-local","inference",".","device",":","Device","to","run","inference","on",".","Defaults","to","``","cuda","''","if","available",".","models",":","All","supported","models","for","a","given","task","(","pulls","from","config",")",".","default_local_model",":","Which","model","the","task","will","default","to","if","initialized","with","none","provided",":","Defined","per-task","."]
code: def __init__(
      self,
      model,
      local=False,
      api_key=None,
      task: str = None,
      device: str = None,
      models: Dict = None,
      default_local_model: str = None,
      local_aliases: Dict = None,
  ):
      super().__init__()
  
      if api_key == None:
          local = True
  
      self.task = task
      self.local = local
      self.api_key = api_key
  
      # Pick the correct model name
      if local:
          if model is None:
              model = default_local_model
  
          if type(model) == str:
              model = AutoModel.from_pretrained(
                  model, aliases=local_aliases, device=device
              )
  
          if task not in model.tasks:
              raise ValueError(
                  f"Model does not support the '{task}' task"
              )
  
      else:
          if model is not None and type(model) != str:
              raise ValueError(
                  f"Model must be a string identifier to be used in the API"
              )
  
          # API uses default model
          if model is None:
              model = ""
  
      # All checks passed
      self.model = model
  
imports: from typing import Dict, List, Union, Tuple
  import logging
  import backprop
  from backprop.models import AutoModel
  import pytorch_lightning
  from torch.utils.data.dataloader import DataLoader
  import os
  import torch
  from torch.utils.data import Subset, Dataset
  from pytorch_lightning.utilities.memory import garbage_collection_cuda
  from pytorch_lightning.callbacks import EarlyStopping
label_desc: Use image node_id 1 to create a new Task object from inherited base classes: pl with example: obj = Task(model, local, api_key, task, device, models, default_local_model, local_aliases)