Problem
pre-commit run --all-files fails on current main (01b4ae4). black 24.4.2 (pinned in .pre-commit-config.yaml) reformats two files:
Root cause
All three hunks are expressions wrapped at 88 columns that black collapses to one line under the repo's line-length = 100. The code was most likely formatted with black's default settings instead of the project config.
Impact
Every PR rebased onto main inherits a red linting check, and unit-tests is skipped because it depends on linting. Observed on #234 (run #843).
Reproduce
pre-commit run --show-diff-on-failure --all-files
Full output
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check yaml...............................................................Passed
check for added large files..............................................Passed
black....................................................................Failed
- hook id: black
- files were modified by this hook
reformatted rl_engine/integrations/vllm_runtime.py
reformatted rl_engine/kernels/ops/cuda/attention/flash_attn.py
All done! ✨ 🍰 ✨
2 files reformatted, 320 files left unchanged.
isort....................................................................Passed
flake8...................................................................Passed
pre-commit hook(s) made changes.
If you are seeing this message in CI, reproduce locally with: `pre-commit run --all-files`.
To run `pre-commit` as part of git workflow, use `pre-commit install`.
All changes made by hooks:
diff --git a/rl_engine/integrations/vllm_runtime.py b/rl_engine/integrations/vllm_runtime.py
index ade13ca..6351f0a 100644
--- a/rl_engine/integrations/vllm_runtime.py
+++ b/rl_engine/integrations/vllm_runtime.py
@@ -475,11 +475,7 @@ def _patch_qwen3_strict_model(
)[instance.tp_rank].contiguous()
assert instance.quant_method is not None
- bias_ = (
- None
- if (instance.tp_rank > 0 or instance.skip_bias_add)
- else instance.bias
- )
+ bias_ = None if (instance.tp_rank > 0 or instance.skip_bias_add) else instance.bias
output_parallel = instance.quant_method.apply(instance, input_parallel, bias_)
if instance.reduce_results and instance.tp_size > 1:
diff --git a/rl_engine/kernels/ops/cuda/attention/flash_attn.py b/rl_engine/kernels/ops/cuda/attention/flash_attn.py
index 9ad510b..e57cdeb 100644
--- a/rl_engine/kernels/ops/cuda/attention/flash_attn.py
+++ b/rl_engine/kernels/ops/cuda/attention/flash_attn.py
@@ -130,9 +130,7 @@ class StrictFlashAttention4Core:
tensors, RNG state, or distributed collectives.
"""
if torch.version.hip is not None:
- raise StrictFlashAttentionUnavailable(
- "FA4 CUDA precompile is unavailable on ROCm"
- )
+ raise StrictFlashAttentionUnavailable("FA4 CUDA precompile is unavailable on ROCm")
if not torch.cuda.is_available():
raise StrictFlashAttentionUnavailable(
"FA4 CUDA precompile requires an available CUDA device"
@@ -144,11 +142,7 @@ class StrictFlashAttention4Core:
if head_dim <= 0 or sequence_length <= 0:
raise ValueError("head_dim and sequence_length must be positive")
- target = (
- torch.device("cuda", torch.cuda.current_device())
- if device is None
- else device
- )
+ target = torch.device("cuda", torch.cuda.current_device()) if device is None else device
if target.type != "cuda":
raise ValueError("strict FA4 training precompile requires a CUDA device")
Fix
pre-commit run black --all-files on the two files.
Related: #358 (CI hardening roadmap).
Problem
pre-commit run --all-filesfails on currentmain(01b4ae4). black 24.4.2 (pinned in.pre-commit-config.yaml) reformats two files:rl_engine/integrations/vllm_runtime.py(last changed in 9d5732b, Optimize deterministic rollout tensor-parallel all-reduce #365)rl_engine/kernels/ops/cuda/attention/flash_attn.py(last changed in 0aa1d63)Root cause
All three hunks are expressions wrapped at 88 columns that black collapses to one line under the repo's
line-length = 100. The code was most likely formatted with black's default settings instead of the project config.Impact
Every PR rebased onto
maininherits a redlintingcheck, andunit-testsis skipped because it depends onlinting. Observed on #234 (run #843).Reproduce
Full output
Fix
pre-commit run black --all-fileson the two files.Related: #358 (CI hardening roadmap).