Clean up minor code smells across Python and C++ sources#544
Open
ZabaHD4K wants to merge 1 commit intomicrosoft:mainfrom
Open
Clean up minor code smells across Python and C++ sources#544ZabaHD4K wants to merge 1 commit intomicrosoft:mainfrom
ZabaHD4K wants to merge 1 commit intomicrosoft:mainfrom
Conversation
- Replace bare except clauses with specific exception types (test_perplexity.py, quantize_embeddings.py) - Remove duplicate imports of sys and pathlib.Path (generate-dummy-bitnet-model.py) - Fix no-op .format() calls on config key strings that had no placeholders (codegen_tl1.py, codegen_tl2.py) - Use os.path.join() instead of string concatenation for file paths (codegen_tl1.py, codegen_tl2.py) - Use sys.exit(1) instead of exit(0) for unsupported arch error (setup_env.py) - Translate remaining Chinese comments to English (quantize_embeddings.py, tune_gemm_config.py) - Fix typo ENBALE -> ENABLE in macro name and remove unused iostream include (bitnet_kernels.h) - Rename variable that shadowed the os module (quantize_embeddings.py) - Use C++ headers instead of C headers in C++ sources (ggml-bitnet-lut.cpp, ggml-bitnet-mad.cpp) Co-Authored-By: Carlos Valés <123006395+carlosvales@users.noreply.github.com>
Author
|
@microsoft-github-policy-service agree |
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.
During one of our regular pair programming sessions, we were browsing through the codebase and noticed a handful of small things that are easy to overlook in a fast-moving project — the kind of stuff that nobody prioritizes because it never breaks anything, but quietly adds up over time.
None of these are critical, but we figured it was worth cleaning them up in a single pass while we had fresh eyes on the code.
Changes
exceptclauses with specific exception types (OSError,ValueError)import sys/from pathlib import Pathingenerate-dummy-bitnet-model.py.format(i)calls on config keys that had no{}placeholders — they silently did nothingos.path.join()instead of string concatenation for building file paths (matters on Windows)exit(0)being used for an error condition — should besys.exit(1)TVM_ENBALE_EFFICIENT_SMEM_PTR_CAST→TVM_ENABLE_EFFICIENT_SMEM_PTR_CAST#include <iostream>from CUDA kernel headerosthat was shadowing theosmodule import<cassert>,<cstring>) instead of C equivalents in.cppfiles