PTQ-Level Efficiency, QAT-Level Accuracy | 训练后量化的效率,量化感知训练的精度
Remove unused hook (#122)
Sun, Xuehaoc7751c49853e
diff --git a/.azure-pipelines/license_template.txt b/.azure-pipelines/license_template.txtnew file mode 100644index 000000000..9744588b4--- /dev/null+++ b/.azure-pipelines/license_template.txt@@ -0,0 +1,13 @@+Copyright (c) 2024 Intel Corporation++Licensed under the Apache License, Version 2.0 (the "License");+you may not use this file except in compliance with the License.+You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++Unless required by applicable law or agreed to in writing, software+distributed under the License is distributed on an "AS IS" BASIS,+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+See the License for the specific language governing permissions and+limitations under the License.diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yamlindex 89d0f0046..5309127ad 100644--- a/.pre-commit-config.yaml+++ b/.pre-commit-config.yaml@@ -2,114 +2,31 @@ ci:autofix_prs: trueautoupdate_schedule: quarterly-exclude: |- (?x)^(- neural_coder/test/.+|- neural_coder/examples/.+- )$-repos:- - repo: https://github.com/pre-commit/pre-commit-hooks- rev: v4.5.0- hooks:- - id: end-of-file-fixer- files: (.*\.(py|md|rst|yaml|yml))$- exclude: |- (?x)^(- examples/.+- )$- - id: check-json- exclude: |- (?x)^(- .vscode/settings_recommended.json- )$- - id: check-yaml- - id: debug-statements- - id: file-contents-sorter- args: [--unique]- - id: requirements-txt-fixer- exclude: |- (?x)^(- examples/.+- )$- - id: trailing-whitespace- files: (.*\.(py|rst|cmake|yaml|yml))$- exclude: |- (?x)^(- examples/.+- )$-- - repo: https://github.com/asottile/yesqa- rev: v1.5.0+ - repo: https://github.com/Lucas-C/pre-commit-hooks+ rev: v1.5.5hooks:- - id: yesqa- name: Unused noqa-- - repo: https://github.com/pycqa/isort- rev: 5.13.2- hooks:- - id: isort- exclude: |+ - id: insert-license+ files: |(?x)^(- examples/.++ auto_round/.*(py|yaml|yml|sh))$-- - repo: https://github.com/PyCQA/docformatter- rev: v1.7.5- hooks:- - id: docformatter- args: [- --in-place,- --wrap-summaries=0, # 0 means disable wrap- --wrap-descriptions=0, # 0 means disable wrap- --black,- --style=google,+ args:+ [+ --license-filepath=.azure-pipelines/license_template.txt,+ --use-current-year,+ --detect-license-in-X-top-lines=40,+ --skip-license-insertion-comment=Copyright,]- exclude: |- (?x)^(- examples/.+- )$-- - repo: https://github.com/psf/black.git- rev: 24.3.0- hooks:- - id: black- files: (.*\.py)$- exclude: |- (?x)^(- examples/.+- )$-- - repo: https://github.com/asottile/blacken-docs- rev: 1.16.0- hooks:- - id: blacken-docs- args: [--line-length=120, --skip-errors]- additional_dependencies:- - black==24.1.1- exclude: |- (?x)^(- examples/.+|- docs/.+- )$- repo: https://github.com/codespell-project/codespellrev: v2.2.6hooks:- id: codespell+ args: [-w]additional_dependencies:- tomliexclude: |(?x)^(- examples/.*(txt|patch)|- )$-- - repo: https://github.com/astral-sh/ruff-pre-commit- rev: v0.3.5- hooks:- - id: ruff- args: [--fix, --exit-non-zero-on-fix, --no-cache]- exclude: |- (?x)^(- examples/.++ examples/.*(txt|patch))$diff --git a/auto_round/calib_dataset.py b/auto_round/calib_dataset.pyindex 7b25eef45..9f8e0c2b7 100644--- a/auto_round/calib_dataset.py+++ b/auto_round/calib_dataset.py@@ -1,3 +1,17 @@+# Copyright (c) 2024 Intel Corporation+#+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.+import jsonimport randomdiff --git a/auto_round/export/export_to_autoround/__init__.py b/auto_round/export/export_to_autoround/__init__.pyindex be98f7b1b..5d920a116 100644--- a/auto_round/export/export_to_autoround/__init__.py+++ b/auto_round/export/export_to_autoround/__init__.py@@ -1,3 +1,17 @@+# Copyright (c) 2024 Intel Corporation+#+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.+import transformersfrom .autoround_quantizer import AutoHfQuantizerdiff --git a/docs/Meta-Llama-3-8B-Instruct-acc.md b/docs/Meta-Llama-3-8B-Instruct-acc.mdindex 24db99924..448c4e473 100644--- a/docs/Meta-Llama-3-8B-Instruct-acc.md+++ b/docs/Meta-Llama-3-8B-Instruct-acc.md@@ -9,7 +9,7 @@ for evaluation with quantized lm-head```bashgit clone https://github.com/intel/auto-roundcd auto-round/examples/language-modeling-python3 eval_042/evluation.py --model_name "./" --eval_bs 16+python3 eval_042/evaluation.py --model_name "./" --eval_bs 16```| Metric | **BF16** | w4g128 w/o lm-head | w4g128 with lm-head |diff --git a/pyproject.toml b/pyproject.tomldeleted file mode 100644index dac86a1fc..000000000--- a/pyproject.toml+++ /dev/null@@ -1,124 +0,0 @@-[tool.isort]-profile = "black"-line_length = 120-known_first_party = ["auto_round"]-extend_skip_glob = ["**/__init__.py"]---[tool.black]-line-length = 120---[tool.codespell]-skip = '*.po,*.ts,*.js,*.map,*.js.map,*.css.map'-count = ''-quiet-level = 3---[tool.ruff]-# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.-select = ["E", "F"]-ignore = [- "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- "F405", # {name} may be undefined, or defined from star imports- "F841", # Local variable is assigned to but never used{name}-]--ignore-init-module-imports = true--# Allow autofix for all enabled rules (when `--fix`) is provided.-fixable = [- "A",- "B",- "C",- "D",- "E",- "F",- "G",- "I",- "N",- "Q",- "S",- "T",- "W",- "ANN",- "ARG",- "BLE",- "COM",- "DJ",- "DTZ",- "EM",- "ERA",- "EXE",- "FBT",- "ICN",- "INP",- "ISC",- "NPY",- "PD",- "PGH",- "PIE",- "PL",- "PT",- "PTH",- "PYI",- "RET",- "RSE",- "RUF",- "SIM",- "SLF",- "TCH",- "TID",- "TRY",- "UP",- "YTT",-]-unfixable = []--# Exclude a variety of commonly ignored directories.-exclude = [- ".bzr",- ".direnv",- ".eggs",- ".git",- ".git-rewrite",- ".hg",- ".mypy_cache",- ".nox",- ".pants.d",- ".pytype",- ".ruff_cache",- ".svn",- ".tox",- ".venv",- "__pypackages__",- "_build",- "buck-out",- "build",- "dist",- "node_modules",- "venv",-]--# Same as Black.-line-length = 120--# Allow unused variables when underscore-prefixed.-dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"--# Assume Python 3.10.-target-version = "py310"--[tool.ruff.per-file-ignores]-"**/__init__.py" = ["F401"]--[tool.ruff.mccabe]-# Unlike Flake8, default to a complexity level of 10.-max-complexity = 10