mct-nightly 2.1.0.20240813.442__py3-none-any.whl → 2.1.0.20240813.141729__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mct-nightly
3
- Version: 2.1.0.20240813.442
3
+ Version: 2.1.0.20240813.141729
4
4
  Summary: A Model Compression Toolkit for neural networks
5
5
  Home-page: UNKNOWN
6
6
  License: UNKNOWN
@@ -1,4 +1,4 @@
1
- model_compression_toolkit/__init__.py,sha256=TfJUGlJPIuxH63h0s2ppXvyeiTCGanUIGaxWyU1e6XE,1573
1
+ model_compression_toolkit/__init__.py,sha256=4Ah8Ywj3HTi7gOBoXzHjZ7FBnpJqziSb4iuxGWzX9R8,1573
2
2
  model_compression_toolkit/constants.py,sha256=i4wYheBkIdQmsQA-axIpcT3YiSO1USNc-jaNiNE8w6E,3920
3
3
  model_compression_toolkit/defaultdict.py,sha256=LSc-sbZYXENMCw3U9F4GiXuv67IKpdn0Qm7Fr11jy-4,2277
4
4
  model_compression_toolkit/logger.py,sha256=3DByV41XHRR3kLTJNbpaMmikL8icd9e1N-nkQAY9oDk,4567
@@ -99,7 +99,7 @@ model_compression_toolkit/core/common/pruning/mask/__init__.py,sha256=huHoBUcKNB
99
99
  model_compression_toolkit/core/common/pruning/mask/per_channel_mask.py,sha256=APY8BsM9B7ZxVCH6n1xs9fSCTB_A9ou9gHrCQl1DOdI,5131
100
100
  model_compression_toolkit/core/common/pruning/mask/per_simd_group_mask.py,sha256=4ohJrJHNzZk5uMnZEYkwLx2TDGzkh5kRhLGNVYNC6dc,5978
101
101
  model_compression_toolkit/core/common/quantization/__init__.py,sha256=sw7LOPN1bM82o3SkMaklyH0jw-TLGK0-fl2Wq73rffI,697
102
- model_compression_toolkit/core/common/quantization/bit_width_config.py,sha256=r6VQXgyJxX_AM1JTzv-sTcrvCTnktBfOkVP20RllNmk,4586
102
+ model_compression_toolkit/core/common/quantization/bit_width_config.py,sha256=IXHkpI9bH3AbrpC5T5bNYHcojHzeWQrrCpV-xZj5pks,5021
103
103
  model_compression_toolkit/core/common/quantization/candidate_node_quantization_config.py,sha256=yU-Cr6S4wOSkDk57iH2NVe-WII0whOhLryejkomCOt4,4940
104
104
  model_compression_toolkit/core/common/quantization/core_config.py,sha256=f0uSuY9mX-vLX_1s2DemPARQlAXmLPKJKPtCArz3pZI,2670
105
105
  model_compression_toolkit/core/common/quantization/debug_config.py,sha256=8G8SpE_4rb8xBp8d6mMq8R_OnXJ_1oxB2g-Lxk9EJCM,1691
@@ -202,7 +202,7 @@ model_compression_toolkit/core/keras/quantizer/lut_fake_quant.py,sha256=Up3-sbuA
202
202
  model_compression_toolkit/core/keras/reader/__init__.py,sha256=mjbqLD-KcG3eNeCYpu1GBS7VclGVOQ63x2p6mAAuba4,698
203
203
  model_compression_toolkit/core/keras/reader/common.py,sha256=eZWjBcvTDUX7fCWmy1OAH4lYLFTh59_UQ_nP_Gjp4yw,2594
204
204
  model_compression_toolkit/core/keras/reader/connectivity_handler.py,sha256=AgF6qXZOJMeXvc-pBnGY23BJz7wPBx2aTYxHiO8efec,11303
205
- model_compression_toolkit/core/keras/reader/node_builder.py,sha256=NDgrEiy2WEe9k5ZuBaTynCFpwNrVIEIDdG_HNjI4MAM,14129
205
+ model_compression_toolkit/core/keras/reader/node_builder.py,sha256=2LXL4Vv5nHiRIX9lBpY4nRrJwDm8JhHeybS9V_QtqJQ,14211
206
206
  model_compression_toolkit/core/keras/reader/reader.py,sha256=wS9UQ2wJKnkZYe9JHwQp7ygDr6CRlzrxmIyLDv1Qz6U,8109
207
207
  model_compression_toolkit/core/keras/reader/nested_model/__init__.py,sha256=mjbqLD-KcG3eNeCYpu1GBS7VclGVOQ63x2p6mAAuba4,698
208
208
  model_compression_toolkit/core/keras/reader/nested_model/edges_merger.py,sha256=K6KAH9o8KSG6baLmhKoCrYK-i-wb6gRKiZmoijFqEYA,7906
@@ -512,7 +512,7 @@ model_compression_toolkit/xquant/common/model_analyzer.py,sha256=T_8OetIQNqR0nkf
512
512
  model_compression_toolkit/xquant/common/model_folding_utils.py,sha256=7XMNmsngJgCPVjsuMNt6g4hzhkviB45qUmNRe9jQE7g,4815
513
513
  model_compression_toolkit/xquant/common/similarity_calculator.py,sha256=yCs_vlOThLzq7z-u2PkcEErLj7N7qCBPpRa6_5h34J8,10460
514
514
  model_compression_toolkit/xquant/common/similarity_functions.py,sha256=Atah1otdX9oUUch2JK-p-e291QHtkP_c4DfLG9WWo1Y,2935
515
- model_compression_toolkit/xquant/common/tensorboard_utils.py,sha256=85ABGQGKPZzctyZCHLazK0GxZ2ZUtQA3hZ_9fPiuMs0,6533
515
+ model_compression_toolkit/xquant/common/tensorboard_utils.py,sha256=6ZDbGHnCzSxJicWoS60GBd5HTfZuBBw1HkM7rj3Ki5w,6610
516
516
  model_compression_toolkit/xquant/common/xquant_config.py,sha256=Qt56cra2tU1PeHlLx_Cqztf5q-ED8MPelhb8coSumFw,1675
517
517
  model_compression_toolkit/xquant/keras/__init__.py,sha256=zbtceCVRsi-Gvl_pOmq5laqVqu55vAU1ie2FR2RK1Po,709
518
518
  model_compression_toolkit/xquant/keras/dataset_utils.py,sha256=quvVymhvpcPIOneCu5J6K_QAqBHOCIj8IxZxSN2fItA,2258
@@ -520,16 +520,16 @@ model_compression_toolkit/xquant/keras/facade_xquant_report.py,sha256=7pf3PUMAj7
520
520
  model_compression_toolkit/xquant/keras/keras_report_utils.py,sha256=zUvhqehKKRHEkk6y8g1xQH47b6fTMuPy6stGEZ6mI24,3081
521
521
  model_compression_toolkit/xquant/keras/model_analyzer.py,sha256=WXi9BPI9_TzRWn50lM1i-6cwPPRW0p43Shg_xpHFclU,6521
522
522
  model_compression_toolkit/xquant/keras/similarity_functions.py,sha256=P2qMJAo94Sz_BCao-bnhEeewKtjeLLDDH2r9luDXJ04,2710
523
- model_compression_toolkit/xquant/keras/tensorboard_utils.py,sha256=635ZcK6_5jdpa7G6Tjq0hkveEYLJQyYRXCFCKL0EioM,9163
523
+ model_compression_toolkit/xquant/keras/tensorboard_utils.py,sha256=h67lf_agZwOuzF37or1YSF1dbTCdw-b3UyvTeRXhTp8,9225
524
524
  model_compression_toolkit/xquant/pytorch/__init__.py,sha256=ycb1Xt7PtixY2Uabr94JGSwBMcct66O8ZMVf3Qa3ud8,719
525
525
  model_compression_toolkit/xquant/pytorch/dataset_utils.py,sha256=KFKiFkhIPpEr1ZH5jekZFrgs20VzzKVxSV9YMgH68yI,2894
526
526
  model_compression_toolkit/xquant/pytorch/facade_xquant_report.py,sha256=sr_7TkmkRE0FhdJ7BwXGLFELmR4l_nK7IlTys6oYgoU,3179
527
527
  model_compression_toolkit/xquant/pytorch/model_analyzer.py,sha256=b93o800yVB3Z-ihJBLy5Cic-MQiUM_ZGV6SCXoNdscE,5549
528
528
  model_compression_toolkit/xquant/pytorch/pytorch_report_utils.py,sha256=bOc-hFL3gdoSM1Th_S2N_-9JJSlPGpZCTx_QLJHS6lg,3388
529
529
  model_compression_toolkit/xquant/pytorch/similarity_functions.py,sha256=CERxq5K8rqaiE-DlwhZBTUd9x69dtYJlkHOPLB54vm8,2354
530
- model_compression_toolkit/xquant/pytorch/tensorboard_utils.py,sha256=yjghWXxqOtT-QXoXBOuJyh45yUpFI0pKjdDegum2i68,9705
531
- mct_nightly-2.1.0.20240813.442.dist-info/LICENSE.md,sha256=aYSSIb-5AFPeITTvXm1UAoe0uYBiMmSS8flvXaaFUks,10174
532
- mct_nightly-2.1.0.20240813.442.dist-info/METADATA,sha256=BuAU5P_gzUVjd4HUhpx1TKL9kRd878YqLWwXvz8pglY,19718
533
- mct_nightly-2.1.0.20240813.442.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
534
- mct_nightly-2.1.0.20240813.442.dist-info/top_level.txt,sha256=gsYA8juk0Z-ZmQRKULkb3JLGdOdz8jW_cMRjisn9ga4,26
535
- mct_nightly-2.1.0.20240813.442.dist-info/RECORD,,
530
+ model_compression_toolkit/xquant/pytorch/tensorboard_utils.py,sha256=mkoEktLFFHtEKzzFRn_jCnxjhJolK12TZ5AQeDHzUO8,9767
531
+ mct_nightly-2.1.0.20240813.141729.dist-info/LICENSE.md,sha256=aYSSIb-5AFPeITTvXm1UAoe0uYBiMmSS8flvXaaFUks,10174
532
+ mct_nightly-2.1.0.20240813.141729.dist-info/METADATA,sha256=rKrCpumEkmoyMZLUBKH25qud3SqUEXdhHnBzP9nqdrE,19721
533
+ mct_nightly-2.1.0.20240813.141729.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
534
+ mct_nightly-2.1.0.20240813.141729.dist-info/top_level.txt,sha256=gsYA8juk0Z-ZmQRKULkb3JLGdOdz8jW_cMRjisn9ga4,26
535
+ mct_nightly-2.1.0.20240813.141729.dist-info/RECORD,,
@@ -27,4 +27,4 @@ from model_compression_toolkit import data_generation
27
27
  from model_compression_toolkit import pruning
28
28
  from model_compression_toolkit.trainable_infrastructure.keras.load_model import keras_load_quantized_model
29
29
 
30
- __version__ = "2.1.0.20240813.000442"
30
+ __version__ = "2.1.0.20240813.141729"
@@ -87,5 +87,10 @@ class BitWidthConfig:
87
87
  if len(filtered_nodes) == 0:
88
88
  Logger.critical(f"Node Filtering Error: No nodes found in the graph for filter {manual_bit_width_selection.filter.__dict__} "
89
89
  f"to change their bit width to {manual_bit_width_selection.bit_width}.")
90
- nodes_to_change_bit_width.update({n: manual_bit_width_selection.bit_width for n in filtered_nodes})
90
+ for n in filtered_nodes:
91
+ # check if a manual configuration exists for this node
92
+ if n in nodes_to_change_bit_width:
93
+ Logger.info(
94
+ f"Node {n} has an existing manual bit width configuration of {nodes_to_change_bit_width.get(n)}. A new manual configuration request of {manual_bit_width_selection.bit_width} has been received, and the previous value is being overridden.")
95
+ nodes_to_change_bit_width.update({n: manual_bit_width_selection.bit_width})
91
96
  return nodes_to_change_bit_width
@@ -43,7 +43,8 @@ layers = keras.layers
43
43
 
44
44
  REUSED_IDENTIFIER = '_reused_'
45
45
 
46
- is_const = lambda x: isinstance(x, (tf.Variable, tf.Tensor, np.ndarray, tuple, list))
46
+ is_const = lambda x: isinstance(x, (tf.Variable, tf.Tensor, np.ndarray)) or \
47
+ (isinstance(x, (tuple, list)) and not isinstance(x[0], (int, dict)))
47
48
  is_tensor = lambda x: isinstance(x, KerasTensor)
48
49
 
49
50
 
@@ -115,12 +115,14 @@ class TensorboardUtils:
115
115
  similarity_metrics (Dict[str, Dict[str, float]]): A dictionary containing similarity metrics between quantized and float models for both representative and validation datasets.
116
116
  quantized_model_metadata (Dict): Metadata from the quantized model.
117
117
  """
118
- # Add the computed max cut
119
- maxcut_str = f"MaxCut: {quantized_model_metadata['scheduling_info'][MAX_CUT]}"
120
- self.tb_writer.add_text(maxcut_str, MAX_CUT)
121
-
122
118
  # Add output similarity between quantized and float models on representative and validation datasets
123
119
  output_similarity_repr = f"Similarity Metrics on outputs using representative dataset: \n" + "\n".join([f"{key}: {value:.4f}" for key, value in similarity_metrics[OUTPUT_SIMILARITY_METRICS_REPR].items()])
124
120
  output_similarity_val = f"Similarity Metrics on outputs using validation dataset: \n" + "\n".join([f"{key}: {value:.4f}" for key, value in similarity_metrics[OUTPUT_SIMILARITY_METRICS_VAL].items()])
125
121
  self.tb_writer.add_text(output_similarity_repr, OUTPUT_SIMILARITY_METRICS_REPR)
126
122
  self.tb_writer.add_text(output_similarity_val, OUTPUT_SIMILARITY_METRICS_VAL)
123
+
124
+ # Add the max cut if it was computed
125
+ if 'scheduling_info' in quantized_model_metadata:
126
+ maxcut_str = f"MaxCut: {quantized_model_metadata['scheduling_info'][MAX_CUT]}"
127
+ self.tb_writer.add_text(maxcut_str, MAX_CUT)
128
+
@@ -76,7 +76,8 @@ class KerasTensorboardUtils(TensorboardUtils):
76
76
  # Read the quantized model into a graph structure.
77
77
  quant_graph = model_reader(quantized_model)
78
78
 
79
- insert_cut_info_into_graph(quant_graph, quantized_model_metadata)
79
+ if 'scheduling_info' in quantized_model_metadata:
80
+ insert_cut_info_into_graph(quant_graph, quantized_model_metadata)
80
81
 
81
82
  # Iterate over each node in the graph.
82
83
  for node in quant_graph.nodes:
@@ -79,7 +79,8 @@ class PytorchTensorboardUtils(TensorboardUtils):
79
79
  to_tensor=self.fw_impl.to_tensor,
80
80
  to_numpy=self.fw_impl.to_numpy)
81
81
 
82
- insert_cut_info_into_graph(quant_graph, quantized_model_metadata, quantized_model)
82
+ if 'scheduling_info' in quantized_model_metadata:
83
+ insert_cut_info_into_graph(quant_graph, quantized_model_metadata, quantized_model)
83
84
 
84
85
  # Iterate through each node in the graph
85
86
  for node in quant_graph.nodes: