-
Notifications
You must be signed in to change notification settings - Fork 744
[Speculative Decoding]【Hackathon 10th Spring No.54】hybrid_mtp_ngram 端到端验证 #7849
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
base: develop
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
|
|
@@ -758,12 +758,6 @@ def init_share_inputs(self): | |
|
|
||
| self.block_tables = paddle.clone(self.target_model_input_batch["block_tables"]) | ||
| self.input_ids = paddle.clone(self.target_model_input_batch["input_ids"]) | ||
| self.input_ids_cpu = paddle.full( | ||
| shape=[self.scheduler_config.max_num_seqs, self.model_config.max_model_len], | ||
| fill_value=-1, | ||
| dtype="int64", | ||
| device="cpu", | ||
| ) | ||
| self.seq_lens_this_time_buffer = paddle.clone(self.target_model_input_batch["seq_lens_this_time"]) | ||
|
|
||
| self.seq_lens_encoder = paddle.clone(self.target_model_input_batch["seq_lens_encoder"]) | ||
|
|
@@ -776,7 +770,7 @@ def init_share_inputs(self): | |
| self.cu_seqlens_q_output = paddle.clone(self.target_model_input_batch["cu_seqlens_q_output"]) | ||
| self.batch_id_per_token_output = paddle.clone(self.target_model_input_batch["batch_id_per_token_output"]) | ||
| if "token_ids_all" in self.target_model_input_batch: | ||
| self.token_ids_all = paddle.clone(self.target_model_input_batch["token_ids_all"]) | ||
| self.token_ids_all = self.target_model_input_batch["token_ids_all"] | ||
This comment was marked as outdated.
Sorry, something went wrong.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❓ 疑问 # 改前(安全)
self.token_ids_all = paddle.clone(self.target_model_input_batch["token_ids_all"])
# 改后(共享引用)
self.token_ids_all = self.target_model_input_batch["token_ids_all"]改为共享引用后, 请确认:
如确认只读,建议在 |
||
| # TODO: delete pre_ids in mtp | ||
| self.pre_ids = paddle.full( | ||
| [self.scheduler_config.max_num_seqs, self.model_config.max_model_len], | ||
|
|
@@ -886,7 +880,6 @@ def init_share_inputs(self): | |
| self.last_seq_lens_this_time = paddle.full_like( | ||
| self.target_model_input_batch["seq_lens_this_time"], fill_value=-1, dtype="int32" | ||
| ) | ||
| self.input_ids_len = paddle.zeros(shape=[self.scheduler_config.max_num_seqs, 1], dtype="int64", device="cpu") | ||
| self.temp_scaled_logprobs = self.target_model_input_batch["temp_scaled_logprobs"] | ||
| self.top_p_normalized_logprobs = self.target_model_input_batch["top_p_normalized_logprobs"] | ||
| self.accept_num = self.target_model_input_batch["accept_num"] | ||
|
|
@@ -936,14 +929,12 @@ def swap_data(tensor, idx1, idx2): | |
| self.index_to_batch_id[i1], self.index_to_batch_id[i2] = self.index_to_batch_id[i2], self.index_to_batch_id[i1] | ||
| swap_data(self.block_tables, i1, i2) | ||
| swap_data(self.input_ids, i1, i2) | ||
| swap_data(self.input_ids_cpu, i1, i2) | ||
| swap_data(self.seq_lens_this_time_buffer, i1, i2) | ||
| swap_data(self.seq_lens_encoder, i1, i2) | ||
| swap_data(self.seq_lens_decoder, i1, i2) | ||
| swap_data(self.step_idx, i1, i2) | ||
| swap_data(self.pre_ids, i1, i2) | ||
| swap_data(self.encoder_block_lens, i1, i2) | ||
| swap_data(self.input_ids_len, i1, i2) | ||
| swap_data(self.mask_rollback, i1, i2) | ||
| swap_data(self.recompute_token_num, i1, i2) | ||
| if self.enable_mm: | ||
|
|
@@ -966,7 +957,6 @@ def reset_model_inputs(self) -> None: | |
| # Clone the target model inputs to restore initial values | ||
| self.block_tables = paddle.clone(self.target_model_input_batch["block_tables"]) | ||
| self.input_ids = paddle.clone(self.target_model_input_batch["input_ids"]) | ||
| fill_paddle_tensor(self, "input_ids_cpu", -1) | ||
| # acceptance rate decline when reset seq_lens_this_time | ||
| # self.seq_lens_this_time_buffer = paddle.clone(self.target_model_input_batch["seq_lens_this_time"]) | ||
|
|
||
|
|
@@ -980,7 +970,7 @@ def reset_model_inputs(self) -> None: | |
| self.index_to_batch_id = {} | ||
| if current_platform.is_cuda(): | ||
| if "token_ids_all" in self.target_model_input_batch: | ||
| self.token_ids_all = paddle.clone(self.target_model_input_batch["token_ids_all"]) | ||
| self.token_ids_all = self.target_model_input_batch["token_ids_all"] | ||
| # TODO: delete pre_ids in mtp | ||
| self.pre_ids = paddle.full( | ||
| [self.scheduler_config.max_num_seqs, self.model_config.max_model_len], | ||
|
|
@@ -1062,9 +1052,6 @@ def reset_model_inputs(self) -> None: | |
| if self.num_model_steps > 1: | ||
| fill_paddle_tensor(self, "last_seq_lens_this_time", -1) | ||
|
|
||
| # Reset input IDs length | ||
| fill_paddle_tensor(self, "input_ids_len", 0) | ||
|
|
||
| # Reset various scores and flags | ||
| self.temp_scaled_logprobs = self.target_model_input_batch["temp_scaled_logprobs"] | ||
| self.top_p_normalized_logprobs = self.target_model_input_batch["top_p_normalized_logprobs"] | ||
|
|
||
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.