File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 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 )
You can’t perform that action at this time.
0 commit comments