Package
model_navigator.api.package
Package operations related API.
get_best_model_status(package, strategy=None, include_source=True)
Returns ModelStatus of best model for given strategy.
If model with given strategy cannot be found, search is repeated with MaxThroughputStrategy. If there is no model matching given strategy or MaxThroughputStrategy, function returns None.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
package |
Package
|
A package object to be searched for best model. |
required |
strategy |
Optional[RuntimeSearchStrategy]
|
Strategy for finding the best model. Defaults to |
None
|
include_source |
bool
|
Flag if Python based model has to be included in analysis |
True
|
Returns:
Type | Description |
---|---|
Optional[ModelStatus]
|
ModelStatus of best model for given strategy or None. |
Source code in model_navigator/api/package.py
load(path, workspace=None)
Load package from provided path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
Union[str, Path]
|
The location of package to load |
required |
workspace |
Optional[Union[str, Path]]
|
Workspace where packages will be extracted |
None
|
Returns:
Type | Description |
---|---|
Package
|
Package. |
Source code in model_navigator/api/package.py
optimize(package, target_formats=None, runners=None, profiler_config=None, verbose=False, debug=False, verify_func=None, custom_configs=None, defaults=True)
Generate target formats and run correctness and profiling tests for available runners.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
package |
Package
|
Package to optimize. |
required |
target_formats |
Optional[Union[Union[str, Format], Tuple[Union[str, Format], ...]]]
|
Formats to generate and profile. Defaults to target formats from the package. |
None
|
runners |
Optional[Union[Union[str, Type[NavigatorRunner]], Tuple[Union[str, Type[NavigatorRunner]], ...]]]
|
Runners to run correctness tests and profiling on. Defaults to runners from the package. |
None
|
profiler_config |
Optional[ProfilerConfig]
|
Configuration of the profiler. Defaults to config from the package. |
None
|
verbose |
bool
|
If True enable verbose logging. Defaults to False. |
False
|
debug |
bool
|
If True print debugging logs. Defaults to False. |
False
|
verify_func |
Optional[VerifyFunction]
|
Function used for verifying generated models. Defaults to None. |
None
|
custom_configs |
Optional[List[CustomConfig]]
|
Custom formats configuration. Defaults to None. |
None
|
defaults |
bool
|
reset configuration of custom configs to defaults |
True
|
Returns:
Type | Description |
---|---|
Package
|
Optimized package |
Source code in model_navigator/api/package.py
120 121 122 123 124 125 126 127 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 |
|
save(package, path, keep_workspace=True, override=False, save_data=True)
Save export results into the .nav package at given path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
package |
Package
|
A package object to prepare the package |
required |
path |
Union[str, Path]
|
A path to file where the package has to be saved |
required |
keep_workspace |
bool
|
flag to remove the working directory after saving the package |
True
|
override |
bool
|
flag to override existing package in provided path |
False
|
save_data |
bool
|
disable saving samples from the dataloader |
True
|
Source code in model_navigator/api/package.py
set_verified(package, model_key, runner_name)
Set verified status for model and runner.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
package |
Package
|
Package. |
required |
model_key |
str
|
Unique key of the model. |
required |
runner_name |
str
|
Name of the runner. |
required |
Raises:
Type | Description |
---|---|
ModelNavigatorNotFoundError
|
When model and runner not found. |