-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathpyproject.toml
More file actions
272 lines (250 loc) · 7.72 KB
/
pyproject.toml
File metadata and controls
272 lines (250 loc) · 7.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools >= 61.0",
# these are used by contrib/onnx_utils to generate protobuf files,
# see setup.py for the invocation
# version is arbitrarily set to 31.1 for an older protoc binary for wider
# runtime compatibility
"protobuf-protoc-bin==31.1",
"mypy-protobuf"
]
[project]
authors = [{ name = 'AMD' }]
classifiers = [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
]
description = "AMD Quark is a comprehensive cross-platform toolkit designed to simplify and enhance the quantization of deep learning models. Supporting both PyTorch and ONNX models, AMD Quark empowers developers to optimize their models for deployment on a wide range of hardware backends, achieving significant performance gains without compromising accuracy."
dynamic = ["dependencies", "version"]
keywords = ["quantization", "pytorch", "onnx"]
license = {file = "LICENSE"}
maintainers = [
{ name = "AMD Quark Maintainers", email = "quark.maintainers@amd.com" },
]
name = "amd-quark"
readme = "README.md"
requires-python = ">= 3.10"
[project.urls]
documentation = "https://quark.docs.amd.com"
homepage = "https://github.com/amd/quark"
issues = "https://github.com/amd/quark/issues"
repository = "https://github.com/amd/quark.git"
[project.optional-dependencies]
lint = [
"mypy==1.18.2",
"opencv-python",
"pre-commit",
"pydantic",
"pytest",
"pyyaml",
"ruff",
"types-PyYAML",
]
[project.scripts]
quark-cli = "quark.experimental.cli.main:main"
[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
version = { attr = 'quark.__version__' }
[tool.ruff]
line-length = 120
target-version = "py310"
exclude = [
"setup.py",
"docs/source/conf.py",
"quark/torch/algorithm/rotation/hadamard.py"
]
[tool.ruff.lint]
select = [
"B", # flake8-bugbear
"C", # comprehension and complexity
"E", # pycodestyle error
"F", # Pyflakes
"G", # flake8-logging-format
"I", # isort
"SIM", # flake8-simplify
"UP", # pyupgrade
"W", # pycodestyle warning
]
ignore = [
"B006", # Do not use mutable data structures for argument defaults
"B007", # loop variable not used in loop
"B008", # Do not perform function call in argument defaults
"B023", # Function definition does not bind loop variable
"B024", # abstract class has no abstract methods or properties
"B026", # Star-arg unpacking after a keyword argument is strongly discouraged
"B027", # empty method in an abstract base class, but has no abstract decorator
"B028", # No explicit `stacklevel` keyword argument found
"B904", # use raise ... from err or raise ... from None in except clauses
"C401", # Unnecessary generator (rewrite as a set comprehension)
"C402", # Unnecessary generator (rewrite as a dict comprehension)
"C403", # Unnecessary list comprehension (rewrite as a set comprehension)
"C408", # Unnecessary `dict()` call (rewrite as a literal)
"C409", # Unnecessary list literal passed to `tuple()` (rewrite as a tuple literal)
"C416", # unnecessary comprehension
"C419", # unnecessary list comprehension
"C901", # function is too complex
"E501", # line too long
"E721", # Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks
"E741", # Ambiguous variable name
"G003", # + in logging statements
"G004", # f-strings in logging statements
"SIM101", # Multiple `isinstance` calls, merge into a single call
"SIM102", # use single if statement instead of nested
"SIM103", # return the condition directly
"SIM105", # Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass`
"SIM108", # use ternary operator instead of if-else
"SIM110", # use any(...)
"SIM113", # Use `enumerate()` in `for` loop
"SIM115", # use a context manager for files
"SIM201", # Use !=
"SIM210", # Remove unnecessary `True if ... else False`
"SIM211", # use not ... instead of False if ... else True
"SIM401", # use .get() instead of if
"UP007", # Use `X | Y` for type annotations
"UP008", # use super()
"UP031", # use format specifiers instead of percent format
"UP035", # `typing.ContextManager` is deprecated
"UP038", # use | in isinstance calls
]
# extend-select = ["ALL"]
[tool.mypy]
strict = true
disable_error_code = ["method-assign", "unused-ignore"]
plugins = ['pydantic.mypy']
exclude_gitignore = true
[[tool.mypy.overrides]]
module = ["quark.*"]
allow_redefinition = true
disable_error_code = ["misc", "no-any-return", "arg-type", "index"]
[[tool.mypy.overrides]]
module = [
"quark.torch.quantization.fake_quantize.*",
"quark.onnx.*",
"quark.onnxslim.*",
]
disallow_untyped_calls = false
[[tool.mypy.overrides]]
module = ["quark.torch.quantization.observer.*"]
disallow_untyped_calls = false
disable_error_code = ["override"]
[[tool.mypy.overrides]]
module = [
"examples.*",
"quark.experimental.cli.quark_onnx.*",
"quark.experimental.cli.torch_llm.llm_eval.*",
"quark.experimental.cli.torch_llm.llm_ptq.*",
"quark.experimental.cli.torch_llm.llm_utils.*",
"quark.experimental.cli.torch_llm.module_replacement.*",
"quark.torch.export.json_export.converter.*",
]
ignore_errors = true
# From mypy.ini, TODO: this is temporary while the submodule persists. Tracked in #2791
[[tool.mypy.overrides]]
module = ["quark.contrib.onnx_utils.*"]
ignore_errors = true
[[tool.mypy.overrides]]
module = [
"accelerate.*",
"bokeh.*",
"brevitas.*",
"cv2",
"datasets.*",
"evaluate.*",
"gguf.*",
"google.*",
"lm_eval.*",
"matplotlib.*",
"ml_dtypes.*",
"nltk.*",
"numpy.*",
"onnx.*",
"onnx_tool.*",
"onnxruntime.*",
"onnxruntime_extensions.*",
"onnxruntime_genai.*",
"onnxscript.*",
"onnxslim.*",
"optimum.*",
"packaging",
"packaging.version",
"packaging.*",
"pandas.*",
"protobuf.*",
"psutil.*",
"pydantic.*",
"pytest",
"pytest.*",
"PIL.*",
"quark.contrib.*",
"quark.version.*",
"rich.*",
"ryzenai_onnx_utils.*",
"safetensors.*",
"scipy.*",
"sentencepiece.*",
"six.*",
"sympy.*",
"timm.*",
"torch.*",
"transformers.*",
"tqdm.*",
]
ignore_missing_imports = true
# TODO: Fix this
[[tool.mypy.overrides]]
module = "torch.*"
follow_imports = "skip"
[tool.coverage.paths]
source = [
"/scratch/**/Quark/Quark/",
]
[tool.coverage.run]
branch = true
relative_files = true
omit = [
"*/quark/onnx/tools/*",
"*/quark/torch/kernel/mx/triton.py",
"*/test/*",
]
# concurrency = multiprocessing
[tool.coverage.report]
# Regexes for lines to exclude from consideration
exclude_also = [
# Don't complain about missing debug-only code:
"def __repr__",
"if self\\.debug",
# Don't complain if tests don't hit defensive assertion code:
"raise AssertionError",
"raise ValueError",
"raise NotImplementedError",
"raise FileNotFoundError",
"raise RuntimeError",
"raise ImportError",
"raise ModuleNotFoundError",
# Don't complain if non-runnable code isn't run:
"if 0:",
"if __name__ == .__main__.:",
# Don't complain about abstract methods, they aren't run:
"@(abc\\.)?abstractmethod",
]
[tool.pytest.ini_options]
pythonpath = [".", ".github/scripts", "test"]
addopts = [
"--strict-markers",
"--strict-config",
"-ra",
"-vvvvv",
"-s"]
markers = [
"accelerate_test: Tests which requires `accelerate` library to run.",
"require_dual_gpu: Tests which requires two GPU devices to run",
"tensor_parallel: Tests for the Tensor Parallel feature",
]