aitune.torch.module.recording_module
aitune.torch.module.recording_module
Inplace wrap modules.
Module Contents
Classes
Data
API
Module that records samples for tuning.
Get the device of the module.
Get the forward signature used to normalize inputs.
Get the graph specs.
Check if the module is ready for tuning.
All graphs would have proper amount of samples.
Record a sample and run the module.
Before calling forward, we need to make input sample metadata and a copy of args and kwargs, since the forward call may have side effects on the inputs (like KV cache in LLM models).
Create deep copies of args and kwargs.
Parameters:
Positional arguments tuple.
Keyword arguments dict.
Returns: tuple[tuple, dict]
Tuple containing deep copies of args and kwargs.
Raises:
RuntimeError: If cannot copy model inputs with tip to fix it
Match explicit shape definitions to tensors in a recorded sample.
The returned mapping is a validated, graph-specific subset of self._dynamic_shapes containing only
definitions whose paths resolve to tensor inputs in inputs_metadata. Unconfigured tensor inputs remain
represented by their TensorSpec and continue using shapes inferred from recorded samples.
Record a sample from the module.
Get the samples.
Validate that every configured input path matched a tensor during recording.