Skip to content

[grpo] support gen rm #4151

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

Merged
merged 25 commits into from
May 11, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix task type
  • Loading branch information
hjh0119 committed May 11, 2025
commit ed45d41e8f673e97ffa6c5cfcca6e5d7b5ded4ce
12 changes: 9 additions & 3 deletions swift/llm/train/rlhf.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,15 @@ def prepare_single_model(key, origin_key=None):
)
task_type = None
num_labels = None
model_args = BaseArguments.from_pretrained(model_dir)
if hasattr(model_args, task_type):
task_type = model_args.task_type
if not os.path.exists(os.path.join(model_dir, 'args.json')):
model_args = BaseArguments.from_pretrained(model_dir)
if hasattr(model_args, 'task_type'):
task_type = model_args.task_type
else:
from transformers import AutoConfig
model_config = AutoConfig.from_pretrained(model_dir, trust_remote_code=True)
if hasattr(model_config, 'task_type'):
task_type = model_config.task_type
if task_type == 'seq_cls':
num_labels = 1

Expand Down