class_docstr: Model of BFloat16 with auto mixed precision.
class_docstr_tok: ["Model","of","BFloat16","with","auto","mixed","precision","."]
code: def _save_model(self, path, compression="fp32"):
      if compression == "bf16":
          bf16_model = self.model.bfloat16()
          torch.save(bf16_model.state_dict(), path / "ckpt.pth")
          self.compression = "bf16"
          self.model.float()
      else:
          torch.save(self.model.state_dict(), path / "ckpt.pth")
          self.compression = "fp32"
  
imports: from logging import warning
  import torch
  import os
  from contextlib import redirect_stdout
  from bigdl.nano.utils.pytorch import generate_channels_last_available, apply_proper_channels_last
  from bigdl.nano.pytorch.model import AcceleratedLightningModule
  from bigdl.nano.utils.common import invalidInputError
  from bigdl.nano.utils.pytorch import TORCH_VERSION_LESS_1_10, TORCH_VERSION_LESS_1_12, transform_state_dict_to_dtype
  from bigdl.nano.utils.common import _bf16_checker
  from bigdl.nano.pytorch.context_manager import generate_context_manager
label_desc: Use image node_id 12 for calling the BF16Model obj's underlying member method code with example usage: obj._save_model(path, compression) without return types