@@ -3,81 +3,85 @@ name: Doctests
3
3
on :
4
4
push :
5
5
branches :
6
- - doctest *
6
+ - run_doctest *
7
7
repository_dispatch :
8
8
schedule :
9
9
- cron : " 17 2 * * *"
10
10
11
-
12
11
env :
13
- HF_HOME : /mnt/cache
14
- TRANSFORMERS_IS_CI : yes
15
- RUN_SLOW : yes
16
- OMP_NUM_THREADS : 16
17
- MKL_NUM_THREADS : 16
18
- SIGOPT_API_TOKEN : ${{ secrets.SIGOPT_API_TOKEN }}
19
- TF_FORCE_GPU_ALLOW_GROWTH : true
12
+ NUM_SLICES : 3
20
13
21
14
jobs :
22
- run_doctests :
15
+ setup :
16
+ name : Setup
23
17
runs-on : [single-gpu, nvidia-gpu, t4, ci]
24
18
container :
25
19
image : huggingface/transformers-all-latest-gpu
26
20
options : --gpus 0 --shm-size "16gb" --ipc host -v /mnt/cache/.cache/huggingface:/mnt/cache/
21
+ outputs :
22
+ job_splits : ${{ steps.set-matrix.outputs.job_splits }}
23
+ split_keys : ${{ steps.set-matrix.outputs.split_keys }}
27
24
steps :
28
- - name : uninstall transformers (installed during docker image build)
29
- run : python3 -m pip uninstall -y transformers
30
-
31
- - uses : actions/checkout@v3
32
- - name : NVIDIA-SMI
25
+ - name : Update clone
26
+ working-directory : /transformers
33
27
run : |
34
- nvidia-smi
28
+ git fetch && git checkout ${{ github.sha }}
35
29
36
- - name : Install transformers in edit mode
37
- run : python3 -m pip install -e .[flax]
38
-
39
- - name : GPU visibility
40
- run : |
41
- python3 utils/print_env.py
30
+ - name : Reinstall transformers in edit mode (remove the one installed during docker image build)
31
+ working-directory : /transformers
32
+ run : python3 -m pip uninstall -y transformers && python3 -m pip install -e .
42
33
43
34
- name : Show installed libraries and their versions
35
+ working-directory : /transformers
44
36
run : pip freeze
45
37
46
- - name : Get doctest files
38
+ - name : Check values for matrix
39
+ working-directory : /transformers
47
40
run : |
48
- $(python3 -c 'from utils.tests_fetcher import get_all_doctest_files; to_test = get_all_doctest_files(); to_test = " ".join(to_test); fp = open("doc_tests.txt", "w"); fp.write(to_test); fp.close()')
41
+ python3 utils/split_doctest_jobs.py
42
+ python3 utils/split_doctest_jobs.py --only_return_keys --num_splits ${{ env.NUM_SLICES }}
49
43
50
- - name : Run doctests
44
+ - id : set-matrix
45
+ working-directory : /transformers
46
+ name : Set values for matrix
51
47
run : |
52
- python3 -m pytest -v --make-reports doc_tests_gpu --doctest-modules $(cat doc_tests.txt) -sv --doctest-continue-on-failure --doctest-glob="*.md"
53
-
54
- - name : Failure short reports
55
- if : ${{ failure() }}
56
- continue-on-error : true
57
- run : cat reports/doc_tests_gpu/failures_short.txt
58
-
59
- - name : Test suite reports artifacts
60
- if : ${{ always() }}
61
- uses : actions/upload-artifact@v3
62
- with :
63
- name : doc_tests_gpu_test_reports
64
- path : reports/doc_tests_gpu
48
+ echo "job_splits=$(python3 utils/split_doctest_jobs.py)" >> $GITHUB_OUTPUT
49
+ echo "split_keys=$(python3 utils/split_doctest_jobs.py --only_return_keys --num_splits ${{ env.NUM_SLICES }})" >> $GITHUB_OUTPUT
65
50
51
+ call_doctest_job :
52
+ name : " Call doctest jobs"
53
+ needs : setup
54
+ strategy :
55
+ fail-fast : false
56
+ matrix :
57
+ split_keys : ${{ fromJson(needs.setup.outputs.split_keys) }}
58
+ uses : ./.github/workflows/doctest_job.yml
59
+ with :
60
+ job_splits : ${{ needs.setup.outputs.job_splits }}
61
+ split_keys : ${{ toJson(matrix.split_keys) }}
62
+ secrets : inherit
66
63
67
64
send_results :
68
65
name : Send results to webhook
69
66
runs-on : ubuntu-22.04
70
67
if : always()
71
- needs : [run_doctests ]
68
+ needs : [call_doctest_job ]
72
69
steps :
73
70
- uses : actions/checkout@v3
74
71
- uses : actions/download-artifact@v3
75
72
- name : Send message to Slack
76
73
env :
77
74
CI_SLACK_BOT_TOKEN : ${{ secrets.CI_SLACK_BOT_TOKEN }}
78
- CI_SLACK_CHANNEL_ID : ${{ secrets.CI_SLACK_CHANNEL_ID_DAILY_DOCS }}
79
- CI_SLACK_CHANNEL_ID_DAILY : ${{ secrets.CI_SLACK_CHANNEL_ID_DAILY_DOCS }}
80
- CI_SLACK_CHANNEL_DUMMY_TESTS : ${{ secrets.CI_SLACK_CHANNEL_DUMMY_TESTS }}
75
+ ACCESS_REPO_INFO_TOKEN : ${{ secrets.ACCESS_REPO_INFO_TOKEN }}
76
+ # Use `CI_SLACK_CHANNEL_DUMMY_TESTS` when doing experimentation
77
+ SLACK_REPORT_CHANNEL : ${{ secrets.CI_SLACK_CHANNEL_ID_DAILY_DOCS }}
81
78
run : |
82
79
pip install slack_sdk
83
80
python utils/notification_service_doc_tests.py
81
+
82
+ - name : " Upload results"
83
+ if : ${{ always() }}
84
+ uses : actions/upload-artifact@v3
85
+ with :
86
+ name : doc_test_results
87
+ path : doc_test_results
0 commit comments