Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
)
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
Expand Down Expand Up @@ -99,7 +100,8 @@ def create_hf_model(model_class,
dschf = None
if rlhf_training:
# the weight loading is handled by create critic model
model = model_class.from_config(model_config)
with no_init_weights():
model = model_class.from_config(model_config)
else:
model = model_class.from_pretrained(
model_name_or_path,
Expand Down