Skip to content

Commit

Permalink
Update fork-maintenance.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Cemberk authored Nov 13, 2024
1 parent 0cc3a33 commit 3bafeef
Showing 1 changed file with 42 additions and 11 deletions.
53 changes: 42 additions & 11 deletions .github/workflows/fork-maintenance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,48 @@ jobs:
pip install -e .
#unit_test_command: cd tests; folders=$$(python3 -c 'import os; tests = os.getcwd(); models = "models"; model_tests = os.listdir(os.path.join(tests, models)); d1 = sorted(list(filter(os.path.isdir, os.listdir(tests)))); d2 = sorted(list(filter(os.path.isdir, [os.path.join(models, x) for x in model_tests]))); d1.remove(models); d = d2 + d1; print(" ".join(d[:5]))'); cd ..; for folder in \${folders[@]}; do pytest tests/\${folder} -v --make-reports=huggingface_unit_tests_\${machine_type}_run_models_gpu_\${folder} -rfEs --continue-on-collection-errors -m \"not not_device_test\" -p no:cacheprovider; done; allstats=\$(find reports -name stats.txt); for stat in \${allstats[@]}; do echo \$stat; cat \$stat; done
unit_test_command: |
echo "Running unit tests inside Docker...";
cd tests;
folders=$$(python3 -c 'import os; tests = os.getcwd(); models = "models"; model_tests = os.listdir(os.path.join(tests, models)); d1 = sorted(list(filter(os.path.isdir, os.listdir(tests)))); d2 = sorted(list(filter(os.path.isdir, [os.path.join(models, x) for x in model_tests]))); d1.remove(models); d = d2 + d1; print(" ".join(d[:5]))');
cd ..;
for folder in $${folders[@]}; do
pytest tests/$$folder -v --make-reports=huggingface_unit_tests_$${machine_type}_run_models_gpu_$$folder -rfEs --continue-on-collection-errors -m "not not_device_test" -p no:cacheprovider;
done;
allstats=$$(find reports -name stats.txt);
for stat in $${allstats[@]}; do
echo $$stat;
cat $$stat;
set -x # Enable shell debugging
echo "Running unit tests inside Docker..."
cd tests
# Write Python code to a temporary script
cat << 'EOF' > get_folders.py
import os
tests = os.getcwd()
models = "models"
model_tests = os.listdir(os.path.join(tests, models))
d1 = sorted(list(filter(os.path.isdir, os.listdir(tests))))
d2 = sorted(list(filter(os.path.isdir, [os.path.join(models, x) for x in model_tests])))
d1.remove(models)
d = d2 + d1
print(" ".join(d[:5]))
EOF
# Execute the Python script and capture the output
folders=$$(python3 get_folders.py)
echo "Folders obtained: $$folders"
cd ..
# Convert folders string into an array
IFS=' ' read -r -a folder_array <<< "$$folders"
# Iterate over each folder and run pytest
for folder in "$${folder_array[@]}"; do
echo "Running pytest on folder: $$folder"
pytest tests/$$folder -v \
--make-reports=huggingface_unit_tests_$${machine_type}_run_models_gpu_$$folder \
-rfEs --continue-on-collection-errors \
-m "not not_device_test" -p no:cacheprovider
done
# Find and display stats
allstats=$$(find reports -name stats.txt)
for stat in $$allstats; do
echo "Stat file: $$stat"
cat "$$stat"
done
performance_test_command: 'echo \"python examples/pytorch/language-modeling/run_mlm.py --model_name_or_path bert-base-uncased --dataset_name wikitext --dataset_config_name wikitext-2-raw-v1 --do_train --do_eval --output_dir /tmp/test-mlm --per_device_train_batch_size 8 --per_device_eval_batch_size 8 --max_steps 500\"'
docker_image: 'rocm/pytorch:latest'
Expand Down

0 comments on commit 3bafeef

Please sign in to comment.