mirror of
https://github.com/NVIDIA/TensorRT-LLM.git
synced 2026-01-13 22:18:36 +08:00
[None][chore] add precommit hook to remove redundant tab and white space (#8534)
Signed-off-by: Xin He (SW-GPU) <200704525+xinhe-nv@users.noreply.github.com>
This commit is contained in:
parent
910e6b9684
commit
b8b2c9efb4
@ -84,6 +84,11 @@ repos:
|
||||
files: ".*/auto_deploy/.*"
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: test lists format
|
||||
name: Check for tabs and multiple spaces in test_lists txt files
|
||||
entry: ./scripts/format_test_list.py
|
||||
language: script
|
||||
files: tests/integration/test_lists/.*\.txt$
|
||||
- id: DCO check
|
||||
name: Checks the commit message for a developer certificate of origin signature
|
||||
entry: ./scripts/dco_check.py
|
||||
|
||||
48
scripts/format_test_list.py
Executable file
48
scripts/format_test_list.py
Executable file
@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Normalize tabs and multiple spaces to single spaces in files."""
|
||||
import argparse
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
def normalize_whitespace(content: str) -> str:
|
||||
"""Remove leading whitespace, replace tabs and multiple spaces with single spaces."""
|
||||
lines = content.splitlines(keepends=True)
|
||||
normalized_lines = []
|
||||
|
||||
for line in lines:
|
||||
# Remove leading whitespace and tabs
|
||||
line = line.lstrip(' \t')
|
||||
# Replace tabs with single space
|
||||
line = line.replace('\t', ' ')
|
||||
# Replace multiple spaces with single space
|
||||
line = re.sub(r' +', ' ', line)
|
||||
normalized_lines.append(line)
|
||||
|
||||
return ''.join(normalized_lines)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Normalize tabs and multiple spaces to single spaces')
|
||||
parser.add_argument('filenames', nargs='*', help='Filenames to fix')
|
||||
args = parser.parse_args()
|
||||
|
||||
retval = 0
|
||||
for filename in args.filenames:
|
||||
with open(filename, 'r', encoding='utf-8') as f:
|
||||
original_contents = f.read()
|
||||
|
||||
normalized_contents = normalize_whitespace(original_contents)
|
||||
|
||||
if original_contents != normalized_contents:
|
||||
print(f'Fixing {filename}')
|
||||
with open(filename, 'w', encoding='utf-8') as f:
|
||||
f.write(normalized_contents)
|
||||
retval = 1
|
||||
|
||||
return retval
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
@ -55,7 +55,7 @@ full:B200_PCIe/unittest/test_model_runner_cpp.py SKIP (Disable for Blackwell)
|
||||
full:B200_PCIe/unittest/llmapi/test_llm_models.py -m "part0" SKIP (Disable for Blackwell for context fmha doesn't support when headsize is 80/96)
|
||||
full:B200_PCIe/examples/test_nemotron.py::test_llm_nemotron_3_8b_1gpu[bfloat16-fp8] SKIP (megatron-core 0.8 is not supported in python 3.12)
|
||||
full:B200_PCIe/accuracy/test_cli_flow.py::TestMixtral8x7B::test_fp4_plugin SKIP (Disable for Blackwell OOM)
|
||||
full:B200_PCIe/unittest/llmapi/test_llm_models.py -m "not (part0 or part1)" SKIP (Disable for Blackwell OOM)
|
||||
full:B200_PCIe/unittest/llmapi/test_llm_models.py -m "not (part0 or part1)" SKIP (Disable for Blackwell OOM)
|
||||
full:B200/unittest/trt/functional SKIP (Disable for Blackwell)
|
||||
full:B200/unittest/trt/quantization SKIP (Disable for Blackwell)
|
||||
full:B200/unittest/trt/attention/test_bert_attention.py SKIP (Disable for Blackwell)
|
||||
@ -70,7 +70,7 @@ full:B200/unittest/llmapi/test_llm_models.py -m "part0" SKIP (Disable for Blackw
|
||||
full:B200/examples/test_multimodal.py::test_llm_multimodal_general[video-neva-pp:1-tp:1-bfloat16-bs:1-cpp_e2e:False-nb:1] SKIP (megatron-core 0.8 is not supported in python 3.12)
|
||||
full:B200/examples/test_nemotron.py::test_llm_nemotron_3_8b_1gpu[bfloat16-fp8] SKIP (megatron-core 0.8 is not supported in python 3.12)
|
||||
full:B200/accuracy/test_cli_flow.py::TestMixtral8x7B::test_fp4_plugin SKIP (Disable for Blackwell OOM)
|
||||
full:B200/unittest/llmapi/test_llm_models.py -m "not (part0 or part1)" SKIP (Disable for Blackwell OOM)
|
||||
full:B200/unittest/llmapi/test_llm_models.py -m "not (part0 or part1)" SKIP (Disable for Blackwell OOM)
|
||||
full:B200/examples/test_mixtral.py::test_llm_mixtral_moe_plugin_fp8_lora_4gpus[Mixtral-8x7B-v0.1-chinese-mixtral-lora] SKIP (https://nvbugs/5064768)
|
||||
examples/test_qwen.py::test_llm_qwen_moe_multi_gpu_summary[qwen2_57b_a14b-tp4pp1-context_fmha] SKIP (https://nvbugs/5063469)
|
||||
examples/test_qwen.py::test_llm_qwen_moe_multi_gpu_summary[qwen2_57b_a14b-tp2pp2-context_fmha_fp32_acc] SKIP (https://nvbugs/5063469)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user