code: def test_overwrite_deepspeed_config() -> None:
      base_ds_config = deepspeed_config
      source_ds_config = {
          "train_micro_batch_size_per_gpu": 2,
          "optimizer": {"params": {"lr": 0.001}},
      }
      expected_config = copy.deepcopy(deepspeed_config)
      expected_config["train_micro_batch_size_per_gpu"] = 2
      expected_config["optimizer"]["params"]["lr"] = 0.001
      result = det_deepspeed.overwrite_deepspeed_config(
          base_ds_config, source_ds_config
      )
      assert result == expected_config
  
      # Test load base deepspeed config from json file.
      base_ds_config = str(
          pathlib.Path(__file__)
          .resolve()
          .parent.parent.joinpath("fixtures/ds_config.json")
      )
      result = det_deepspeed.overwrite_deepspeed_config(
          base_ds_config, source_ds_config
      )
      assert result == expected_config
  
      # Test fail invalid base_ds_config argument.
      with pytest.raises(
          TypeError,
          match="Expected string or dict for base_ds_config argument.",
      ):
          _ = det_deepspeed.overwrite_deepspeed_config(
              [1, 2], source_ds_config
          )
  
imports: import copy
  import json
  import os
  import pathlib
  from typing import Any, Dict, Iterator, Optional
  import pytest
  import torch
  from deepspeed.runtime import config_utils
  import determined
  import determined.pytorch.deepspeed
  from determined import workload
  from tests.experiment import utils
  from tests.experiment.fixtures import deepspeed_linear_model
label_desc: Use image node_id 2 for calling a global function with example usage: test_overwrite_deepspeed_config() without return types