Skip to content

Commit 258c76e

Browse files
authored
Fix run slow v2: empty report when there is only one model (#42002)
fix Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
1 parent 64397a8 commit 258c76e

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

.github/workflows/self-scheduled.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ jobs:
102102
working-directory: /transformers/tests
103103
run: |
104104
if [ "${{ inputs.job }}" = "run_models_gpu" ]; then
105-
echo "folder_slices=$(python3 ../utils/split_model_tests.py --subdirs '${{ inputs.subdirs }}' --num_splits ${{ env.NUM_SLICES }})" >> $GITHUB_OUTPUT
106-
echo "slice_ids=$(python3 -c 'd = list(range(${{ env.NUM_SLICES }})); print(d)')" >> $GITHUB_OUTPUT
105+
python3 ../utils/split_model_tests.py --subdirs '${{ inputs.subdirs }}' --num_splits ${{ env.NUM_SLICES }} > folder_slices.txt
106+
echo "folder_slices=$(cat folder_slices.txt)" >> $GITHUB_OUTPUT
107+
python3 -c "import ast; folder_slices = ast.literal_eval(open('folder_slices.txt').read()); open('slice_ids.txt', 'w').write(str(list(range(len(folder_slices)))))"
108+
echo "slice_ids=$(cat slice_ids.txt)" >> $GITHUB_OUTPUT
107109
elif [ "${{ inputs.job }}" = "run_trainer_and_fsdp_gpu" ]; then
108110
echo "folder_slices=[['trainer'], ['fsdp']]" >> $GITHUB_OUTPUT
109111
echo "slice_ids=[0, 1]" >> $GITHUB_OUTPUT

utils/split_model_tests.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@
8181
for idx in range(args.num_splits):
8282
start = end
8383
end = start + num_jobs_per_splits + (1 if idx < num_jobs % args.num_splits else 0)
84-
model_splits.append(d[start:end])
84+
# Only add the slice if it is not an empty list
85+
if len(d[start:end]) > 0:
86+
model_splits.append(d[start:end])
8587

8688
print(model_splits)

0 commit comments

Comments
 (0)