Skip to content

Gemma2 reward model support#1954

Merged
merrymercy merged 2 commits intosgl-project:mainfrom
aqweteddy:gemma2-rm
Nov 8, 2024
Merged

Gemma2 reward model support#1954
merrymercy merged 2 commits intosgl-project:mainfrom
aqweteddy:gemma2-rm

Conversation

@aqweteddy
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
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
@zhaochenyang20 zhaochenyang20 mentioned this pull request Mar 3, 2025
22 tasks
timethink pushed a commit to timethink/sglang that referenced this pull request Mar 9, 2025
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