Repository navigation
[Typing] Modernize type hints in logger, datasets, and observers - #2960
Conversation
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Require one maintainer reviewAll PRs must have at least one approving review from a maintainer before merging.
|
There was a problem hiding this comment.
Code Review
This pull request modernizes the type hinting across several files, including utils.py, logger.py, and imatrix.py, by replacing typing.Optional and typing.Dict with PEP 604 union syntax (|) and built-in generic types (dict). There are no review comments, and I have no feedback to provide.
|
👋 Hi! Thank you for contributing to llm-compressor. Please add the ready label when the PR is ready for review. Note: This is required to complete the testing suite, please only add the label once the PR is code complete and local testing has been performed. |
|
The quality checks have failed. Please run |
|
@arijitroy003 Please make style |
|
This pull request has merge conflicts that must be resolved before it can be |
Replace typing.Optional[X] with X | None and typing.Dict with dict following Python 3.10+ syntax. Complements existing typing modernization work in PR vllm-project#2775 by covering additional modules. Changed files: - src/llmcompressor/logger.py - src/llmcompressor/datasets/utils.py - src/llmcompressor/observers/imatrix.py Signed-off-by: arijitroy003 <arijitroy003@gmail.com>
Head branch was pushed to by a user without write access
eb9481d to
3dd71fa
Compare
|
Rebased on main — merge conflicts resolved. This is approved and ready to merge. |

Summary
Modernizes type hints to Python 3.10+ syntax by replacing
typing.Optional[X]withX | Noneandtyping.Dictwithdict.This PR complements the existing typing modernization work in PR #2775 by covering additional modules not addressed there.
Changes
src/llmcompressor/logger.py: ReplacedOptional[str],Optional[int], andDict[str, Any]with modern syntaxsrc/llmcompressor/datasets/utils.py: ReplacedOptional[int]withint | Nonesrc/llmcompressor/observers/imatrix.py: Replaced allOptional[torch.Tensor]withtorch.Tensor | NoneTesting
Changes verified via grep to ensure no old-style typing imports remain in modified files. Type annotations only—no runtime behavior changes.