Skip to content

Commit 4f6ffe0

Browse files
author
ChenGary13
committed
feat:fix clean check
1 parent e162d40 commit 4f6ffe0

File tree

3 files changed

+24
-26
lines changed

3 files changed

+24
-26
lines changed

tests/special_npu/run_qwen2_5_05b_grpo.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ SAVE_PATH=tests/utils/ci/profiler_data
77
rm -rf "$SAVE_PATH"
88

99
LEVEL="level0"
10-
CONTENTS="['npu','cpu']"
10+
CONTENTS=['npu','cpu']
1111
ANALYSIS=False
12-
PROFILE_STEPS="[1]"
12+
PROFILE_STEPS=[1]
1313
PROFILE_RANKS_ALL=False
14-
PROFILE_RANKS="[0]"
14+
PROFILE_RANKS=[0]
1515
DISCRETE=True
1616

1717
python3 -m verl.trainer.main_ppo \
@@ -75,5 +75,4 @@ python3 -m verl.trainer.main_ppo \
7575
global_profiler.save_path="$SAVE_PATH" $@
7676

7777
python3 "tests/utils/test_check_and_profiler_output.py" --profiler-dir="$SAVE_PATH"
78-
79-
78+
rm -rf "$SAVE_PATH"

tests/utils/test_check_and_clean_profiler_output.py renamed to tests/utils/test_check_profiler_output.py

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1+
# Copyright 2026 Bytedance Ltd. and/or its affiliates
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
import argparse
216
import glob
317
import logging
418
import os
5-
import shutil
619
import sys
720

821
logger = logging.getLogger(__file__)
@@ -49,17 +62,6 @@ def check_profiler_output(profiler_dir: str) -> bool:
4962
return True
5063

5164

52-
def clean_profiler_output(profiler_dir: str):
53-
"""Clean up profiler deliverables"""
54-
logger.info("Starting cleanup...")
55-
if os.path.exists(profiler_dir):
56-
try:
57-
shutil.rmtree(profiler_dir)
58-
logger.info(f"Successfully deleted directory: {profiler_dir}")
59-
except Exception as e:
60-
logger.error(f"Failed to delete directory: {e}")
61-
62-
6365
def parse_args():
6466
"""Parse command line arguments"""
6567
parser = argparse.ArgumentParser(description="Check and clean Profiler deliverables")
@@ -70,13 +72,10 @@ def parse_args():
7072
def main():
7173
args = parse_args()
7274

73-
try:
74-
if check_profiler_output(args.profiler_dir):
75-
sys.exit(0)
76-
else:
77-
sys.exit(1)
78-
finally:
79-
clean_profiler_output(args.profiler_dir)
75+
if check_profiler_output(args.profiler_dir):
76+
sys.exit(0)
77+
else:
78+
sys.exit(1)
8079

8180

8281
if __name__ == "__main__":

verl/models/mcore/model_forward.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def gptmodel_forward_no_padding(
198198
}
199199
model_kwargs["labels"] = args["label"].contiguous()
200200
model_kwargs["loss_mask"] = args["loss_mask"].contiguous()
201-
if logits_processor_args and 'loss_mask' in logits_processor_args:
201+
if logits_processor_args and "loss_mask" in logits_processor_args:
202202
logits_processor_args.pop("loss_mask")
203203

204204
# For VLM model, need to pass bshd format `input_ids` and `attention_mask`.
@@ -252,7 +252,7 @@ def gptmodel_forward_no_padding(
252252
}
253253
model_kwargs["labels"] = args["label"].contiguous()
254254
model_kwargs["loss_mask"] = args["loss_mask"].contiguous()
255-
if logits_processor_args and 'loss_mask' in logits_processor_args:
255+
if logits_processor_args and "loss_mask" in logits_processor_args:
256256
logits_processor_args.pop("loss_mask")
257257

258258
output_orig = model(

0 commit comments

Comments
 (0)