From 3f680ce6b1f592935315c4d92e7abe17c7e4dee8 Mon Sep 17 00:00:00 2001 From: aoshen02 Date: Sun, 21 Jun 2026 06:38:20 +0000 Subject: [PATCH] fix(gpt-oss): update _patch_bridge_expert_cache_to_cpu to match Megatron-Bridge API radixark/Megatron-Bridge@bridge added a fourth parameter `hf_state_dict` to `ModelBridge.maybe_modify_converted_hf_weight`. The monkey-patch in `_patch_bridge_expert_cache_to_cpu` still used the old 3-arg signature, causing a TypeError when running GPT-OSS weight sync: TypeError: _patch_bridge_expert_cache_to_cpu.._patched() takes 3 positional arguments but 4 were given Fix: accept and forward the optional `hf_state_dict` argument. Co-Authored-By: Claude Sonnet 4.6 (1M context) --- .../megatron_utils/update_weight/hf_weight_iterator_bridge.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slime/backends/megatron_utils/update_weight/hf_weight_iterator_bridge.py b/slime/backends/megatron_utils/update_weight/hf_weight_iterator_bridge.py index edfd690482..8db37eb9b2 100644 --- a/slime/backends/megatron_utils/update_weight/hf_weight_iterator_bridge.py +++ b/slime/backends/megatron_utils/update_weight/hf_weight_iterator_bridge.py @@ -26,9 +26,9 @@ def _patch_bridge_expert_cache_to_cpu(): _orig = GPTOSSBridge.maybe_modify_converted_hf_weight - def _patched(self, task, converted_weights_dict): + def _patched(self, task, converted_weights_dict, hf_state_dict=None): cpu_dict = {k: v.cpu() for k, v in converted_weights_dict.items()} - result = _orig(self, task, cpu_dict) + result = _orig(self, task, cpu_dict, hf_state_dict) # Move merged result back to GPU for CUDA IPC serialization return {k: v.cuda() for k, v in result.items()} if result else result