code: def to_device(batch, device):
      output = {}
      for k, v in batch.items():
          try:
              output[k] = v.to(device)
          except:
              output[k] = v
      return output
  
imports: import torch
  from torch.nn import CrossEntropyLoss, MSELoss
  import datasets
  from datasets import load_dataset, load_metric
  import copy
  import os
  import json
  import transformers
  from transformers import AutoConfig, PretrainedConfig
  import huggingface_transformer
  from huggingface_transformer.modeling_bert import BertForSequenceClassification
  import logging
  import numpy
  import math
label_desc: Use image node_id 3 for calling a global function with example usage: to_device(batch, device) and returns: output