Support Python 3.10#35
Open
BaoYunkai wants to merge 1 commit into
Open
Conversation
Quark 0.12 declared Python >=3.11 but only used two 3.11-only symbols, which have drop-in 3.10 equivalents: - `typing.Self` -> import from `typing_extensions` (already a dependency). - `datetime.UTC` -> `datetime.timezone.utc`. Lower the floor to Python 3.10 in `pyproject.toml` / `setup.py` and add the 3.10 classifier so Quark installs and runs on 3.10 environments (e.g. venvs that ship torch/other stacks pinned to 3.10).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Quark 0.12 declares
requires-python = ">=3.11,<3.14", but the only Python3.11-specific features used in the codebase are two symbols that have drop-in
3.10 equivalents. This PR lowers the supported floor to Python 3.10 so Quark
installs and runs on 3.10 environments (e.g. venvs shipping a torch / serving
stack pinned to 3.10).
Changes
quark/torch/quantization/nn/modules/quantize_conv_bn_fused.py: importSelffromtyping_extensionsinstead oftyping(typing.Selfis 3.11+).This module is imported on the Torch quantization path via
quark.torch.quantization.nn.modules.__init__, so it brokeimporton 3.10.quark/contrib/llm_eval/experiment_report.py: replacedatetime.UTC(3.11+)with
datetime.timezone.utc.pyproject.toml/setup.py: lowerrequires-python/python_requiresfloor from 3.11 to 3.10 and add the
Python :: 3.10classifier.Verification
On Python 3.10.12:
from quark.torch.quantization.nn.modules import QuantizedConvBatchNorm2draised
ImportError: cannot import name 'Self' from 'typing'.from quark.torch import ModelQuantizerand the ONNX export API importcleanly, and the C++ kernel extension builds/loads (gfx942/gfx950).
Test plan
pip install -e .succeeds on a Python 3.10 venv