code: def _parse_kwargs_to_model_config(
      model_name_or_path: str = "",
      model_config: Optional[Dict[str, Any]] = None,
      **kwargs,
  ) -> Tuple[ModelConfig, Dict[str, Any]]:
      if model_config is None:
          model_config = {}
  
      assert isinstance(
          model_config, dict
      ), "model_config must be a dict"
  
      # If model_name_or_path is set in model config, make sure it matches the kwarg
      if model_name_or_path:
          if "model_name_or_path" in model_config:
              assert (
                  model_config.get("model_name_or_path")
                  == model_name_or_path
              ), "model_name_or_path in model_config must match model_name_or_path"
          model_config["model_name_or_path"] = model_name_or_path
  
      # Fill model_config dict with relevant kwargs, store remaining kwargs in a new dict
      remaining_kwargs = {}
      for key, val in kwargs.items():
          if key in ModelConfig.__dict__["__fields__"]:
              if key in model_config:
                  assert (
                      model_config.get(key) == val
                  ), f"{key} in model_config must match {key}"
              model_config[key] = val
          else:
              remaining_kwargs[key] = val
  
      # Create the ModelConfig object and return it with remaining kwargs
      model_config = ModelConfig(**model_config)
      return model_config, remaining_kwargs
  
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 1 for calling a global function with example usage: _parse_kwargs_to_model_config(model_name_or_path, model_config) and returns: model_config,  remaining_kwargs