diff --git a/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/__init__.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fe887e4c11579d1ee57610d666d53b95f01adc96 Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/__init__.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/_gpu_trace.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/_gpu_trace.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..12e65b52edeea87aefefb492cc6fa957fe1f69dd Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/_gpu_trace.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/_memory_viz.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/_memory_viz.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9a7fe4aa8a084a17107d858844123fe11bbe6932 Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/_memory_viz.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/_sanitizer.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/_sanitizer.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9861ab94a69953c1624df49377801f7471d6a5ff Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/_sanitizer.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/_utils.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/_utils.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..80fffd70cc79eba29222e56785d9e9061217ad76 Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/_utils.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/comm.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/comm.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..32c95dc419ceb240279a8816a8125ba469b21a6d Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/comm.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/error.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/error.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fd3882453c12746302383d15014e9638b76871af Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/error.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/gds.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/gds.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cd7f4d6c2b0aeaf199d8c6cfa88135d25608f9aa Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/gds.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/graphs.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/graphs.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c711deb0f84e14926921a8d2069c01c90bfe4941 Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/graphs.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/jiterator.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/jiterator.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7b76605dae88a159689af41a48cd5c61461416b4 Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/jiterator.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/nccl.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/nccl.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..72a9f5753afe11b601523c0105c205887eb0f993 Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/nccl.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/nvtx.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/nvtx.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ab1489b699eaf79a0b7b46746a2793d5a5e6ff5e Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/nvtx.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/profiler.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/profiler.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7ba90d0e7a45fcf404ce7db7cf3ad945b2215b83 Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/profiler.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/random.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/random.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..430e549cfdcac0fc9d02ace87b049ab6b7397a71 Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/random.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/sparse.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/sparse.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9262a384a0414d2f8f0710037752b9a5aaabd73c Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/sparse.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/streams.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/streams.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d8eb28667f21bc5f8cd0be7098183b9764df20d0 Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/streams.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/tunable.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/tunable.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..68eec829dc829f9eaf765d5876028fbae169b4f1 Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/cuda/__pycache__/tunable.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/cuda/amp/__init__.py b/.venv/lib/python3.11/site-packages/torch/cuda/amp/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..74520496372f549356a26c2c70b637b9e3ea4d4d --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/cuda/amp/__init__.py @@ -0,0 +1,12 @@ +from .autocast_mode import autocast, custom_bwd, custom_fwd +from .common import amp_definitely_not_available +from .grad_scaler import GradScaler + + +__all__ = [ + "amp_definitely_not_available", + "autocast", + "custom_bwd", + "custom_fwd", + "GradScaler", +] diff --git a/.venv/lib/python3.11/site-packages/torch/cuda/amp/__pycache__/__init__.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/cuda/amp/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..670d3ebd633a0fed9a1c9ce604873bdd886848a1 Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/cuda/amp/__pycache__/__init__.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/cuda/amp/__pycache__/autocast_mode.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/cuda/amp/__pycache__/autocast_mode.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..831301703e70ef4e03dfaef33e402fa6f96e2bdf Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/cuda/amp/__pycache__/autocast_mode.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/cuda/amp/__pycache__/common.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/cuda/amp/__pycache__/common.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..93dd26f04b2fcc790e0d4d1fb1f7204b1e95c06c Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/cuda/amp/__pycache__/common.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/cuda/amp/__pycache__/grad_scaler.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/cuda/amp/__pycache__/grad_scaler.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6958220e862281e4aba6c857a2b2d0a512079b5d Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/cuda/amp/__pycache__/grad_scaler.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/cuda/amp/autocast_mode.py b/.venv/lib/python3.11/site-packages/torch/cuda/amp/autocast_mode.py new file mode 100644 index 0000000000000000000000000000000000000000..d52ff7cf672bbdaaf4ac31a06a21cac8aabcfe0f --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/cuda/amp/autocast_mode.py @@ -0,0 +1,90 @@ +# mypy: allow-untyped-defs +import functools +from typing import Any +from typing_extensions import deprecated + +import torch + + +__all__ = ["autocast", "custom_fwd", "custom_bwd"] + + +class autocast(torch.amp.autocast_mode.autocast): + r"""See :class:`torch.autocast`. + + ``torch.cuda.amp.autocast(args...)`` is deprecated. Please use ``torch.amp.autocast("cuda", args...)`` instead. + """ + + @deprecated( + "`torch.cuda.amp.autocast(args...)` is deprecated. " + "Please use `torch.amp.autocast('cuda', args...)` instead.", + category=FutureWarning, + ) + def __init__( + self, + enabled: bool = True, + dtype: torch.dtype = torch.float16, + cache_enabled: bool = True, + ): + if torch._jit_internal.is_scripting(): + self._enabled = enabled + self.device = "cuda" + self.fast_dtype = dtype + return + super().__init__( + "cuda", enabled=enabled, dtype=dtype, cache_enabled=cache_enabled + ) + + def __enter__(self): + if torch._jit_internal.is_scripting(): + return self + return super().__enter__() + + # TODO: discuss a unified TorchScript-friendly API for autocast + def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any): # type: ignore[override] + if torch._jit_internal.is_scripting(): + return + return super().__exit__(exc_type, exc_val, exc_tb) + + def __call__(self, func): + if torch._jit_internal.is_scripting(): + return func + return super().__call__(func) + + +# Preserved only for BC reasons +@deprecated( + "`torch.cuda.amp.autocast_mode._cast(value, dtype)` is deprecated. " + "Please use `torch.amp.autocast_mode._cast(value, 'cuda', dtype)` instead.", + category=FutureWarning, +) +def _cast(value, dtype): + return torch.amp.autocast_mode._cast(value, "cuda", dtype) + + +@deprecated( + "`torch.cuda.amp.custom_fwd(args...)` is deprecated. " + "Please use `torch.amp.custom_fwd(args..., device_type='cuda')` instead.", + category=FutureWarning, +) +def custom_fwd(fwd=None, *, cast_inputs=None): + """ + ``torch.cuda.amp.custom_fwd(args...)`` is deprecated. Please use + ``torch.amp.custom_fwd(args..., device_type='cuda')`` instead. + """ + return functools.partial(torch.amp.custom_fwd, device_type="cuda")( + fwd=fwd, cast_inputs=cast_inputs + ) + + +@deprecated( + "`torch.cuda.amp.custom_bwd(args...)` is deprecated. " + "Please use `torch.amp.custom_bwd(args..., device_type='cuda')` instead.", + category=FutureWarning, +) +def custom_bwd(bwd): + """ + ``torch.cuda.amp.custom_bwd(args...)`` is deprecated. Please use + ``torch.amp.custom_bwd(args..., device_type='cuda')`` instead. + """ + return functools.partial(torch.amp.custom_bwd, device_type="cuda")(bwd) diff --git a/.venv/lib/python3.11/site-packages/torch/cuda/amp/common.py b/.venv/lib/python3.11/site-packages/torch/cuda/amp/common.py new file mode 100644 index 0000000000000000000000000000000000000000..915a9b4f4a9ca6c147abefd7c8ab1891ee5a8179 --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/cuda/amp/common.py @@ -0,0 +1,11 @@ +# mypy: allow-untyped-defs +from importlib.util import find_spec + +import torch + + +__all__ = ["amp_definitely_not_available"] + + +def amp_definitely_not_available(): + return not (torch.cuda.is_available() or find_spec("torch_xla")) diff --git a/.venv/lib/python3.11/site-packages/torch/cuda/amp/grad_scaler.py b/.venv/lib/python3.11/site-packages/torch/cuda/amp/grad_scaler.py new file mode 100644 index 0000000000000000000000000000000000000000..62e2020073c8ed99f7295edd1aaea4c54d815f63 --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/cuda/amp/grad_scaler.py @@ -0,0 +1,38 @@ +from typing_extensions import deprecated + +import torch + +# We need to keep this unused import for BC reasons +from torch.amp.grad_scaler import OptState # noqa: F401 + + +__all__ = ["GradScaler"] + + +class GradScaler(torch.amp.GradScaler): + r""" + See :class:`torch.amp.GradScaler`. + ``torch.cuda.amp.GradScaler(args...)`` is deprecated. Please use ``torch.amp.GradScaler("cuda", args...)`` instead. + """ + + @deprecated( + "`torch.cuda.amp.GradScaler(args...)` is deprecated. " + "Please use `torch.amp.GradScaler('cuda', args...)` instead.", + category=FutureWarning, + ) + def __init__( + self, + init_scale: float = 2.0**16, + growth_factor: float = 2.0, + backoff_factor: float = 0.5, + growth_interval: int = 2000, + enabled: bool = True, + ) -> None: + super().__init__( + "cuda", + init_scale=init_scale, + growth_factor=growth_factor, + backoff_factor=backoff_factor, + growth_interval=growth_interval, + enabled=enabled, + ) diff --git a/.venv/lib/python3.11/site-packages/torch/nn/quantizable/__init__.py b/.venv/lib/python3.11/site-packages/torch/nn/quantizable/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..c7628c5c15992efa600ea5520aed955ba42c6146 --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/nn/quantizable/__init__.py @@ -0,0 +1 @@ +from torch.nn.quantizable.modules import * # noqa: F403 diff --git a/.venv/lib/python3.11/site-packages/torch/nn/quantizable/modules/activation.py b/.venv/lib/python3.11/site-packages/torch/nn/quantizable/modules/activation.py new file mode 100644 index 0000000000000000000000000000000000000000..e4f7a5ca3b540edc9f9b1fc15899b63240b7ac79 --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/nn/quantizable/modules/activation.py @@ -0,0 +1,10 @@ +# flake8: noqa: F401 +r"""Quantizable Modules. + +This file is in the process of migration to `torch/ao/nn/quantizable`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +appropriate file under the `torch/ao/nn/quantizable/modules`, +while adding an import statement here. +""" +from torch.ao.nn.quantizable.modules.activation import MultiheadAttention diff --git a/.venv/lib/python3.11/site-packages/torch/nn/quantizable/modules/rnn.py b/.venv/lib/python3.11/site-packages/torch/nn/quantizable/modules/rnn.py new file mode 100644 index 0000000000000000000000000000000000000000..8e355efcdd63d595580bdac22d46882b91b7d118 --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/nn/quantizable/modules/rnn.py @@ -0,0 +1,11 @@ +# flake8: noqa: F401 +r"""Quantizable Modules. + +This file is in the process of migration to `torch/ao/nn/quantizable`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +appropriate file under the `torch/ao/nn/quantizable/modules`, +while adding an import statement here. +""" + +from torch.ao.nn.quantizable.modules.rnn import LSTM, LSTMCell diff --git a/.venv/lib/python3.11/site-packages/torch/nn/utils/_expanded_weights/__pycache__/__init__.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/nn/utils/_expanded_weights/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1bc403123c9e44825f6fcefa3fd1e7fb05b7a98c Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/nn/utils/_expanded_weights/__pycache__/__init__.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/nn/utils/_expanded_weights/__pycache__/conv_expanded_weights.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/nn/utils/_expanded_weights/__pycache__/conv_expanded_weights.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6ce3d66dc71a6bb411854a5b0cf01363bc770049 Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/nn/utils/_expanded_weights/__pycache__/conv_expanded_weights.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/nn/utils/_expanded_weights/__pycache__/conv_utils.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/nn/utils/_expanded_weights/__pycache__/conv_utils.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ae47a43257f4dbe6546206e96fd62c444fe977d0 Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/nn/utils/_expanded_weights/__pycache__/conv_utils.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/nn/utils/_expanded_weights/__pycache__/expanded_weights_utils.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/nn/utils/_expanded_weights/__pycache__/expanded_weights_utils.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..61a1e4b87e39665bfb30049bc0f83964f9c24322 Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/nn/utils/_expanded_weights/__pycache__/expanded_weights_utils.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/nn/utils/_expanded_weights/__pycache__/group_norm_expanded_weights.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/nn/utils/_expanded_weights/__pycache__/group_norm_expanded_weights.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0c76cb825a6cbaccc8c8259aca57cf607bf133bc Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/nn/utils/_expanded_weights/__pycache__/group_norm_expanded_weights.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/nn/utils/_expanded_weights/__pycache__/instance_norm_expanded_weights.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/nn/utils/_expanded_weights/__pycache__/instance_norm_expanded_weights.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8a7eb3114a94665de93037978656b427c95afdc4 Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/nn/utils/_expanded_weights/__pycache__/instance_norm_expanded_weights.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/nn/utils/_expanded_weights/__pycache__/layer_norm_expanded_weights.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/nn/utils/_expanded_weights/__pycache__/layer_norm_expanded_weights.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..46941df277624dc68b16b4f257fc49d1ddb808ed Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/nn/utils/_expanded_weights/__pycache__/layer_norm_expanded_weights.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/__init__.py b/.venv/lib/python3.11/site-packages/torch/quantization/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..8789fea17a17ffa8e490a8d744892c5140a70ee2 --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/__init__.py @@ -0,0 +1,86 @@ +# mypy: allow-untyped-defs +from .fake_quantize import * # noqa: F403 +from .fuse_modules import fuse_modules +from .fuser_method_mappings import * # noqa: F403 +from .observer import * # noqa: F403 +from .qconfig import * # noqa: F403 +from .quant_type import * # noqa: F403 +from .quantization_mappings import * # noqa: F403 +from .quantize import * # noqa: F403 +from .quantize_jit import * # noqa: F403 +from .stubs import * # noqa: F403 + + +def default_eval_fn(model, calib_data): + r""" + Default evaluation function takes a torch.utils.data.Dataset or a list of + input Tensors and run the model on the dataset + """ + for data, target in calib_data: + model(data) + + +__all__ = [ + "QuantWrapper", + "QuantStub", + "DeQuantStub", + # Top level API for eager mode quantization + "quantize", + "quantize_dynamic", + "quantize_qat", + "prepare", + "convert", + "prepare_qat", + # Top level API for graph mode quantization on TorchScript + "quantize_jit", + "quantize_dynamic_jit", + "_prepare_ondevice_dynamic_jit", + "_convert_ondevice_dynamic_jit", + "_quantize_ondevice_dynamic_jit", + # Top level API for graph mode quantization on GraphModule(torch.fx) + # 'fuse_fx', 'quantize_fx', # TODO: add quantize_dynamic_fx + # 'prepare_fx', 'prepare_dynamic_fx', 'convert_fx', + "QuantType", # quantization type + # custom module APIs + "get_default_static_quant_module_mappings", + "get_static_quant_module_class", + "get_default_dynamic_quant_module_mappings", + "get_default_qat_module_mappings", + "get_default_qconfig_propagation_list", + "get_default_compare_output_module_list", + "get_quantized_operator", + "get_fuser_method", + # Sub functions for `prepare` and `swap_module` + "propagate_qconfig_", + "add_quant_dequant", + "swap_module", + "default_eval_fn", + # Observers + "ObserverBase", + "WeightObserver", + "HistogramObserver", + "observer", + "default_observer", + "default_weight_observer", + "default_placeholder_observer", + "default_per_channel_weight_observer", + # FakeQuantize (for qat) + "default_fake_quant", + "default_weight_fake_quant", + "default_fixed_qparams_range_neg1to1_fake_quant", + "default_fixed_qparams_range_0to1_fake_quant", + "default_per_channel_weight_fake_quant", + "default_histogram_fake_quant", + # QConfig + "QConfig", + "default_qconfig", + "default_dynamic_qconfig", + "float16_dynamic_qconfig", + "float_qparams_weight_only_qconfig", + # QAT utilities + "default_qat_qconfig", + "prepare_qat", + "quantize_qat", + # module transformations + "fuse_modules", +] diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/_numeric_suite.py b/.venv/lib/python3.11/site-packages/torch/quantization/_numeric_suite.py new file mode 100644 index 0000000000000000000000000000000000000000..49ccc8e69523f7dbee2335b788a2cb3a7db618a2 --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/_numeric_suite.py @@ -0,0 +1,28 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +`torch/ao/ns/_numeric_suite.py`, while adding an import statement +here. +""" + +from torch.ao.ns._numeric_suite import ( + _convert_tuple_to_list, + _dequantize_tensor_list, + _find_match, + _get_logger_dict_helper, + _is_identical_module_type, + compare_model_outputs, + compare_model_stub, + compare_weights, + get_logger_dict, + get_matching_activations, + Logger, + NON_LEAF_MODULE_TO_ADD_OBSERVER_ALLOW_LIST, + OutputLogger, + prepare_model_outputs, + prepare_model_with_stubs, + Shadow, + ShadowLogger, +) diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/_numeric_suite_fx.py b/.venv/lib/python3.11/site-packages/torch/quantization/_numeric_suite_fx.py new file mode 100644 index 0000000000000000000000000000000000000000..55cd7085740d0ce8de79491acbfc4888ebba21f8 --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/_numeric_suite_fx.py @@ -0,0 +1,26 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +`torch/ao/ns/_numeric_suite_fx.py`, while adding an import statement +here. +""" + +from torch.ao.ns._numeric_suite_fx import ( + _add_loggers_impl, + _add_loggers_one_model, + _add_shadow_loggers_impl, + _extract_logger_info_one_model, + _extract_weights_impl, + _extract_weights_one_model, + add_loggers, + add_shadow_loggers, + extend_logger_results_with_comparison, + extract_logger_info, + extract_shadow_logger_info, + extract_weights, + NSTracer, + OutputLogger, + RNNReturnType, +) diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/_quantized_conversions.py b/.venv/lib/python3.11/site-packages/torch/quantization/_quantized_conversions.py new file mode 100644 index 0000000000000000000000000000000000000000..8d930c366c0dd9857e463005474a2d59c04c4ae6 --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/_quantized_conversions.py @@ -0,0 +1,133 @@ +# mypy: allow-untyped-defs +import torch + + +# Pack pairs of int4 values into int8, in row major order; first int4 +# value goes into lower order bits, and second int4 value into higher +# order bits of resulting int8 value. +def pack_int4_to_int8(weight): + assert weight.dim() == 2 + assert weight.shape[1] % 2 == 0 + assert weight.dtype == torch.int8 + return ((weight[:, 1::2] & 0xF) << 4) | (weight[:, 0::2] & 0xF) + + +# Unpack quandruples of bits in int8 values into int4 values, in row +# major order; lower 4 bits go into first int4 value goes, and upper 4 +# bits go into second int4 value. +def unpack_int8_to_int4(weight): + assert weight.dim() == 2 + assert weight.dtype == torch.int8 + return torch.stack((weight & 0xF, (weight >> 4) & 0xF), dim=2).view( + weight.shape[0], 2 * weight.shape[1] + ) + + +# Transpose the weight matrix, and then reorder its elements according +# to underlying requirements of CUTLASS library, so that it could be +# used for CUTLASS-based mixed datatypes linear operation. +def quantized_weight_reorder_for_mixed_dtypes_linear_cutlass( + weight, dtypeq, transpose=False +): + assert weight.dim() == 2 + assert weight.dtype == torch.int8 + assert dtypeq == torch.int8 or dtypeq == torch.quint4x2 + assert weight.device.type == "cuda" + + device = weight.device + + # subbyte_transpose + if not transpose: + if dtypeq == torch.int8: + outp = weight.T + elif dtypeq == torch.quint4x2: + outp = pack_int4_to_int8(unpack_int8_to_int4(weight.view(torch.int8)).T) + else: + outp = weight + + ncols, nrows = outp.shape # type: ignore[possibly-undefined] + assert nrows % (32 if dtypeq == torch.quint4x2 else 64) == 0 + assert ncols % 64 == 0 + + # permute_B_rows_for_mixed_gemm + # (permute cols actually, as transpose is applied first here) + if dtypeq == torch.quint4x2: + cols_permuted = ( + torch.tensor( + [0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15], + device=device, + ) + + (torch.arange(0, nrows // 16, device=device).reshape(-1, 1) * 16).expand( + nrows // 16, 16 + ) + ).view(-1) + else: + cols_permuted = ( + torch.tensor( + [0, 1, 4, 5, 8, 9, 12, 13, 2, 3, 6, 7, 10, 11, 14, 15], + device=device, + ) + + (torch.arange(0, nrows // 16, device=device).reshape(-1, 1) * 16).expand( + nrows // 16, 16 + ) + ).view(-1) + outp = outp.index_copy(1, cols_permuted, outp) + + # interleave_column_major_tensor + magic0 = 4 if dtypeq == torch.quint4x2 else 2 + magic1 = 32 // magic0 + + tmp0 = ( + (torch.arange(0, ncols // magic0, device=device) * (nrows // 4 * magic0)) + .view(-1, 1) + .repeat(1, nrows // 4 * magic0) + .view(-1) + ) + tmp1 = ( + (torch.arange(0, nrows // 4 // magic1, device=device) * (magic0 * magic1)) + .view(-1, 1) + .repeat(1, magic1) + .view(-1) + .repeat(ncols) + ) + tmp2 = ( + (torch.arange(0, magic0, device=device) * magic1) + .view(-1, 1) + .repeat(1, nrows // 4) + .view(-1) + .repeat(ncols // magic0) + ) + tmp3 = torch.arange(0, magic1, device=device).repeat(nrows // 4 * ncols // magic1) + + outp_offsets = tmp0 + tmp1 + tmp2 + tmp3 + + tmp = outp.view(-1).view(torch.int32) + outp = torch.zeros_like(tmp) + outp.scatter_(0, outp_offsets, tmp) + outp = outp.view(weight.dtype) + + # add_bias_and_interleave_quantized_tensor_inplace + tmp = outp.view(-1) + + outp = torch.empty_like(tmp) + if dtypeq == torch.int8: + tmp = (tmp.to(torch.int) + 128).to(tmp.dtype) + outp[0::4] = tmp[0::4] + outp[1::4] = tmp[2::4] + outp[2::4] = tmp[1::4] + outp[3::4] = tmp[3::4] + elif dtypeq == torch.quint4x2: + tmp0 = ((tmp & 0xF) + 8) & 0xF + tmp0 = (tmp0[1::2] << 4) | tmp0[0::2] + tmp1 = (((tmp >> 4) & 0xF) + 8) & 0xF + tmp1 = (tmp1[1::2] << 4) | tmp1[0::2] + outp[0::4] = tmp0[0::2] + outp[1::4] = tmp0[1::2] + outp[2::4] = tmp1[0::2] + outp[3::4] = tmp1[1::2] + + if dtypeq == torch.quint4x2: + nrows *= 2 + ncols //= 2 + + return outp.view(nrows, ncols).view(torch.uint8) diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fake_quantize.py b/.venv/lib/python3.11/site-packages/torch/quantization/fake_quantize.py new file mode 100644 index 0000000000000000000000000000000000000000..69a5d730bfb68e89e24beb04ad13fd3fa5881ae9 --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/fake_quantize.py @@ -0,0 +1,32 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +`torch/ao/quantization/fake_quantize.py`, while adding an import statement +here. +""" + +from torch.ao.quantization.fake_quantize import ( + _is_fake_quant_script_module, + _is_per_channel, + _is_per_tensor, + _is_symmetric_quant, + default_fake_quant, + default_fixed_qparams_range_0to1_fake_quant, + default_fixed_qparams_range_neg1to1_fake_quant, + default_fused_act_fake_quant, + default_fused_per_channel_wt_fake_quant, + default_fused_wt_fake_quant, + default_histogram_fake_quant, + default_per_channel_weight_fake_quant, + default_weight_fake_quant, + disable_fake_quant, + disable_observer, + enable_fake_quant, + enable_observer, + FakeQuantize, + FakeQuantizeBase, + FixedQParamsFakeQuantize, + FusedMovingAvgObsFakeQuantize, +) diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fuse_modules.py b/.venv/lib/python3.11/site-packages/torch/quantization/fuse_modules.py new file mode 100644 index 0000000000000000000000000000000000000000..6b704fa8094e8b367e9eba47102863ba845415b9 --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/fuse_modules.py @@ -0,0 +1,22 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +`torch/ao/quantization/fuse_modules.py`, while adding an import statement +here. +""" + +# TODO: These functions are not used outside the `fuse_modules.py` +# Keeping here for now, need to remove them later. +from torch.ao.quantization.fuse_modules import ( + _fuse_modules, + _get_module, + _set_module, + fuse_known_modules, + fuse_modules, + get_fuser_method, +) + +# for backward compatiblity +from torch.ao.quantization.fuser_method_mappings import fuse_conv_bn, fuse_conv_bn_relu diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fuser_method_mappings.py b/.venv/lib/python3.11/site-packages/torch/quantization/fuser_method_mappings.py new file mode 100644 index 0000000000000000000000000000000000000000..cfb13ac96271fa7b926cc703918984760e6ede15 --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/fuser_method_mappings.py @@ -0,0 +1,15 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +`torch/ao/quantization/fuser_method_mappings.py`, while adding an import statement +here. +""" +from torch.ao.quantization.fuser_method_mappings import ( + _DEFAULT_OP_LIST_TO_FUSER_METHOD, + fuse_conv_bn, + fuse_conv_bn_relu, + fuse_linear_bn, + get_fuser_method, +) diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fx/__init__.py b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..c01cbd457374c27e40b07daca5ae1644a701767d --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__init__.py @@ -0,0 +1,15 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +appropriate files under `torch/ao/quantization/fx/`, while adding an import statement +here. +""" + +from torch.ao.quantization.fx.convert import convert +from torch.ao.quantization.fx.fuse import fuse + +# omitting files that's unlikely to be used right now, for example +# the newly added lower_to_fbgemm etc. +from torch.ao.quantization.fx.prepare import prepare diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/__init__.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9366b0dfa2175380dd6d1d601f049929383b6e7e Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/__init__.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/_equalize.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/_equalize.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a8cc841203a15ce4c79e7f8cd887720103c329ad Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/_equalize.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/convert.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/convert.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..81fc3c783e0ac322049bad3adb4752563695fb76 Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/convert.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/fuse.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/fuse.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2a16541001e0bce6342292b59469f7a0adcb93b6 Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/fuse.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/fusion_patterns.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/fusion_patterns.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c00a4e74bc77b9b27035172d8d1b0a6770082fa6 Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/fusion_patterns.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/graph_module.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/graph_module.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b42f548cd3050a68f1a51ebc08f8fc0b4d84bc50 Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/graph_module.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/match_utils.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/match_utils.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..70ec5f590f8b92ddc91b596a9ffaf0ddbf9f74f2 Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/match_utils.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/pattern_utils.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/pattern_utils.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0bfe22ea50abbbded11c1634c46bd97867f9246e Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/pattern_utils.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/prepare.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/prepare.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..835d6857653280a9a54d6dec038116980a4db9b1 Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/prepare.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/quantization_patterns.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/quantization_patterns.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6f3a9a56aa16d3e8a07eb8d3ded65b5b819e3951 Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/quantization_patterns.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/quantization_types.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/quantization_types.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d7140696b712b7e5b6ed25b64a6f1d185b64b6f7 Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/quantization_types.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/utils.cpython-311.pyc b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/utils.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..94a6a340fb33d55518b45bd29c30991cba408845 Binary files /dev/null and b/.venv/lib/python3.11/site-packages/torch/quantization/fx/__pycache__/utils.cpython-311.pyc differ diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fx/_equalize.py b/.venv/lib/python3.11/site-packages/torch/quantization/fx/_equalize.py new file mode 100644 index 0000000000000000000000000000000000000000..7acea4f84a2a0a82f134b6790e573f8f1cb677f2 --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/fx/_equalize.py @@ -0,0 +1,38 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +appropriate files under `torch/ao/quantization/fx/`, while adding an import statement +here. +""" +from torch.ao.quantization.fx._equalize import ( + _convert_equalization_ref, + _InputEqualizationObserver, + _WeightEqualizationObserver, + calculate_equalization_scale, + clear_weight_quant_obs_node, + convert_eq_obs, + CUSTOM_MODULE_SUPP_LIST, + custom_module_supports_equalization, + default_equalization_qconfig, + EqualizationQConfig, + fused_module_supports_equalization, + get_equalization_qconfig_dict, + get_layer_sqnr_dict, + get_op_node_and_weight_eq_obs, + input_equalization_observer, + is_equalization_observer, + maybe_get_next_equalization_scale, + maybe_get_next_input_eq_obs, + maybe_get_weight_eq_obs_node, + nn_module_supports_equalization, + node_supports_equalization, + remove_node, + reshape_scale, + scale_input_observer, + scale_weight_functional, + scale_weight_node, + update_obs_for_equalization, + weight_equalization_observer, +) diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fx/convert.py b/.venv/lib/python3.11/site-packages/torch/quantization/fx/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..9d6ac350602bb7a97c773a3a09fec0780483379f --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/fx/convert.py @@ -0,0 +1,9 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +appropriate files under `torch/ao/quantization/fx/`, while adding an import statement +here. +""" +from torch.ao.quantization.fx.convert import convert diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fx/fuse.py b/.venv/lib/python3.11/site-packages/torch/quantization/fx/fuse.py new file mode 100644 index 0000000000000000000000000000000000000000..67527080304fb31ddc54fe254533e2196f77a616 --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/fx/fuse.py @@ -0,0 +1,9 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +appropriate files under `torch/ao/quantization/fx/`, while adding an import statement +here. +""" +from torch.ao.quantization.fx.fuse import fuse diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fx/fusion_patterns.py b/.venv/lib/python3.11/site-packages/torch/quantization/fx/fusion_patterns.py new file mode 100644 index 0000000000000000000000000000000000000000..e29337b3f861e5b54dc9f37d39d12ad975ad1315 --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/fx/fusion_patterns.py @@ -0,0 +1,9 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +appropriate files under `torch/ao/quantization/fx/`, while adding an import statement +here. +""" +from torch.ao.quantization.fx.fuse_handler import DefaultFuseHandler, FuseHandler diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fx/graph_module.py b/.venv/lib/python3.11/site-packages/torch/quantization/fx/graph_module.py new file mode 100644 index 0000000000000000000000000000000000000000..a71e980a57ba141bdc5bbe9b283d69582eb8fd82 --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/fx/graph_module.py @@ -0,0 +1,17 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +appropriate files under `torch/ao/quantization/fx/`, while adding an import statement +here. +""" +from torch.ao.quantization.fx.graph_module import ( + _is_observed_module, + _is_observed_standalone_module, + FusedGraphModule, + GraphModule, + ObservedGraphModule, + ObservedStandaloneGraphModule, + QuantizedGraphModule, +) diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fx/match_utils.py b/.venv/lib/python3.11/site-packages/torch/quantization/fx/match_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..8b49f7c645d8d1bc3a154d62a1295a90b155f986 --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/fx/match_utils.py @@ -0,0 +1,14 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +appropriate files under `torch/ao/quantization/fx/`, while adding an import statement +here. +""" +from torch.ao.quantization.fx.match_utils import ( + _find_matches, + _is_match, + _MatchResult, + MatchAllNode, +) diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fx/pattern_utils.py b/.venv/lib/python3.11/site-packages/torch/quantization/fx/pattern_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..2a83e180fc4dbaa28d1d41a10037684f0afa6610 --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/fx/pattern_utils.py @@ -0,0 +1,35 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +appropriate files under `torch/ao/quantization/fx/`, while adding an import statement +here. +""" +from torch.ao.quantization.fx.pattern_utils import ( + _register_fusion_pattern, + _register_quant_pattern, + get_default_fusion_patterns, + get_default_output_activation_post_process_map, + get_default_quant_patterns, + QuantizeHandler, +) + + +# QuantizeHandler.__module__ = _NAMESPACE +_register_fusion_pattern.__module__ = "torch.ao.quantization.fx.pattern_utils" +get_default_fusion_patterns.__module__ = "torch.ao.quantization.fx.pattern_utils" +_register_quant_pattern.__module__ = "torch.ao.quantization.fx.pattern_utils" +get_default_quant_patterns.__module__ = "torch.ao.quantization.fx.pattern_utils" +get_default_output_activation_post_process_map.__module__ = ( + "torch.ao.quantization.fx.pattern_utils" +) + +# __all__ = [ +# "QuantizeHandler", +# "_register_fusion_pattern", +# "get_default_fusion_patterns", +# "_register_quant_pattern", +# "get_default_quant_patterns", +# "get_default_output_activation_post_process_map", +# ] diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fx/prepare.py b/.venv/lib/python3.11/site-packages/torch/quantization/fx/prepare.py new file mode 100644 index 0000000000000000000000000000000000000000..ca65dcc04dd0021f0065892ca86e209a1c218473 --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/fx/prepare.py @@ -0,0 +1,9 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +appropriate files under `torch/ao/quantization/fx/`, while adding an import statement +here. +""" +from torch.ao.quantization.fx.prepare import prepare diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fx/quantization_patterns.py b/.venv/lib/python3.11/site-packages/torch/quantization/fx/quantization_patterns.py new file mode 100644 index 0000000000000000000000000000000000000000..20d8cc52ee4fb16843becec5487d9d4ee46681c9 --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/fx/quantization_patterns.py @@ -0,0 +1,48 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +appropriate files under `torch/ao/quantization/fx/`, while adding an import statement +here. +""" +from torch.ao.quantization.fx.quantize_handler import ( + BatchNormQuantizeHandler, + BinaryOpQuantizeHandler, + CatQuantizeHandler, + ConvReluQuantizeHandler, + CopyNodeQuantizeHandler, + CustomModuleQuantizeHandler, + DefaultNodeQuantizeHandler, + EmbeddingQuantizeHandler, + FixedQParamsOpQuantizeHandler, + GeneralTensorShapeOpQuantizeHandler, + LinearReLUQuantizeHandler, + QuantizeHandler, + RNNDynamicQuantizeHandler, + StandaloneModuleQuantizeHandler, +) + + +QuantizeHandler.__module__ = "torch.ao.quantization.fx.quantization_patterns" +BinaryOpQuantizeHandler.__module__ = "torch.ao.quantization.fx.quantization_patterns" +CatQuantizeHandler.__module__ = "torch.ao.quantization.fx.quantization_patterns" +ConvReluQuantizeHandler.__module__ = "torch.ao.quantization.fx.quantization_patterns" +LinearReLUQuantizeHandler.__module__ = "torch.ao.quantization.fx.quantization_patterns" +BatchNormQuantizeHandler.__module__ = "torch.ao.quantization.fx.quantization_patterns" +EmbeddingQuantizeHandler.__module__ = "torch.ao.quantization.fx.quantization_patterns" +RNNDynamicQuantizeHandler.__module__ = "torch.ao.quantization.fx.quantization_patterns" +DefaultNodeQuantizeHandler.__module__ = "torch.ao.quantization.fx.quantization_patterns" +FixedQParamsOpQuantizeHandler.__module__ = ( + "torch.ao.quantization.fx.quantization_patterns" +) +CopyNodeQuantizeHandler.__module__ = "torch.ao.quantization.fx.quantization_patterns" +CustomModuleQuantizeHandler.__module__ = ( + "torch.ao.quantization.fx.quantization_patterns" +) +GeneralTensorShapeOpQuantizeHandler.__module__ = ( + "torch.ao.quantization.fx.quantization_patterns" +) +StandaloneModuleQuantizeHandler.__module__ = ( + "torch.ao.quantization.fx.quantization_patterns" +) diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fx/quantization_types.py b/.venv/lib/python3.11/site-packages/torch/quantization/fx/quantization_types.py new file mode 100644 index 0000000000000000000000000000000000000000..a422cdd3142e04c8d16f495cc6cd65823451810b --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/fx/quantization_types.py @@ -0,0 +1,9 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +appropriate files under `torch/ao/quantization/fx/`, while adding an import statement +here. +""" +from torch.ao.quantization.utils import Pattern, QuantizerCls diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/fx/utils.py b/.venv/lib/python3.11/site-packages/torch/quantization/fx/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..ef35559884b7c430f1d5c72b21f72979108469a5 --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/fx/utils.py @@ -0,0 +1,20 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +appropriate files under `torch/ao/quantization/fx/`, while adding an import statement +here. +""" +from torch.ao.quantization.fx.utils import ( + all_node_args_have_no_tensors, + assert_and_get_unique_device, + create_getattr_from_value, + get_custom_module_class_keys, + get_linear_prepack_op_for_dtype, + get_new_attr_name_with_prefix, + get_non_observable_arg_indexes_and_types, + get_qconv_prepack_op, + graph_module_from_producer_nodes, + maybe_get_next_module, +) diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/observer.py b/.venv/lib/python3.11/site-packages/torch/quantization/observer.py new file mode 100644 index 0000000000000000000000000000000000000000..6e6c7c1917c83433fc19f016140b25d060284535 --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/observer.py @@ -0,0 +1,36 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +`torch/ao/quantization/observer.py`, while adding an import statement +here. +""" +from torch.ao.quantization.observer import ( + _is_activation_post_process, + _is_per_channel_script_obs_instance, + _ObserverBase, + _PartialWrapper, + _with_args, + _with_callable_args, + ABC, + default_debug_observer, + default_dynamic_quant_observer, + default_float_qparams_observer, + default_histogram_observer, + default_observer, + default_per_channel_weight_observer, + default_placeholder_observer, + default_weight_observer, + get_observer_state_dict, + HistogramObserver, + load_observer_state_dict, + MinMaxObserver, + MovingAverageMinMaxObserver, + MovingAveragePerChannelMinMaxObserver, + NoopObserver, + ObserverBase, + PerChannelMinMaxObserver, + PlaceholderObserver, + RecordingObserver, +) diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/qconfig.py b/.venv/lib/python3.11/site-packages/torch/quantization/qconfig.py new file mode 100644 index 0000000000000000000000000000000000000000..6bb7e14110cb9cdc4e9c2c418c6776ea6445f0d3 --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/qconfig.py @@ -0,0 +1,30 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +`torch/ao/quantization/qconfig.py`, while adding an import statement +here. +""" +from torch.ao.quantization.qconfig import ( + _add_module_to_qconfig_obs_ctr, + _assert_valid_qconfig, + default_activation_only_qconfig, + default_debug_qconfig, + default_dynamic_qconfig, + default_per_channel_qconfig, + default_qat_qconfig, + default_qat_qconfig_v2, + default_qconfig, + default_weight_only_qconfig, + float16_dynamic_qconfig, + float16_static_qconfig, + float_qparams_weight_only_qconfig, + get_default_qat_qconfig, + get_default_qconfig, + per_channel_dynamic_qconfig, + QConfig, + qconfig_equals, + QConfigAny, + QConfigDynamic, +) diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/quant_type.py b/.venv/lib/python3.11/site-packages/torch/quantization/quant_type.py new file mode 100644 index 0000000000000000000000000000000000000000..8555f03792661f39c85c8facf3f911786cc25d0f --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/quant_type.py @@ -0,0 +1,10 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +`torch/ao/quantization/quant_type.py`, while adding an import statement +here. +""" + +from torch.ao.quantization.quant_type import _get_quant_type_to_str, QuantType diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/quantization_mappings.py b/.venv/lib/python3.11/site-packages/torch/quantization/quantization_mappings.py new file mode 100644 index 0000000000000000000000000000000000000000..8b44a980ce82fbfa5a81ad906499806cf99b876f --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/quantization_mappings.py @@ -0,0 +1,29 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +`torch/ao/quantization/quantization_mappings.py`, while adding an import statement +here. +""" +from torch.ao.quantization.quantization_mappings import ( + _get_special_act_post_process, + _has_special_act_post_process, + _INCLUDE_QCONFIG_PROPAGATE_LIST, + DEFAULT_DYNAMIC_QUANT_MODULE_MAPPINGS, + DEFAULT_FLOAT_TO_QUANTIZED_OPERATOR_MAPPINGS, + DEFAULT_MODULE_TO_ACT_POST_PROCESS, + DEFAULT_QAT_MODULE_MAPPINGS, + DEFAULT_REFERENCE_STATIC_QUANT_MODULE_MAPPINGS, + DEFAULT_STATIC_QUANT_MODULE_MAPPINGS, + get_default_compare_output_module_list, + get_default_dynamic_quant_module_mappings, + get_default_float_to_quantized_operator_mappings, + get_default_qat_module_mappings, + get_default_qconfig_propagation_list, + get_default_static_quant_module_mappings, + get_dynamic_quant_module_class, + get_quantized_operator, + get_static_quant_module_class, + no_observer_set, +) diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/quantize.py b/.venv/lib/python3.11/site-packages/torch/quantization/quantize.py new file mode 100644 index 0000000000000000000000000000000000000000..600d3a46fed0346e3ae8909872cd5bf3c733860c --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/quantize.py @@ -0,0 +1,30 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +`torch/ao/quantization/quantize.py`, while adding an import statement +here. +""" + +from torch.ao.quantization.quantize import ( + _add_observer_, + _convert, + _get_observer_dict, + _get_unique_devices_, + _is_activation_post_process, + _observer_forward_hook, + _propagate_qconfig_helper, + _register_activation_post_process_hook, + _remove_activation_post_process, + _remove_qconfig, + add_quant_dequant, + convert, + prepare, + prepare_qat, + propagate_qconfig_, + quantize, + quantize_dynamic, + quantize_qat, + swap_module, +) diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/quantize_fx.py b/.venv/lib/python3.11/site-packages/torch/quantization/quantize_fx.py new file mode 100644 index 0000000000000000000000000000000000000000..649142c7a7eee9885d96b37f70e582f3ea9a9f8d --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/quantize_fx.py @@ -0,0 +1,26 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +`torch/ao/quantization/quantize_fx.py`, while adding an import statement +here. +""" + +from torch.ao.quantization.fx.graph_module import ObservedGraphModule +from torch.ao.quantization.quantize_fx import ( + _check_is_graph_module, + _convert_fx, + _convert_standalone_module_fx, + _fuse_fx, + _prepare_fx, + _prepare_standalone_module_fx, + _swap_ff_with_fxff, + convert_fx, + fuse_fx, + prepare_fx, + prepare_qat_fx, + QuantizationTracer, + Scope, + ScopeContextManager, +) diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/quantize_jit.py b/.venv/lib/python3.11/site-packages/torch/quantization/quantize_jit.py new file mode 100644 index 0000000000000000000000000000000000000000..aa627dc7bb51ef7ea1fde7e2e5da283c9f6c8900 --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/quantize_jit.py @@ -0,0 +1,26 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +`torch/ao/quantization/quantize_jit.py`, while adding an import statement +here. +""" + +from torch.ao.quantization.quantize_jit import ( + _check_forward_method, + _check_is_script_module, + _convert_jit, + _prepare_jit, + _prepare_ondevice_dynamic_jit, + _quantize_jit, + convert_dynamic_jit, + convert_jit, + fuse_conv_bn_jit, + prepare_dynamic_jit, + prepare_jit, + quantize_dynamic_jit, + quantize_jit, + script_qconfig, + script_qconfig_dict, +) diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/stubs.py b/.venv/lib/python3.11/site-packages/torch/quantization/stubs.py new file mode 100644 index 0000000000000000000000000000000000000000..d3fd5c63683dc572c35cabc202ee4ddb2b0053c6 --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/stubs.py @@ -0,0 +1,10 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +`torch/ao/quantization/stubs.py`, while adding an import statement +here. +""" + +from torch.ao.quantization.stubs import DeQuantStub, QuantStub, QuantWrapper diff --git a/.venv/lib/python3.11/site-packages/torch/quantization/utils.py b/.venv/lib/python3.11/site-packages/torch/quantization/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..7d51d58f38d7462713f84ab62427852c1dd8e52c --- /dev/null +++ b/.venv/lib/python3.11/site-packages/torch/quantization/utils.py @@ -0,0 +1,29 @@ +# flake8: noqa: F401 +r""" +Utils shared by different modes of quantization (eager/graph) + +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +`torch/ao/quantization/utils.py`, while adding an import statement +here. +""" + +from torch.ao.quantization.utils import ( + activation_dtype, + activation_is_int8_quantized, + activation_is_statically_quantized, + calculate_qmin_qmax, + check_min_max_valid, + get_combined_dict, + get_qconfig_dtypes, + get_qparam_dict, + get_quant_type, + get_swapped_custom_module_class, + getattr_from_fqn, + is_per_channel, + is_per_tensor, + weight_dtype, + weight_is_quantized, + weight_is_statically_quantized, +)