class_docstr: This class is testing the examples in https://coremltools.readme.io/v7.0/docs/data-free-palettization
code: def test_palettizer(self):
      from coremltools.optimize.coreml import (
          OpPalettizerConfig,
          OptimizationConfig,
          palettize_weights,
      )
  
      model = get_mlmodel()
      op_config = OpPalettizerConfig(
          mode="kmeans", nbits=6, weight_threshold=512
      )
      config = OptimizationConfig(global_config=op_config)
      compressed_6_bit_model = palettize_weights(model, config=config)
  
      # Some basic checks
      assert compressed_6_bit_model is not None
      ops = get_op_types_in_program(compressed_6_bit_model._mil_program)
      assert ops.count("constexpr_lut_to_dense") == 6
  
imports: import tempfile
  from coremltools.converters.mil.testing_utils import get_op_types_in_program
  from coremltools.test.optimize.coreml.test_passes import TestCompressionPasses
  from coremltools.test.optimize.coreml.test_passes import TestConfigurationFromDictFromYaml
label_desc: Use image node_id 1 for calling the TestPostTrainingPalettization obj's underlying member method code with example usage: obj.test_palettizer() without return types