Aqua is a Python module designed to implement responsive offloaded tensors in PyTorch.
You can install Aqua using pip:
pip install -e .- Importing Aqua
import aqua- Creating a Responsive Tensor To convert a PyTorch tensor t into a responsive tensor (rt), use the following line of code:
rt = aqua.responsive_manager.to_responsive_tensor(t)- Converting Back to PyTorch Tensor
To retrieve the original PyTorch tensor from a responsive tensor, call the to_torch_tensor() method. Aqua transparently manages where the
torch_tensoris stored. Aqua moves the storage from DRAM to a faster NVLINK device whenever possible.
torch_tensor = rt.to_torch_tensor()- Responsiveness in Aqua At the beginning of your inference loop, make sure to call aqua.responsive_manager.respond():
aqua.responsive_manager.respond()- Policies in Aqua: The abstract class
aqua_policyinpolicies/aqua_policy.pycan be extended to implement custom policies that determine the storage of eachresponsive_tensor.