Profile API
model_navigator.profile
profile(func, dataloader, target_formats=None, runners=None, window_size=DEFAULT_WINDOW_SIZE, stability_percentage=DEFAULT_STABILITY_PERCENTAGE, stabilization_windows=DEFAULT_STABILIZATION_WINDOWS, min_trials=DEFAULT_MIN_TRIALS, max_trials=DEFAULT_MAX_TRIALS, throughput_cutoff_threshold=DEFAULT_THROUGHPUT_CUTOFF_THRESHOLD, throughput_backoff_limit=DEFAULT_THROUGHPUT_BACKOFF_LIMIT, device='cuda', initialize=True, verbose=False)
Profile func in scope of which registered modules are executed.
Parameters:
-
func(Callable) –Callable to profile.
-
dataloader(Sequence[Tuple[int, Any]]) –List of tuples with batch size and input.
-
target_formats(Optional[Tuple[Union[str, Format], ...]], default:None) –Target model formats for optimize process
-
runners(Optional[Tuple[Union[str, Type[NavigatorRunner]], ...]], default:None) –Use only runners provided as parameter
-
min_trials(int, default:DEFAULT_MIN_TRIALS) –Minimum number of trials.
-
max_trials(int, default:DEFAULT_MAX_TRIALS) –Maximum number of trials.
-
stabilization_windows(int, default:DEFAULT_STABILIZATION_WINDOWS) –Number of stabilization windows.
-
window_size(int, default:DEFAULT_WINDOW_SIZE) –Number of inference queries performed in measurement window
-
stability_percentage(float, default:DEFAULT_STABILITY_PERCENTAGE) –Allowed percentage of variation from the mean in three consecutive windows.
-
throughput_cutoff_threshold(Optional[float], default:DEFAULT_THROUGHPUT_CUTOFF_THRESHOLD) –Minimum throughput increase to continue profiling. If None is provided, profiling run through whole dataloader
-
throughput_backoff_limit(int, default:DEFAULT_THROUGHPUT_BACKOFF_LIMIT) –Back-off limit to run multiple more profiling steps to avoid stop at local minimum when throughput saturate based on
throughput_cutoff_threshold. -
device(str, default:'cuda') –Default device used for loading unoptimized model.
-
initialize(bool, default:True) –Whether to initialize pipeline on device before profiling.
-
verbose(bool, default:False) –Provide verbose logging
Source code in model_navigator/inplace/__init__.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | |