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","."]
code: def get_label_probabilities(self, outputs, top_k):
      is_list = type(outputs) == list
  
      outputs = outputs if is_list else [outputs]
  
      probabilities = []
      for o in outputs:
          logits = o[0]
          predictions = (
              torch.softmax(logits, dim=1).detach().squeeze(0).tolist()
          )
          probs = {}
          for idx, pred in enumerate(predictions):
              label = self.labels[idx]
              probs[label] = pred
  
          probs = sorted(
              probs.items(), key=lambda x: x[1], reverse=True
          )
          probs = {k: v for k, v in probs[:top_k]}
  
          probabilities.append(probs)
  
      probabilities = probabilities if is_list else probabilities[0]
  
      return probabilities
  
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 4 for calling the HFSeqTCModel obj's underlying member method code with example usage: obj.get_label_probabilities(outputs, top_k) and returns: probabilities