Execute a forward pass with dummy inputs to profile the memory usage of the model
(self)
| 1103 | |
| 1104 | @profile_run_guard(True) |
| 1105 | def profile_run(self) -> None: |
| 1106 | """Execute a forward pass with dummy inputs to profile the memory usage of the model""" |
| 1107 | |
| 1108 | # Initialize kv cache for profile run. After profile run kv cache will be reset. |
| 1109 | self.num_gcu_blocks = self.cache_config.total_block_num |
| 1110 | self.initialize_kv_cache(profile=True) |
| 1111 | |
| 1112 | # 1. Profile with multimodal encoder & encoder cache |
| 1113 | |
| 1114 | # 2. Dummy run |
| 1115 | self._dummy_run( |
| 1116 | num_tokens=self.scheduler_config.max_num_batched_tokens, |
| 1117 | batch_size=min(self.scheduler_config.max_num_seqs, 3), |
| 1118 | ) |
| 1119 | |
| 1120 | # 3. gc |
| 1121 | self.clear_cache() |
| 1122 | |
| 1123 | if self.speculative_method in ["mtp"]: |
| 1124 | self.proposer.clear_dummy_input() |
| 1125 | # paddle.device.cuda.synchronize() |
| 1126 | |
| 1127 | def update_share_input_block_num(self, num_gpu_blocks: int) -> None: |
| 1128 | """ |
no test coverage detected