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

wrap model when lora is ON and only do evaluation. #9803

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions paddlenlp/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3123,6 +3123,9 @@
if self.model is self.model_wrapped and isinstance(self.model_wrapped, PipelineLayer):
# NOTE(gongenlei): when do_train=False, do_eval=True, we need to wrap model for pipeline
self.model_wrapped = fleet.distributed_model(self.model_wrapped)
if isinstance(self.model_wrapped, LoRAModel) and isinstance(self.model_wrapped.model, PipelineLayer):

Check warning on line 3126 in paddlenlp/trainer/trainer.py

View check run for this annotation

Codecov / codecov/patch

paddlenlp/trainer/trainer.py#L3126

Added line #L3126 was not covered by tests
# NOTE(liuting): when do_train=False, do_eval=True, lora=True, we need to wrap model for pipeline
self.model_wrapped = fleet.distributed_model(self.model_wrapped.model)

Check warning on line 3128 in paddlenlp/trainer/trainer.py

View check run for this annotation

Codecov / codecov/patch

paddlenlp/trainer/trainer.py#L3128

Added line #L3128 was not covered by tests
model = self.model_wrapped
else:
model = self.model
Expand Down