AOT Inspect API
inspect
aitune.torch.inspect
inspect(obj, dataset, inference_function=None, number_of_iterations=DEFAULT_INSPECT_ITERATIONS, warmup_iterations=DEFAULT_WARMUP_ITERATIONS, min_depth=0, max_depth=5)
Inspect provided callable object searching for nn.Module members executed as part of forward pass.
Parameters:
-
obj(Callable | Module) –Callable object to inspect.
-
dataset(DatasetLike | DataLoaderFactory | Tensor) –List of tuples with batch size and input.
-
inference_function(Callable | None, default:None) –Custom inference function to use for inspection, obj is used by default.
-
number_of_iterations(int, default:DEFAULT_INSPECT_ITERATIONS) –Number of iterations to run for inference.
-
warmup_iterations(int, default:DEFAULT_WARMUP_ITERATIONS) –Number of iterations to run for warmup.
-
min_depth(int, default:0) –Minimum depth of the modules to inspect, if root level modules is not working, try to increase this value
-
max_depth(int, default:5) –Maximum depth of the modules to inspect
Returns: InspectedModulesInfo object.
Source code in aitune/torch/inspecting/inspecting.py
wrap
aitune.torch.wrap
Wrap provided modules with inspection logic.
Parameters:
-
obj(object) –Callable object to wrap.
-
modules(list[ModuleInfo]) –Dictionary of module names and their corresponding ModuleInfo objects.
-
strategy(TuneStrategy | None, default:None) –Strategy to use for patching.
-
strategies(StrategyList | StrategyMap | None, default:None) –Strategies to use for patching.
Returns:
-
object–Wrapped callable object.
Source code in aitune/torch/inspecting/wrapping.py
InspectedModulesInfo
aitune.torch.inspecting.InspectedModulesInfo
Information about inspected modules.
Initialize the inspected modules specification.
Source code in aitune/torch/inspecting/module_info.py
add_module
Add a module to the specification.
Parameters:
-
module(ModuleInfo) –ModuleInfo object.
Source code in aitune/torch/inspecting/module_info.py
describe
Describe the inspected modules specification.
Source code in aitune/torch/inspecting/module_info.py
get_modules
Get the list of modules.
Parameters:
-
min_execution_percentage(float | None, default:None) –Minimum execution percentage to include a module.
-
limit(int | None, default:None) –Maximum number of modules to return.
Returns:
-
list[ModuleInfo]–List of ModuleInfo objects.