Repository navigation
Fix Ruff lint findings in gguf _builder.py - #544
Merged
Merged
Conversation
- Remove redundant quotes from torch.Tensor annotations in _reorder_deltanet_v_heads (Ruff UP037); the module already has `from __future__ import annotations` so quoting is unnecessary. - Combine two endswith() calls into a single tuple-based call in the bare linear_attn parameter loop (Ruff PIE810). - Apply ruff-format to reflow the layer_stems set comprehension and the _reorder_out_proj_cols signature that these changes affected. No behavior change; verified with lintrunner and targeted GGUF tests. Co-authored-by: Copilot <[email protected]> Signed-off-by: justinchuby <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes Ruff lint and formatting findings in the GGUF builder without changing behavior.
Changes:
- Removes redundant quoted
torch.Tensorannotations. - Combines suffix checks.
- Applies Ruff formatting updates.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Performance Comparison
|
| return t.index_select(0, idx) | ||
|
|
||
| def _index_dim1(t: "torch.Tensor", idx: "torch.Tensor") -> "torch.Tensor": | ||
| def _index_dim1(t: torch.Tensor, idx: torch.Tensor) -> torch.Tensor: |
Member
Author
|
Reviewed the automated feedback on this PR:
|
Follow-up to the gguf _builder.py lint fix: clears every other current lintrunner (Ruff) finding on main so the CI Lint gate is fully green, not just free of new alerts. All changes are mechanical and behavior-neutral (test files only): - _builder_test.py: RUF005 - replace list concatenation with iterable unpacking for new_shape; RUFF-FORMAT reflow of the out_proj.weight / out_proj.scales dict entries. - _config_mapping_test.py: D205 - join the wrapped docstring summary line in TestQwen35RopeInterleave onto one line so it is followed by a blank line before the description (matches the existing docstring convention elsewhere in this file); RUFF-FORMAT blank-line spacing before TestMuseGlimmerPostprocess. - _group_query_attention_test.py: RUFF-FORMAT collapse of a short multi-line assert onto one line and blank-line spacing before TestSlidingWindowSurvivesFusion. Verified with `lintrunner --all-files` (pinned ruff 0.16.2): clean. Co-authored-by: Copilot <[email protected]> Signed-off-by: justinchuby <[email protected]>
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
Fixes the current CI lint failures in
src/mobius/integrations/gguf/_builder.pyreported bylintrunner(Ruff):torch.Tensorannotations in the local helper functions of_reorder_deltanet_v_heads(_expand,_index_dim0,_index_dim1,_apply_rows,_apply_bare). The module already hasfrom __future__ import annotations, so quoting these string-forward-references is unnecessary.k.endswith(".linear_attn.A_log") or k.endswith(".linear_attn.dt_bias")into a singlek.endswith((".linear_attn.A_log", ".linear_attn.dt_bias"))call.layer_stemsset comprehension and the_reorder_out_proj_colssignature that were affected by the above changes.No behavior change — purely lint/formatting fixes.
Testing
lintrunneron the changed file: clean (ok No lint issues.)lintrunneragainstmerge_base_with = main: clean (ok No lint issues.)python -m pytest tests/gguf_test.py src/mobius/integrations/gguf/_builder_test.py -q: 91 passedpython -m pytest tests/build_graph_test.py tests/cli_test.py src/ -q -k "gguf": 321 passedCo-authored-by: Copilot [email protected]