Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ppo_freeze mat1 mat2 should have the same dtype #5480

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
19 changes: 19 additions & 0 deletions src/llamafactory/model/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,25 @@ def _setup_freeze_tuning(
else:
param.requires_grad_(False)

'''在使用ppo_freeze的时候,model为qwen1.5-0.5b的时候,第一次load actor model的时候添加数据类型的转换
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we change to english? :)

config文件:
model_name_or_path: /LLMs/Qwen1.5-0.5B-Chat
reward_model: /output/Qwen1.5-0.5B-Chat/full/reward
reward_model_type: full

### method
stage: ppo
do_train: true
finetuning_type: freeze
freeze_extra_modules: lm_head

'''
if finetuning_args.stage == "ppo":
for name, param in model.named_parameters():
if not any(forbidden_module in name for forbidden_module in forbidden_modules):
if cast_trainable_params_to_fp32:
param.data = param.data.to(torch.float32)

logger.info("Set trainable layers: {}".format(",".join(trainable_layers)))


Expand Down