Skip to content

Enable vLLM sleep mode for generation in Online DPO#4882

Merged
qgallouedec merged 5 commits intohuggingface:mainfrom
winglian:online-dpo-vllm-sleepmode
Jan 21, 2026
Merged

Enable vLLM sleep mode for generation in Online DPO#4882
qgallouedec merged 5 commits intohuggingface:mainfrom
winglian:online-dpo-vllm-sleepmode

Conversation

@winglian
Copy link
Contributor

What does this PR do?

Fixes # (issue)

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a GitHub issue? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

Copy link
Member

@lewtun lewtun left a comment

Choose a reason for hiding this comment

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

Thanks for the improvements @winglian ! LGTM with a question about the choice of sleep level


self.llm = LLM(**vllm_kwargs)
if self.args.vllm_enable_sleep_mode:
self.llm.sleep(level=1)
Copy link
Member

Choose a reason for hiding this comment

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

Any reason to choose level 1 vs level 2 (the latter also discards the model weights which is why we do it for GRPOTrainer): https://docs.vllm.ai/en/latest/features/sleep_mode/#sleep-levels

Copy link
Member

Choose a reason for hiding this comment

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

fair, we switched to mode 2 in #4296 for GRPO and RLOO. Let's do the same here

prompt_ids = [list(output.prompt_token_ids) for _ in range(2) for output in outputs]

if self.args.vllm_enable_sleep_mode:
self.llm.sleep(level=1)
Copy link
Member

Choose a reason for hiding this comment

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

Same comment here about level 1 vs level 2

@qgallouedec qgallouedec changed the title enable vllm sleep mode for generation in online dpo Enable vLLM sleep mode for generation in Online DPO Jan 21, 2026
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@qgallouedec qgallouedec merged commit 60e4674 into huggingface:main Jan 21, 2026
2 of 3 checks passed
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.

4 participants

Comments