-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
⚡ Fix GRPO PEFT #2725
base: main
Are you sure you want to change the base?
⚡ Fix GRPO PEFT #2725
Conversation
state_dict = unwrapped_model.state_dict() | ||
if isinstance(unwrapped_model, PeftModel): | ||
unwrapped_model = copy.deepcopy(unwrapped_model) | ||
unwrapped_model.merge_and_unload() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @qgallouedec, just want to flag that this is quite a compute and memory intensive operation, and there may be a better way to do this.
Assuming the underlying Peft model is LoRA, vLLM already supports native dynamic LoRA inference, which can be done like so:
self.llm = LLM(
...,
enable_lora=True,
)
lora_request = LoRARequest(
"<unique_str>",
self.state.global_step, # needs to be a unique identifier
lora_path=checkpoint_dir_containing_adapter_weights,
)
outputs = self.llm.generate(
all_prompts_text,
sampling_params=self.sampling_params,
lora_request=lora_request,
use_tqdm=False
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow thanks you so much for the pointer. Let me try this
Hello, |
It's WIP, high priority. But if you find a fix in the meantime feel free to controbute 😊 |
Hey @qgallouedec, please see #2730 for a follow-up that implements my suggestion. |
What does this PR do?
Fixes # (issue)
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines.
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.