(self)
| 146 | ) |
| 147 | |
| 148 | def finalize(self): |
| 149 | super().finalize() |
| 150 | |
| 151 | if self.use_spec_allocation: |
| 152 | assert self.track_early_stopping, ( |
| 153 | "use_spec_allocation requires track_early_stopping" |
| 154 | ) |
| 155 | assert self.spec_allocation_std_buffer_scale >= 0, ( |
| 156 | "spec_allocation_std_buffer_scale must be non-negative" |
| 157 | ) |
| 158 | |
| 159 | if self.tokenizer is None: |
| 160 | self.tokenizer = self.model |
| 161 | |
| 162 | if self.max_num_tokens_per_request is None: |
| 163 | model_config = self.model_config() |
| 164 | self.max_num_tokens_per_request = min( |
| 165 | model_config.max_position_embeddings, self.kv_cache_num_tokens |
| 166 | ) |
| 167 | print( |
| 168 | f"Setting max_num_tokens_per_request to {self.max_num_tokens_per_request}" |
| 169 | ) |
| 170 | |
| 171 | if self.use_hydragen and self.use_cudagraphs: |
| 172 | assert self.cudagraph_max_size < self.hydragen_min_group_size, ( |
| 173 | f"For now hydragen_min_group_size ({self.hydragen_min_group_size}) must exceed cudagraph_max_size ({self.cudagraph_max_size})" |
| 174 | ) |
| 175 | |
| 176 | # for debugging different parts of the system |
| 177 | def dmanager(self): |
no test coverage detected