code: def _parse_kwargs_to_mii_config(
      model_name_or_path: str = "",
      model_config: Optional[Dict[str, Any]] = None,
      mii_config: Optional[Dict[str, Any]] = None,
      **kwargs,
  ) -> MIIConfig:
      if mii_config is None:
          mii_config = {}
  
      if model_config is None:
          model_config = mii_config.get("model_config", {})
  
      # Parse all model_config kwargs
      model_config, remaining_kwargs = _parse_kwargs_to_model_config(
          model_name_or_path=model_name_or_path,
          model_config=model_config,
          **kwargs,
      )
  
      assert isinstance(mii_config, dict), "mii_config must be a dict"
  
      mii_config["model_config"] = model_config
  
      # Fill mii_config dict with relevant kwargs, raise error on unknown kwargs
      for key, val in remaining_kwargs.items():
          if key in MIIConfig.__dict__["__fields__"]:
              if key in mii_config:
                  assert (
                      mii_config.get(key) == val
                  ), f"{key} in mii_config must match {key}"
              mii_config[key] = val
          else:
              raise UnknownArgument(
                  f"Keyword argument {key} not recognized"
              )
  
      # Return the MIIConfig object
      mii_config = MIIConfig(**mii_config)
      return mii_config
  
file_path: deepspeed-mii/mii/api.py
imports: from typing import Optional, Any, Dict, Tuple, Union
  import mii
  from mii.backend import MIIClient
  from mii.batching import MIIPipeline, MIIAsyncPipeline
  from mii.config import get_mii_config, ModelConfig, MIIConfig
  from mii.constants import DeploymentType
  from mii.errors import UnknownArgument
  from mii.modeling.models import load_model
  from mii.score import create_score_file
  from mii.modeling.tokenizers import load_tokenizer
  from mii.utils import import_score_file
label_desc: Use image node_id 2 for calling a global function with example usage: _parse_kwargs_to_mii_config(model_name_or_path, model_config, mii_config) and returns: mii_config