docstr: Save the model to local file.
  
  :param model: Any model of torch.nn.Module, including all models accelareted by
         InferenceOptimizer.trace/InferenceOptimizer.quantize.
  :param path: Path to saved model. Path should be a directory.
  :param compression: str. This parameter only effective for jit, ipex or pure
         pytorch model with fp32 or bf16 precision. Defaultly, all models are saved
         by dtype=fp32 for their parameters. If users set a lower precision, a smaller
         file sill be saved with some accuracy loss. Users always need to use nano
         to load the compressed file if compression is set other than "fp32".
         Currently, "bf16" and "fp32"(default) are supported.
docstr_tok: ["Save","the","model","to","local","file",".",":","param","model",":","Any","model","of","torch.nn.Module",",","including","all","models","accelareted","by","InferenceOptimizer.trace\/InferenceOptimizer.quantize",".",":","param","path",":","Path","to","saved","model",".","Path","should","be","a","directory",".",":","param","compression",":","str",".","This","parameter","only","effective","for","jit",",","ipex","or","pure","pytorch","model","with","fp32","or","bf16","precision",".","Defaultly",",","all","models","are","saved","by","dtype=fp32","for","their","parameters",".","If","users","set","a","lower","precision",",","a","smaller","file","sill","be","saved","with","some","accuracy","loss",".","Users","always","need","to","use","nano","to","load","the","compressed","file","if","compression","is","set","other","than","``","fp32","''",".","Currently",",","``","bf16","''","and","``","fp32","''","(","default",")","are","supported","."]
code: def save(model: nn.Module, path, compression="fp32"):
      """
      Save the model to local file.
  
      :param model: Any model of torch.nn.Module, including all models accelareted by
             InferenceOptimizer.trace/InferenceOptimizer.quantize.
      :param path: Path to saved model. Path should be a directory.
      :param compression: str. This parameter only effective for jit, ipex or pure
             pytorch model with fp32 or bf16 precision. Defaultly, all models are saved
             by dtype=fp32 for their parameters. If users set a lower precision, a smaller
             file sill be saved with some accuracy loss. Users always need to use nano
             to load the compressed file if compression is set other than "fp32".
             Currently, "bf16" and "fp32"(default) are supported.
      """
      save_model(model, path, compression)
  
imports: import torch
  from torch import nn
  import time
  import sigfig
  import multiprocessing
  from typing import Dict, Callable, Tuple, Optional, List, Union, Sequence, Mapping
  from torch.utils.data import DataLoader
  from torchmetrics.metric import Metric
  from bigdl.nano.utils.common import AccelerationOption, available_acceleration_combination, latency_calculate_helper, torch_loader_latency_calculate_helper, format_optimize_result, BaseInferenceOptimizer
  from bigdl.nano.utils.common import invalidInputError
  from bigdl.nano.pytorch.amp import BF16Model
  from bigdl.nano.pytorch.low_precision.jit_int8_api import PytorchJITINT8Model
  from bigdl.nano.deps.openvino.openvino_api import PytorchOpenVINOModel
  from bigdl.nano.deps.ipex.ipex_api import PytorchIPEXJITModel, PytorchIPEXJITBF16Model, PytorchIPEXQuantizationModel, PytorchIPEXPUModel
  from bigdl.nano.deps.onnxruntime.onnxruntime_api import PytorchONNXRuntimeModel
  from bigdl.nano.deps.neural_compressor.inc_api import quantize
  from bigdl.nano.pytorch.model import AcceleratedLightningModule
  from bigdl.nano.utils.pytorch import get_forward_args, get_input_example
  from bigdl.nano.utils.pytorch import NanoMetric
  from bigdl.nano.utils.pytorch import RepeatDataset, remove_batch_dim_fn
  from bigdl.nano.utils.pytorch import transform_multiple_input_dataloader_to_inc_mode, automatic_add_label_in_dataloader
  from bigdl.nano.utils.pytorch import TORCH_VERSION_LESS_1_10
  from bigdl.nano.utils.pytorch import save_model, load_model
  from bigdl.nano.utils.common import schedule_processors
  from bigdl.nano.utils.common import EnvContext
  from bigdl.nano.pytorch.context_manager import generate_context_manager, BaseContextManager, AutocastContextManager
  from .multi_instance import _MultiInstanceModel, _multi_instance_helper
  import traceback
  import warnings
  import os
label_desc: Use image node_id 5 for calling the InferenceOptimizer obj's underlying member method code with example usage: obj.save(model, path, compression) without return types