code: def _build_fp16_env(dummy=False):
      if dummy:
          autocast = contextlib.ExitStack
          GradScaler = DummyGradScaler
      else:
          if not torch.cuda.is_available():
              raise RuntimeError(
                  "Pytorch is not installed in gpu version, please use device='cpu'."
              )
          if torch.cuda.get_device_capability(0)[0] < 7:
              logger.rank_zero_warning(
                  "NOTE: your device does NOT support faster training with fp16, "
                  "please switch to FP32 which is likely to be faster"
              )
          try:
              from torch.cuda.amp import autocast, GradScaler
          except ImportError:
              raise RuntimeError(
                  "torch version too low (less than 1.6)"
              )
      return autocast, GradScaler
  
imports: import os
  from typing import Any, Dict, Optional, Union
  from enum import IntEnum
  import contextlib
  import random
  import numpy
  import inspect
  from fastNLP.envs.imports import _NEED_IMPORT_TORCH
  from fastNLP.envs.utils import get_global_seed
  from fastNLP.envs import get_global_rank, FASTNLP_BACKEND_LAUNCH, FASTNLP_GLOBAL_SEED
  from fastNLP.core.samplers import re_instantiate_sampler, ReproducibleBatchSampler, ReproducibleSampler
  from fastNLP.core.utils import auto_param_call, apply_to_collection
  from fastNLP.core.log import logger
label_desc: Use image node_id 2 for calling a global function with example usage: _build_fp16_env(dummy) and returns: autocast,  GradScaler