From 9c5f0cf504004355199c346b767e54c3c4df8502 Mon Sep 17 00:00:00 2001 From: Hongwei Chen <33092912+hwchen2017@users.noreply.github.com> Date: Tue, 29 Jul 2025 10:06:31 -0700 Subject: [PATCH] Revert "fix init weights issue for critic/reward model (#983)" This reverts commit 3d83278f2b27c79339a36e5974537c8a2833a176. Signed-off-by: Hongwei Chen --- applications/DeepSpeed-Chat/dschat/utils/model/model_utils.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/applications/DeepSpeed-Chat/dschat/utils/model/model_utils.py b/applications/DeepSpeed-Chat/dschat/utils/model/model_utils.py index 0a37fa299..050819a22 100644 --- a/applications/DeepSpeed-Chat/dschat/utils/model/model_utils.py +++ b/applications/DeepSpeed-Chat/dschat/utils/model/model_utils.py @@ -11,7 +11,6 @@ ) from huggingface_hub import snapshot_download from transformers.integrations.deepspeed import HfDeepSpeedConfig -from transformers.modeling_utils import no_init_weights from dschat.utils.model.reward_model import RewardModel from dschat.utils.utils import load_state_dict_into_model, print_rank_0 @@ -100,8 +99,7 @@ def create_hf_model(model_class, dschf = None if rlhf_training: # the weight loading is handled by create critic model - with no_init_weights(): - model = model_class.from_config(model_config) + model = model_class.from_config(model_config) else: model = model_class.from_pretrained( model_name_or_path,