From 6ab53db634a74bf6c7addbc1da48d6d5a78ea974 Mon Sep 17 00:00:00 2001 From: Chenhan Yu Date: Thu, 5 Mar 2026 11:14:25 -0800 Subject: [PATCH 1/3] fix: https://github.com/NVIDIA/Model-Optimizer/issues/981 Signed-off-by: Chenhan Yu --- modelopt/torch/opt/plugins/mcore_dist_checkpointing.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modelopt/torch/opt/plugins/mcore_dist_checkpointing.py b/modelopt/torch/opt/plugins/mcore_dist_checkpointing.py index 3e5b35946..8a2f38a68 100644 --- a/modelopt/torch/opt/plugins/mcore_dist_checkpointing.py +++ b/modelopt/torch/opt/plugins/mcore_dist_checkpointing.py @@ -149,6 +149,12 @@ def _parse_transformer_config(transformer_config: dict) -> dict: config[k] = v else: config[k] = str(v) + # Handle https://github.com/NVIDIA/Model-Optimizer/issues/981 where + # hierarchical_context_parallel_sizes: [8, 2] will raise a TypeError. + try: + config[k] = str(v) + except (AttributeError, TypeError): + config[k] = repr(type(v)) return config From 014c1a007f01729c2269ce6e4383fcb0dcfe1abc Mon Sep 17 00:00:00 2001 From: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com> Date: Fri, 6 Mar 2026 00:52:45 +0530 Subject: [PATCH 2/3] Update modelopt/torch/opt/plugins/mcore_dist_checkpointing.py Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com> --- modelopt/torch/opt/plugins/mcore_dist_checkpointing.py | 1 - 1 file changed, 1 deletion(-) diff --git a/modelopt/torch/opt/plugins/mcore_dist_checkpointing.py b/modelopt/torch/opt/plugins/mcore_dist_checkpointing.py index 8a2f38a68..10c04b43d 100644 --- a/modelopt/torch/opt/plugins/mcore_dist_checkpointing.py +++ b/modelopt/torch/opt/plugins/mcore_dist_checkpointing.py @@ -148,7 +148,6 @@ def _parse_transformer_config(transformer_config: dict) -> dict: if isinstance(v, (bool, int, str)): config[k] = v else: - config[k] = str(v) # Handle https://github.com/NVIDIA/Model-Optimizer/issues/981 where # hierarchical_context_parallel_sizes: [8, 2] will raise a TypeError. try: From 6e567e60cb5b385d5ee94faab03ef8a7abb19706 Mon Sep 17 00:00:00 2001 From: Chenhan Yu Date: Thu, 5 Mar 2026 14:05:25 -0800 Subject: [PATCH 3/3] chg: taking feedback to omit the field Signed-off-by: Chenhan Yu --- modelopt/torch/opt/plugins/mcore_dist_checkpointing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modelopt/torch/opt/plugins/mcore_dist_checkpointing.py b/modelopt/torch/opt/plugins/mcore_dist_checkpointing.py index 10c04b43d..a17b55f77 100644 --- a/modelopt/torch/opt/plugins/mcore_dist_checkpointing.py +++ b/modelopt/torch/opt/plugins/mcore_dist_checkpointing.py @@ -153,7 +153,7 @@ def _parse_transformer_config(transformer_config: dict) -> dict: try: config[k] = str(v) except (AttributeError, TypeError): - config[k] = repr(type(v)) + print("Warning: TransformerConfig.{} does not have _repr_ implemented.") return config