PTQ-Level Efficiency, QAT-Level Accuracy | 训练后量化的效率,量化感知训练的精度
[build-system]
requires = ["setuptools>=64", "wheel"]
build-backend = "setuptools.build_meta"
[tool.pytest.ini_options]
markers = [
"perf: performance benchmark tests (excluded from default CI runs; select with `-m perf`)",
"enable_torch_compile: opt in to real torch.compile for tests that need compile behavior",
]
[tool.codespell]
skip = 'pyproject.toml,.azure-pipelines/scripts/codeScan/codespell/autoround_dict.txt,auto_round_extension/ark/*'
ignore-words = ".azure-pipelines/scripts/codeScan/codespell/autoround_dict.txt"
[tool.isort]
profile = "black"
line_length = 120
known_first_party = ["auto_round", "auto_round_extension"]
extend_skip_glob = ["**/__init__.py"]
[tool.black]
line-length = 120
[tool.typos]
[tool.typos.files]
extend-exclude = [
".azure-pipelines/scripts/codeScan/codespell/autoround_dict.txt",
".azure-pipelines/scripts/cuda_unit_test/runpod_manager.py",
"auto_round_extension/ark"
]
[tool.typos.default.extend-words]
ba = "ba"
ue = "ue"
endianess = "endianess"
thw = "thw"
[tool.ruff]
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
"auto_round/export/export_to_gguf/conversion",
]
# Same as Black.
line-length = 120
indent-width = 4
# Assume Python 3.11
target-version = "py311"
[tool.ruff.lint]
# Using default rules: https://docs.astral.sh/ruff/default-rules/
ignore = [
"B023", # Function definition does not bind loop variable (closures here are invoked within the same iteration)
"BLE001", # Do not catch blind exception: `Exception`
"E402", # Module level import not at top of file
"E501", # Line too long (121 > 120 characters)
"E721", # Do not compare types, use isinstance()
"E722", # Do not use bare except
"E731", # Do not assign a lambda expression, use a def
"E741", # Do not use variables named ‘l’, ‘O’, or ‘I’
"F401", # {name} imported but unused
"F403", # from {name} import * used; unable to detect undefined names
"F841", # Local variable is assigned to but never used{name}
"FURB171", # Membership test against single-item container
"I001", # Import block is un-sorted or un-formatted (handled by isort hook)
"PLR0402", # Use `from torch import nn` in lieu of alias (`import torch.nn as nn` is the PyTorch idiom)
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
"RUF059", # Unpacked variable is never used
"RUF100", # Unused `noqa` directive (keeps noqa for globally ignored rules)
"S110", # `try`-`except`-`pass` detected
"S112", # `try`-`except`-`continue` detected
"SIM102", # Use a single `if` statement instead of nested `if` statements
"SIM118", # Use `key in dict` instead of `key in dict.keys()` (safetensors handles only expose `.keys()`)
"TRY004", # Prefer `TypeError` exception for invalid type (changing exception types breaks callers)
]
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.lint.flake8-comprehensions]
allow-dict-calls-with-keyword-arguments = true
[tool.ruff.lint.flake8-bugbear]
extend-immutable-calls = ["torch.device"]
[tool.ruff.format]
# Like Black, use double quotes for strings.
quote-style = "double"
# Like Black, indent with spaces, rather than tabs.
indent-style = "space"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"
# Enable auto-formatting of code examples in docstrings. Markdown,
# reStructuredText code/literal blocks and doctests are all supported.
#
# This is currently disabled by default, but it is planned for this
# to be opt-out in the future.
docstring-code-format = false
# Set the line length limit used when formatting code snippets in
# docstrings.
#
# This only has an effect when the `docstring-code-format` setting is
# enabled.
docstring-code-line-length = "dynamic"