Optimize
model_navigator.package.optimize
optimize(package, target_formats=None, target_device=DeviceKind.CUDA, runners=None, optimization_profile=None, verbose=False, debug=False, verify_func=None, custom_configs=None, defaults=True, fail_on_empty=True)
Generate target formats and run correctness and profiling tests for available runners.
Parameters:
-
package
(Package
) –Package to optimize.
-
target_formats
(Optional[Tuple[Union[str, Format], ...]]
, default:None
) –Formats to generate and profile. Defaults to target formats from the package.
-
target_device
(Optional[DeviceKind]
, default:CUDA
) –Target device for optimize process, default is CUDA
-
runners
(Optional[Tuple[Union[str, Type[NavigatorRunner]], ...]]
, default:None
) –Runners to run correctness tests and profiling on. Defaults to runners from the package.
-
optimization_profile
(Optional[OptimizationProfile]
, default:None
) –Optimization profile used for conversion and profiling.
-
verbose
(bool
, default:False
) –If True enable verbose logging. Defaults to False.
-
debug
(bool
, default:False
) –If True print debugging logs. Defaults to False.
-
verify_func
(Optional[VerifyFunction]
, default:None
) –Function used for verifying generated models. Defaults to None.
-
custom_configs
(Optional[List[CustomConfig]]
, default:None
) –Custom formats configuration. Defaults to None.
-
defaults
(bool
, default:True
) –reset configuration of custom configs to defaults
-
fail_on_empty
(bool
, default:True
) –Fail optimization when empty (no model or base exported model) package provided
Returns:
-
Package
–Optimized package
Source code in model_navigator/package/__init__.py
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 |
|