Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions tests/e2e/megatron/test_quick_start_glm4_9B.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import os

import torch

from tests.ci.ci_register import register_cuda_ci

import miles.utils.external_utils.command_utils as U
Expand All @@ -8,6 +10,7 @@

ENABLE_EVAL = U.get_bool_env_var("MILES_TEST_ENABLE_EVAL", "1")
TIGHT_DEVICE_MEMORY = U.get_bool_env_var("MILES_TEST_TIGHT_DEVICE_MEMORY", "1")
IS_ROCM = hasattr(torch.version, "hip") and torch.version.hip is not None
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with other parts of the codebase (e.g., miles/backends/megatron_utils/model.py line 809, which uses if torch.version.hip:) and for conciseness, you can simplify this check. The torch.version.hip attribute is guaranteed to exist and will be None on non-ROCm builds, so the hasattr check is redundant.

Suggested change
IS_ROCM = hasattr(torch.version, "hip") and torch.version.hip is not None
IS_ROCM = torch.version.hip is not None
References
  1. Maintain consistency with existing patterns in the repository for checking ROCm availability and avoid redundant hasattr checks for attributes guaranteed to exist in the environment. (link)


MODEL_NAME = "GLM-Z1-9B-0414"
MODEL_TYPE = "glm4-9B"
Expand Down Expand Up @@ -103,6 +106,9 @@ def execute():
"--rollout-num-gpus 4 "
)

if IS_ROCM:
misc_args += "--no-gradient-accumulation-fusion "

train_args = (
f"{ckpt_args} "
f"{rollout_args} "
Expand Down