code: def __init__(self, runner, precision="fp32", amp_level="O1"):
      super().__init__()
      self.runner = runner
      if precision not in ("fp32", "fp16"):
          raise ValueError("`precision` must be 'fp32' or 'fp16'.")
      self.precision = precision
      if amp_level not in ("O1", "O2"):
          raise ValueError("`amp_level` must be 'O1' or 'O2'.")
      self.amp_level = amp_level
      if self.precision == "fp16" and self.runner.optimizer is not None:
          self.scaler = paddle.amp.GradScaler(init_loss_scaling=1024)
      if (
          self.amp_level == "O2"
          and self.runner.model is not None
          and self.runner.optimizer is not None
      ):
          self.model, self.optimizer = paddle.amp.decorate(
              models=self.runner.model,
              optimizers=self.runner.optimizer,
              level="O2",
              save_dtype="float32",
          )
      else:
          self.model = self.runner.model
          self.optimizer = self.runner.optimizer
  
file_path: PaddleSeg/contrib/PanopticSeg/paddlepanseg/core/launcher.py
imports: import abc
  import paddle
label_desc: Use image node_id 1 to create a new AMPLauncher object from inherited base classes: _Launcher with example: obj = AMPLauncher(runner, precision, amp_level)