-
Notifications
You must be signed in to change notification settings - Fork 442
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b99eb6b
commit 0a54bb8
Showing
6 changed files
with
38 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
from . import (baai, baichuan, bert, codefuse, deepseek, gemma, glm, internlm, llama, llava, llm, mamba, microsoft, | ||
minicpm, mistral, mllm, mplug, openbuddy, qwen, telechat, yi) | ||
minicpm, mistral, mllm, mplug, openbuddy, qwen, telechat, yi, reward_model) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright (c) Alibaba, Inc. and its affiliates. | ||
from transformers import AutoConfig | ||
from transformers import AutoModel | ||
from swift.utils import get_logger | ||
from ..constant import LLMModelType | ||
from ..register import Model, ModelGroup, ModelMeta, get_model_tokenizer_from_local, register_model | ||
|
||
logger = get_logger() | ||
|
||
|
||
def get_model_tokenizer_reward_model(model_dir, *args, **kwargs): | ||
model_config = AutoConfig.from_pretrained(model_dir, trust_remote_code=True) | ||
if 'AutoModel' in (getattr(model_config, 'auto_map', None) or {}): | ||
kwargs['automodel_class'] = AutoModel | ||
return get_model_tokenizer_from_local(model_dir, *args, **kwargs) | ||
|
||
|
||
register_model( | ||
ModelMeta( | ||
LLMModelType.reward_model, [ | ||
ModelGroup([ | ||
Model('Qwen/Qwen2.5-Math-RM-72B', 'Qwen/Qwen2.5-Math-RM-72B'), | ||
Model('Qwen/Qwen2-Math-RM-72B', 'Qwen/Qwen2-Math-RM-72B'), | ||
]), | ||
ModelGroup([ | ||
Model('Shanghai_AI_Laboratory/internlm2-1_8b-reward', 'internlm/internlm2-1_8b-reward'), | ||
Model('Shanghai_AI_Laboratory/internlm2-7b-reward', 'internlm/internlm2-7b-reward'), | ||
Model('Shanghai_AI_Laboratory/internlm2-20b-reward', 'internlm/internlm2-20b-reward'), | ||
]), | ||
], | ||
None, | ||
get_model_tokenizer_reward_model, | ||
tags=['reward_model'])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters