class_docstr: SockeyeModel shares components needed for both training and inference.
  The main components of a Sockeye model are
  1) Source embedding
  2) Target embedding
  3) Encoder
  4) Decoder
  5) Output Layer
  
  ModelConfig contains parameters and their values that are fixed at training time and must be re-used at inference
  time.
  
  :param config: Model configuration.
  :param inference_only: Use the model only for inference, enabling optimizations.
  :param clamp_to_dtype: Avoid -inf/inf by clamping outputs to min/max finite values for their dtype.
class_docstr_tok: ["SockeyeModel","shares","components","needed","for","both","training","and","inference",".","The","main","components","of","a","Sockeye","model","are","1",")","Source","embedding","2",")","Target","embedding","3",")","Encoder","4",")","Decoder","5",")","Output","Layer","ModelConfig","contains","parameters","and","their","values","that","are","fixed","at","training","time","and","must","be","re-used","at","inference","time",".",":","param","config",":","Model","configuration",".",":","param","inference_only",":","Use","the","model","only","for","inference",",","enabling","optimizations",".",":","param","clamp_to_dtype",":","Avoid","-inf\/inf","by","clamping","outputs","to","min\/max","finite","values","for","their","dtype","."]
docstr: Loads parameters from file previously saved by `save_parameters`.
  See https://pytorch.org/tutorials/beginner/saving_loading_models.html#saving-loading-model-for-inference
  
  :param filename: Path to parameter file
  :param device: Torch device to load parameters to. Default: cpu.
  :param allow_missing: Whether to silently skip loading parameters not represents in the file. Default: False.
  :param ignore_extra: Whether to silently ignore parameters from the file that are not part of this Module.
                       Default: False.
docstr_tok: ["Loads","parameters","from","file","previously","saved","by","`","save_parameters","`",".","See","https",":","\/\/pytorch.org\/tutorials\/beginner\/saving_loading_models.html","#","saving-loading-model-for-inference",":","param","filename",":","Path","to","parameter","file",":","param","device",":","Torch","device","to","load","parameters","to",".","Default",":","cpu",".",":","param","allow_missing",":","Whether","to","silently","skip","loading","parameters","not","represents","in","the","file",".","Default",":","False",".",":","param","ignore_extra",":","Whether","to","silently","ignore","parameters","from","the","file","that","are","not","part","of","this","Module",".","Default",":","False","."]
code: def load_parameters(
      self,
      filename: str,
      device: Optional[pt.device] = pt.device("cpu"),
      allow_missing: bool = False,
      ignore_extra: bool = False,
  ):
      """
      Loads parameters from file previously saved by `save_parameters`.
      See https://pytorch.org/tutorials/beginner/saving_loading_models.html#saving-loading-model-for-inference
  
      :param filename: Path to parameter file
      :param device: Torch device to load parameters to. Default: cpu.
      :param allow_missing: Whether to silently skip loading parameters not represents in the file. Default: False.
      :param ignore_extra: Whether to silently ignore parameters from the file that are not part of this Module.
                           Default: False.
      """
  
      utils.check_condition(
          os.path.exists(filename),
          "No model parameter file found under %s. "
          "This is either not a model directory or the first training "
          "checkpoint has not happened yet." % filename,
      )
      state_dict = pt.load(filename, map_location=device)
      missing, unexpected = self.load_state_dict(
          state_dict, strict=False
      )
      # Earlier versions of Sockeye may have saved parameters for traced
      # modules. These parameters can be safely ignored.
      unexpected = [
          key
          for key in unexpected
          if "traced" not in key and "cached" not in key
      ]
      # We also ignore cases where traced modules exist and appear to be
      # missing parameters. These modules actually use the same parameters as
      # their original non-traced versions so there are no separate parameters
      # to load.
      missing = [
          key
          for key in missing
          if "traced" not in key and "cached" not in key
      ]
      if not allow_missing:
          utils.check_condition(not missing, f"missing keys: {missing}")
      if not ignore_extra:
          utils.check_condition(
              not unexpected, f"extra keys: {unexpected}"
          )
      # Models are saved with interleaved key-value params.
      for module in self.modules():
          if hasattr(module, "kv_interleaved") and isinstance(
              module.kv_interleaved, bool
          ):
              module.kv_interleaved = True  # type: ignore
      # If the current model is in training mode, separate the loaded params
      # to match the format used during training.
      if self.training:
          self.apply(layers.separate_kv)
      logger.info('Loaded params from "%s" to "%s"', filename, device)
  
imports: import copy
  import logging
  import os
  import time
  from dataclasses import dataclass
  from functools import lru_cache
  from typing import cast, Dict, List, Optional, Tuple, Union
  import numpy
  import torch
  from sockeye import __version__
  from .None import constants
  from .None import data_io
  from .None import decoder
  from .None import encoder
  from .None import layers
  from .None import transformer
  from .None import utils
  from .None import vocab
  from .config import Config
  from .encoder import FactorConfig
  from .layers import LengthRatioConfig
  from .None import nvs
  from sockeye.knn import KNNConfig
label_desc: Use image node_id 15 for calling the SockeyeModel obj's underlying member method code with example usage: obj.load_parameters(filename, device, allow_missing, ignore_extra) without return types