code: def load_fp16_scaler(self):
      if self.training_config.fp16:
          assert version.parse(torch.__version__) >= version.parse(
              "1.6"
          ), f"Using fp16 requires torch version >- 1.6, found: {torch.__version__}"
          assert self.device != torch.device(
              "cpu"
          ), "fp16 cannot be used on cpu"
  
      set_torch_grad_scaler = True
      if self.training_config.fp16 and self.distributed:
          try:
              from fairscale.optim.grad_scaler import ShardedGradScaler
              from fairscale.optim.oss import OSS
  
              if isinstance(self.optimizer, OSS):
                  self.scaler = ShardedGradScaler()
                  set_torch_grad_scaler = False
                  logger.info("Using FairScale ShardedGradScaler")
          except ImportError:
              logger.info("Using Pytorch AMP GradScaler")
  
      if set_torch_grad_scaler:
          self.scaler = torch.cuda.amp.GradScaler(
              enabled=self.training_config.fp16
          )
  
imports: import logging
  import warnings
  import omegaconf
  import torch
  from mmf.common.registry import registry
  from mmf.datasets.multi_datamodule import MultiDataModule
  from mmf.modules.metrics import Metrics
  from mmf.trainers.base_trainer import BaseTrainer
  from mmf.trainers.callbacks.checkpoint import CheckpointCallback
  from mmf.trainers.callbacks.early_stopping import EarlyStoppingCallback
  from mmf.trainers.callbacks.logistics import LogisticsCallback
  from mmf.trainers.callbacks.lr_scheduler import LRSchedulerCallback
  from mmf.trainers.core.callback_hook import TrainerCallbackHookMixin
  from mmf.trainers.core.device import TrainerDeviceMixin
  from mmf.trainers.core.evaluation_loop import TrainerEvaluationLoopMixin
  from mmf.trainers.core.profiling import TrainerProfilingMixin
  from mmf.trainers.core.training_loop import TrainerTrainingLoopMixin
  from mmf.utils.build import build_model, build_optimizer
  from mmf.utils.general import print_model_parameters
  from omegaconf import DictConfig, OmegaConf
  from packaging import version
label_desc: Use image node_id 8 for calling the MMFTrainer obj's underlying member method code with example usage: obj.load_fp16_scaler() without return types