[INFO] Initializing environment for https://gitcode.com/pre-commit/pre-commit-hooks. [WARNING] repo `https://gitcode.com/pre-commit/pre-commit-hooks` uses deprecated stage names (commit, push) which will be removed in a future version. Hint: often `pre-commit autoupdate --repo https://gitcode.com/pre-commit/pre-commit-hooks` will fix this. if it does not -- consider reporting an issue to that repo. [INFO] Initializing environment for https://gitcode.com/pre-commit-clang/mirrors-clang-format. [INFO] Initializing environment for https://gitcode.com/gh_mirrors/ru/ruff-pre-commit. [INFO] Initializing environment for https://gitcode.com/gh_mirrors/co/codespell. [INFO] Installing environment for https://gitcode.com/pre-commit/pre-commit-hooks. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... [INFO] Installing environment for https://gitcode.com/pre-commit-clang/mirrors-clang-format. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... [INFO] Installing environment for https://gitcode.com/gh_mirrors/ru/ruff-pre-commit. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... [INFO] Installing environment for https://gitcode.com/gh_mirrors/co/codespell. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... trim trailing whitespace.................................................Passed fix end of files.........................................................Passed check yaml...........................................(no files to check)Skipped check for added large files..............................................Passed check for merge conflicts................................................Passed detect private key.......................................................Passed check json...........................................(no files to check)Skipped clang-format.........................................(no files to check)Skipped ruff check...............................................................Passed ruff format..............................................................Failed - hook id: ruff-format - files were modified by this hook 1 file reformatted, 2 files left unchanged codespell................................................................Passed OAT Compliance Check.....................................................Passed - hook id: oat-check - duration: 1.12s [OAT] oat-py not found. Installing oat-py>=1.0.1 ... WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning. [OAT] oat-py installed successfully. [OAT] Running OAT scan (Python Edition) ??INCREMENTAL MODE [OAT] Project: j_K3fAYwnI [OAT] Mode: staged files ??scanning only currently staged files [OAT] Checking 3 staged file(s)... [OAT] Running compliance scan... [OAT] [OK] All checks passed (3 file(s) checked). [OAT] Summary: cat /opt/cloud/agent_1766041207336_7JlDv/workspace/j_K3fAYwnI/oat_reports/result.txt All changes made by hooks: diff --git a/attention/sparse_flash_mla/tests/pytest/sparse_flash_mla_golden.py b/attention/sparse_flash_mla/tests/pytest/sparse_flash_mla_golden.py index 65bc1cd..d5840ef 100644 --- a/attention/sparse_flash_mla/tests/pytest/sparse_flash_mla_golden.py +++ b/attention/sparse_flash_mla/tests/pytest/sparse_flash_mla_golden.py @@ -726,34 +726,38 @@ class GeneralizedSFA: cmp_sparse_indices_bnsd = None if template_idx == 2 or template_idx == 4: - cmp_sparse_indices_bnsd, cmp_sparse_indices_bnsd_shape = self.trans_shape_to_bnsd( - cmp_sparse_indices, - cmp_sparse_indices.shape, - self.layout_q, - cu_seqlens_q, - seqused_q, - ) + cmp_sparse_indices_bnsd, cmp_sparse_indices_bnsd_shape = ( + self.trans_shape_to_bnsd( + cmp_sparse_indices, + cmp_sparse_indices.shape, + self.layout_q, + cu_seqlens_q, + seqused_q, + ) + ) ori_sparse_indices_bnsd = None if template_idx == 3 or template_idx == 4: - ori_sparse_indices_bnsd, ori_sparse_indices_bnsd_shape = self.trans_shape_to_bnsd( - ori_sparse_indices, - ori_sparse_indices.shape, - self.layout_q, - cu_seqlens_q, - seqused_q, - ) + ori_sparse_indices_bnsd, ori_sparse_indices_bnsd_shape = ( + self.trans_shape_to_bnsd( + ori_sparse_indices, + ori_sparse_indices.shape, + self.layout_q, + cu_seqlens_q, + seqused_q, + ) + ) ori_topk_length_bnsd = None if (template_idx == 3 or template_idx == 4) and ori_topk_length is not None: ori_topk_length_bnsd, _ = self.trans_topk_length_shape_to_bnsd( - ori_topk_length, ori_topk_length.shape, self.layout_q, cu_seqlens_q) + ori_topk_length, ori_topk_length.shape, self.layout_q, cu_seqlens_q + ) cmp_topk_length_bnsd = None if (template_idx == 2 or template_idx == 4) and cmp_topk_length is not None: cmp_topk_length_bnsd, _ = self.trans_topk_length_shape_to_bnsd( - cmp_topk_length, cmp_topk_length.shape, self.layout_q, cu_seqlens_q) - - + cmp_topk_length, cmp_topk_length.shape, self.layout_q, cu_seqlens_q + ) attn_out, softmax_lse = self.calculate_by_bnsd( q_bnsd, @@ -1363,9 +1367,7 @@ def resolve_compressed_actual_lengths( if seqused_ori_kv is None or cmp_ratio is None: return seqused_cmp_kv, cmp_residual_kv if cmp_ratio < 1: - raise ValueError( - f"cmp_ratio should be in range [1, 128], but got {cmp_ratio}" - ) + raise ValueError(f"cmp_ratio should be in range [1, 128], but got {cmp_ratio}") if seqused_cmp_kv is None: if torch.is_tensor(seqused_ori_kv): seqused_cmp_kv = seqused_ori_kv // cmp_ratio @@ -1777,13 +1779,13 @@ def gen_data(params, prepare_device_storage=True): if seqused_ori_kv is not None: max_seqlen_ori_kv = seqused_ori_kv.max().item() elif cu_seqlens_ori_kv is not None: - max_seqlen_ori_kv = get_max_adjacent_diff(cu_seqlens_ori_kv) + max_seqlen_ori_kv = get_max_adjacent_diff(cu_seqlens_ori_kv) max_seqlen_cmp_kv = 0 if seqused_cmp_kv is not None: max_seqlen_cmp_kv = seqused_cmp_kv.max().item() elif cu_seqlens_cmp_kv is not None: - max_seqlen_cmp_kv = get_max_adjacent_diff(cu_seqlens_cmp_kv) + max_seqlen_cmp_kv = get_max_adjacent_diff(cu_seqlens_cmp_kv) # ORI_SPARSE/ORI_CMP_SPARSE: seqused (actualLength) not passed to op, determined by sparse_indices and topkLength # cu_seqlens still passed for TND kv layout (needed for data addressing in kernel) =================================== OAT Scan Result Summary =================================== Scan Time: 2026-08-07 17:39:05 Project: j_K3fAYwnI Files Checked: 3 ----------------------------------- Invalid File Type Total Count: 0 ----------------------------------- License Header Invalid Total Count: 0 ===================================