code: def fake_palette_from_recipe(module, recipe):
      tot_bits = 0
      tot_numel = 0
      for name, submodule in tqdm(module.named_modules()):
          if hasattr(submodule, "weight"):
              tot_numel += submodule.weight.numel()
              if name in recipe:
                  nbits = recipe[name]
                  assert nbits in NBITS + [16]
                  tot_bits += submodule.weight.numel() * nbits
                  if nbits == 16:
                      continue
                  fake_palettize(submodule, nbits=nbits)
              else:
                  tot_bits += submodule.weight.numel() * 16
  
      logger.info(
          f"Palettized to {tot_bits/tot_numel:.2f}-bits mixed palette ({tot_bits/8e6} MB) "
      )
  
imports: from collections import OrderedDict
  from copy import deepcopy
  from functools import partial
  import argparse
  import gc
  import json
  import logging
  import numpy
  import os
  from PIL import Image
  from python_coreml_stable_diffusion.torch2coreml import compute_psnr, get_pipeline
  import time
  import torch
  import torch.nn
  import requests
  from tqdm import tqdm, trange
  from coremltools.converters.mil.mil import types
label_desc: Use image node_id 7 for calling a global function with example usage: fake_palette_from_recipe(module, recipe) without return types