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

Gemma2 reward model support #1954

Merged
merged 2 commits into from
Nov 8, 2024
Merged

Conversation

aqweteddy
Copy link
Contributor

Motivation

Support Gemma2 reward model, such as Skywork/Skywork-Reward-Gemma-2-27B-v0.2.

Modifications

  • add gemma2_reward.py in python/sglang/srt/models.
  • edit supported reward model in docs/references/supported_models.md.

Checklist

  • [V] Format your code according to the Contributor Guide.
  • [V] Add unit tests as outlined in the Contributor Guide.
  • [V] Update documentation as needed, including docstrings or example tutorials.

Comment on lines +60 to +63
hidden_states = self.model(input_ids, positions, forward_batch, input_embeds)
scores = self.score(hidden_states)

return self.pooler(scores, forward_batch)
Copy link
Contributor

@merrymercy merrymercy Nov 8, 2024

Choose a reason for hiding this comment

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

There is an optimization opportunity here. You can run self.pooler first and then run self.score. This can skip matmul for some dimensions and make it run faster. Can you try this in a follow-up PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've opened a new PR #1956.

@merrymercy merrymercy merged commit f16eb15 into sgl-project:main Nov 8, 2024
1 of 12 checks passed
leishaoSC added a commit to leishaoSC/sglang that referenced this pull request Nov 8, 2024
@merrymercy merrymercy mentioned this pull request Nov 24, 2024
37 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants