code: def get_palettizable_modules(unet, min_size=PALETTIZE_MIN_SIZE):
      ret = [
          (name, getattr(module, "weight").data.numel())
          for name, module in unet.named_modules()
          if isinstance(module, (nn.Linear, nn.Conv2d))
          if hasattr(module, "weight")
          and getattr(module, "weight").data.numel() > min_size
      ]
      candidates, sizes = [[a for a, b in ret], [b for a, b in ret]]
      logger.info(
          f"{len(candidates)} candidate tensors with {sum(sizes)/1e6} M total params"
      )
      return candidates, sizes
  
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 4 for calling a global function with example usage: get_palettizable_modules(unet, min_size) and returns: candidates,  sizes