code: def _get_accelerate_args(
      device_map_option: Optional[str] = "auto",
      max_memory_per_gpu: Optional[Union[int, str]] = None,
      max_cpu_memory: Optional[Union[int, str]] = None,
      offload_folder: Optional[str] = "./offload",
  ) -> dict:
      """Returns the kwargs needed to apply `accelerate` in `AutoModel.from_pretrained`."""
      max_memory = {}
      if max_memory_per_gpu is not None:
          max_memory_per_gpu_map = {
              device_idx: max_memory_per_gpu
              for device_idx in range(torch.cuda.device_count())
          }
          max_memory.update(max_memory_per_gpu_map)
      if max_cpu_memory is not None:
          max_memory["cpu"] = max_cpu_memory
  
      args = {}
      if max_memory:
          args["max_memory"] = max_memory
      args["device_map"] = device_map_option
      args["offload_folder"] = offload_folder
      return args
  
imports: import math
  import torch
  import torch.nn.functional
  import transformers
  import peft
  from pathlib import Path
  from typing import List, Mapping, NewType, Optional, Tuple, Union
  from tqdm import tqdm
  from transformers import BatchEncoding
  from lm_eval import utils
  from lm_eval.base import BaseLM
label_desc: Use image node_id 1 for calling a global function with example usage: _get_accelerate_args(device_map_option, max_memory_per_gpu, max_cpu_memory, offload_folder) and returns: args