class_docstr: Class for Hugging Face sequence classification models
  
  Attributes:
      model_path: path to HF model
      tokenizer_path: path to HF tokenizer
      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
      model_class: Class used to initialise model
      tokenizer_class: Class used to initialise tokenizer
      device: Device for model. Defaults to "cuda" if available.
class_docstr_tok: ["Class","for","Hugging","Face","sequence","classification","models","Attributes",":","model_path",":","path","to","HF","model","tokenizer_path",":","path","to","HF","tokenizer","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","model_class",":","Class","used","to","initialise","model","tokenizer_class",":","Class","used","to","initialise","tokenizer","device",":","Device","for","model",".","Defaults","to","``","cuda","''","if","available","."]
docstr: Uses the model for text classification.
  At this point, the model needs to already have been finetuned.
  This is what sets up the final layer for classification.
  
  Args:
      task_input: input dictionary according to the ``text-classification`` task specification
      task: text-classification
docstr_tok: ["Uses","the","model","for","text","classification",".","At","this","point",",","the","model","needs","to","already","have","been","finetuned",".","This","is","what","sets","up","the","final","layer","for","classification",".","Args",":","task_input",":","input","dictionary","according","to","the","``","text-classification","``","task","specification","task",":","text-classification"]
code: def __call__(
      self, task_input, task="text-classification", train=False
  ):
      """
      Uses the model for text classification.
      At this point, the model needs to already have been finetuned.
      This is what sets up the final layer for classification.
  
      Args:
          task_input: input dictionary according to the ``text-classification`` task specification
          task: text-classification
      """
      if task == "text-classification":
          text = task_input.pop("text")
          top_k = task_input.get("top_k", 10000)
  
          is_list = type(text) == list
  
          text = text if is_list else [text]
  
          outputs = []
          for t in text:
              tokens = self.tokenizer(
                  t, truncation=True, padding=True, return_tensors="pt"
              )
              input_ids = (
                  tokens.input_ids[0]
                  .unsqueeze(0)
                  .to(self._model_device)
              )
              mask = (
                  tokens.attention_mask[0]
                  .unsqueeze(0)
                  .to(self._model_device)
              )
  
              output = self.model(
                  input_ids=input_ids, attention_mask=mask
              )
              outputs.append(output)
  
          outputs = outputs if is_list else outputs[0]
  
          return self.get_label_probabilities(outputs, top_k)
      else:
          raise ValueError(f"Unsupported task: {task}")
  
file_path: backprop/backprop/models/hf_seq_tc_model/model.py
imports: import torch
  import pytorch_lightning
  from transformers import AutoModelForSequenceClassification, AutoTokenizer
  from transformers.optimization import AdamW
  from backprop.models import HFModel
  from typing import List, Union, Dict
label_desc: Use image node_id 3 for calling the HFSeqTCModel obj's underlying member method code with example usage: obj.__call__(task_input, task, train) and returns: self