class_docstr: Toxic comment classification for the Jigsaw challenges.
  Args:
      config ([dict]): takes in args from a predefined config
                            file containing hyperparameters.
class_docstr_tok: ["Toxic","comment","classification","for","the","Jigsaw","challenges",".","Args",":","config","(","[","dict","]",")",":","takes","in","args","from","a","predefined","config","file","containing","hyperparameters","."]
docstr: Custom binary_accuracy function.
  
  Args:
      output ([torch.tensor]): model predictions
      meta ([dict]): meta dict of tensors including targets and weights
  
  Returns:
      [torch.tensor]: model accuracy
docstr_tok: ["Custom","binary_accuracy","function",".","Args",":","output","(","[","torch.tensor","]",")",":","model","predictions","meta","(","[","dict","]",")",":","meta","dict","of","tensors","including","targets","and","weights","Returns",":","[","torch.tensor","]",":","model","accuracy"]
code: def binary_accuracy(self, output, meta):
      """Custom binary_accuracy function.
  
      Args:
          output ([torch.tensor]): model predictions
          meta ([dict]): meta dict of tensors including targets and weights
  
      Returns:
          [torch.tensor]: model accuracy
      """
      if "multi_target" in meta:
          target = meta["multi_target"].to(output.device)
      else:
          target = meta["target"].to(output.device)
      with torch.no_grad():
          mask = target != -1
          pred = torch.sigmoid(output[mask]) >= 0.5
          correct = torch.sum(
              pred.to(output[mask].device) == target[mask]
          )
          if torch.sum(mask).item() != 0:
              correct = correct.item() / torch.sum(mask).item()
          else:
              correct = 0
  
      return torch.tensor(correct)
  
imports: import argparse
  import json
  import os
  import pytorch_lightning
  import src.data_loaders
  import torch
  from pytorch_lightning.callbacks import ModelCheckpoint
  from src.utils import get_model_and_tokenizer
  from torch.nn import functional
  from torch.utils.data import DataLoader
label_desc: Use image node_id 8 for calling the ToxicClassifier obj's underlying member method code with example usage: obj.binary_accuracy(output, meta) and returns: torch