class_docstr: A generic `ModelHook` that ensures inputs and model weights are on the same device for the forward pass of the
  associated module, potentially offloading the weights after the forward pass.
  
  Args:
      execution_device (`torch.device`, *optional*):
          The device on which inputs and model weights should be placed before the forward pass.
      offload (`bool`, *optional*, defaults to `False`):
          Whether or not the weights should be offloaded after the forward pass.
      io_same_device (`bool`, *optional*, defaults to `False`):
          Whether or not the output should be placed on the same device as the input was.
      weights_map (`Mapping[str, torch.Tensor]`, *optional*):
          When the model weights are offloaded, a (potentially lazy) map from param names to the tensor values.
      offload_buffers (`bool`, *optional*, defaults to `False`):
          Whether or not to include the associated module's buffers when offloading.
      place_submodules (`bool`, *optional*, defaults to `False`):
          Whether to place the submodules on `execution_device` during the `init_hook` event.
code: def pre_forward(self, module, *args, **kwargs):
      if self.io_same_device:
          self.input_device = find_device([args, kwargs])
      if self.offload:
          for name, _ in named_module_tensors(
              module,
              include_buffers=self.offload_buffers,
              recurse=self.place_submodules,
              remove_non_persistent=True,
          ):
              fp16_statistics = None
              if (
                  "weight" in name
                  and name.replace("weight", "SCB")
                  in self.weights_map.keys()
              ):
                  if self.weights_map[name].dtype == torch.int8:
                      fp16_statistics = self.weights_map[
                          name.replace("weight", "SCB")
                      ]
              set_module_tensor_to_device(
                  module,
                  name,
                  self.execution_device,
                  value=self.weights_map[name],
                  fp16_statistics=fp16_statistics,
              )
  
      return send_to_device(
          args, self.execution_device
      ), send_to_device(
          kwargs, self.execution_device, skip_keys=self.skip_keys
      )
  
imports: import functools
  from typing import Dict, List, Mapping, Optional, Union
  import torch
  import torch.nn
  from .state import PartialState
  from .utils import PrefixedDataset, find_device, named_module_tensors, send_to_device, set_module_tensor_to_device
  from .utils.modeling import get_non_persistent_buffers
label_desc: Use image node_id 4 for calling the AlignDevicesHook obj's underlying member method code with example usage: obj.pre_forward(module) and returns: send_to_device,  send_to_device