-
Notifications
You must be signed in to change notification settings - Fork 756
[Optimization] Support logprob async copy #6362
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
Changes from all commits
a8e07aa
4b18047
3ac5902
3fdd70b
a8aa492
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3119,6 +3119,8 @@ def _get_prompt_logprobs_list( | |||||||||
| token_ids, logprobs, ranks = self.sampler.gather_logprobs( | ||||||||||
| raw_logprobs, num_prompt_logprobs, prompt_token_ids_tensor | ||||||||||
| ) | ||||||||||
| # Synchronize before using token_ids, logprobs and ranks to ensure async copy are completed. | ||||||||||
| paddle.device.synchronize() | ||||||||||
|
Comment on lines
+3122
to
+3123
|
||||||||||
| # Synchronize before using token_ids, logprobs and ranks to ensure async copy are completed. | |
| paddle.device.synchronize() | |
| # Synchronize current CUDA stream before using token_ids, logprobs and ranks | |
| paddle.device.cuda.current_stream().synchronize() |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -119,9 +119,9 @@ def slice_rows(self, start: int, end: int): | |||||||||||||
| """ | ||||||||||||||
| with paddle.no_grad(): | ||||||||||||||
| return LogprobsTensors( | ||||||||||||||
| paddle.to_tensor(self.logprob_token_ids[start:end], place=self.logprob_token_ids.place), | ||||||||||||||
| paddle.to_tensor(self.logprobs[start:end], place=self.logprob_token_ids.place), | ||||||||||||||
| paddle.to_tensor(self.selected_token_ranks[start:end], place=self.logprob_token_ids.place), | ||||||||||||||
| paddle.to_tensor(self.logprob_token_ids.cpu()[start:end], place="cpu"), | ||||||||||||||
| paddle.to_tensor(self.logprobs.cpu()[start:end], place="cpu"), | ||||||||||||||
| paddle.to_tensor(self.selected_token_ranks.cpu()[start:end], place="cpu"), | ||||||||||||||
|
Comment on lines
+122
to
+124
|
||||||||||||||
| paddle.to_tensor(self.logprob_token_ids.cpu()[start:end], place="cpu"), | |
| paddle.to_tensor(self.logprobs.cpu()[start:end], place="cpu"), | |
| paddle.to_tensor(self.selected_token_ranks.cpu()[start:end], place="cpu"), | |
| self.logprob_token_ids[start:end], | |
| self.logprobs[start:end], | |
| self.selected_token_ranks[start:end], |
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.
注释里的英文语法建议调整:"to ensure async copy are completed" 应改为 "to ensure async copies are completed" 或 "... is completed",避免语法错误影响可读性。