code: def auc(labels, probs, weights=None):
      if isinstance(labels, mx.np.ndarray):
          labels = labels.asnumpy()
      if isinstance(probs, mx.np.ndarray):
          probs = probs.asnumpy()
      if isinstance(weights, mx.np.ndarray):
          weights = weights.asnumpy()
      labels = labels.reshape(-1)
      probs = probs.reshape(-1)
      weights = weights.reshape(-1)
  
      fpr, tpr, thresholds = metrics.roc_curve(
          labels, probs, sample_weight=weights
      )
      return metrics.auc(fpr, tpr)
  
imports: import os
  import time
  import shutil
  import logging
  import argparse
  import functools
  import collections
  import mxnet
  import numpy
  from mxnet.lr_scheduler import PolyScheduler
  from sklearn import metrics
  from pretraining_utils import ElectraMasker, get_pretrain_data_npz, get_pretrain_data_text, get_electra_pretraining_model
  from gluonnlp.utils.misc import repeat, grouper, set_seed, init_comm, logging_config, naming_convention
  from gluonnlp.models.electra import ElectraModel, ElectraForPretrain
  from gluonnlp.utils.parameter import clip_grad_global_norm
label_desc: Use image node_id 7 for calling a global function with example usage: auc(labels, probs, weights) and returns: metrics