code: def test_clean_device_map(self):
      # Regroup everything if all is on the same device
      self.assertDictEqual(
          clean_device_map({"a": 0, "b": 0, "c": 0}), {"": 0}
      )
      # Regroups children of level 1 on the same device
      self.assertDictEqual(
          clean_device_map(
              {"a.x": 0, "a.y": 0, "b.x": 1, "b.y": 1, "c": 1}
          ),
          {"a": 0, "b": 1, "c": 1},
      )
      # Regroups children of level 2 on the same device
      self.assertDictEqual(
          clean_device_map(
              {
                  "a.x": 0,
                  "a.y": 0,
                  "b.x.0": 1,
                  "b.x.1": 1,
                  "b.y.0": 2,
                  "b.y.1": 2,
                  "c": 2,
              }
          ),
          {"a": 0, "b.x": 1, "b.y": 2, "c": 2},
      )
  
imports: import json
  import os
  import tempfile
  import unittest
  from collections import OrderedDict
  import torch
  import torch.nn
  from safetensors.torch import save_file
  from accelerate import init_empty_weights
  from accelerate.test_utils import require_cuda, require_huggingface_suite, require_multi_gpu
  from accelerate.utils.modeling import check_device_map, clean_device_map, compute_module_sizes, convert_file_size_to_int, find_tied_parameters, get_balanced_memory, infer_auto_device_map, load_checkpoint_in_model, load_state_dict, named_module_tensors, retie_parameters, set_module_tensor_to_device
label_desc: Use image node_id 19 for calling the ModelingUtilsTester obj's underlying member method code with example usage: obj.test_clean_device_map() without return types