Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .github/workflows/main.yaml +28 -0
- .gitignore +160 -0
- DT.pickle +3 -0
- Dockerfile +12 -0
- GaussianNB.pickle +3 -0
- IRIS FLOWER CLASSIFICATION using machine learning models.ipynb +0 -0
- IRIS-FLOWER-CLASSIFICATION-using-machine-learning-models/.gitattributes +35 -0
- IRIS-FLOWER-CLASSIFICATION-using-machine-learning-models/README.md +11 -0
- LICENSE +201 -0
- Logistic.pickle +3 -0
- README.md +110 -0
- SVM.pickle +3 -0
- app.py +40 -0
- knn.pickle +3 -0
- mytree.dot +37 -0
- requirements.txt +8 -0
- rf.pickle +3 -0
- templates/home.html +86 -0
- transformers/.circleci/TROUBLESHOOT.md +7 -0
- transformers/.circleci/config.yml +232 -0
- transformers/.circleci/create_circleci_config.py +678 -0
- transformers/.coveragerc +12 -0
- transformers/.gitattributes +4 -0
- transformers/.github/ISSUE_TEMPLATE/bug-report.yml +116 -0
- transformers/.github/ISSUE_TEMPLATE/config.yml +12 -0
- transformers/.github/ISSUE_TEMPLATE/feature-request.yml +31 -0
- transformers/.github/ISSUE_TEMPLATE/i18n.md +46 -0
- transformers/.github/ISSUE_TEMPLATE/migration.yml +72 -0
- transformers/.github/ISSUE_TEMPLATE/new-model-addition.yml +31 -0
- transformers/.github/PULL_REQUEST_TEMPLATE.md +78 -0
- transformers/.github/conda/build.sh +1 -0
- transformers/.github/conda/meta.yaml +56 -0
- transformers/.github/workflows/TROUBLESHOOT.md +9 -0
- transformers/.github/workflows/add-model-like.yml +80 -0
- transformers/.github/workflows/build-docker-images.yml +333 -0
- transformers/.github/workflows/build-nightly-ci-docker-images.yml +85 -0
- transformers/.github/workflows/build-past-ci-docker-images.yml +99 -0
- transformers/.github/workflows/build_documentation.yml +22 -0
- transformers/.github/workflows/build_pr_documentation.yml +18 -0
- transformers/.github/workflows/check_tiny_models.yml +82 -0
- transformers/.github/workflows/doctests.yml +83 -0
- transformers/.github/workflows/model-templates.yml +81 -0
- transformers/.github/workflows/model_jobs.yml +102 -0
- transformers/.github/workflows/release-conda.yml +47 -0
- transformers/.github/workflows/self-nightly-past-ci-caller.yml +134 -0
- transformers/.github/workflows/self-nightly-scheduled.yml +290 -0
- transformers/.github/workflows/self-past.yml +357 -0
- transformers/.github/workflows/self-push-amd-mi210-caller.yml +25 -0
- transformers/.github/workflows/self-push-amd-mi250-caller.yml +25 -0
- transformers/.github/workflows/self-push-amd.yml +329 -0
.github/workflows/main.yaml
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Deploy to Hugging Face Spaces
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches: [main]
|
| 6 |
+
|
| 7 |
+
jobs:
|
| 8 |
+
deploy:
|
| 9 |
+
runs-on: ubuntu-latest
|
| 10 |
+
steps:
|
| 11 |
+
- name: Checkout Repository
|
| 12 |
+
uses: actions/checkout@v2
|
| 13 |
+
|
| 14 |
+
- name: Login to Hugging Face
|
| 15 |
+
uses: Hugging Face/action-hub-docker-login@v1
|
| 16 |
+
with:
|
| 17 |
+
email: ${{ secrets.HUGGINGFACE_EMAIL }}
|
| 18 |
+
hf-api-token: ${{ secrets.HUGGINGFACE_TOKEN }}
|
| 19 |
+
hf_app_name: ${{ secrets.HEROKU_APP_NAME }}
|
| 20 |
+
|
| 21 |
+
- name: Build, Push and Release to Hugging Face Spaces
|
| 22 |
+
uses: Hugging Face/action-hub-push@v1
|
| 23 |
+
with:
|
| 24 |
+
email: ${{ secrets.HUGGINGFACE_EMAIL }}
|
| 25 |
+
hf-api-token: ${{ secrets.HUGGINGFACE_TOKEN }}
|
| 26 |
+
hf_app_name: ${{ secrets.HEROKU_APP_NAME }}
|
| 27 |
+
dockerfile: Dockerfile
|
| 28 |
+
context: ./
|
.gitignore
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Byte-compiled / optimized / DLL files
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.py[cod]
|
| 4 |
+
*$py.class
|
| 5 |
+
|
| 6 |
+
# C extensions
|
| 7 |
+
*.so
|
| 8 |
+
|
| 9 |
+
# Distribution / packaging
|
| 10 |
+
.Python
|
| 11 |
+
build/
|
| 12 |
+
develop-eggs/
|
| 13 |
+
dist/
|
| 14 |
+
downloads/
|
| 15 |
+
eggs/
|
| 16 |
+
.eggs/
|
| 17 |
+
lib/
|
| 18 |
+
lib64/
|
| 19 |
+
parts/
|
| 20 |
+
sdist/
|
| 21 |
+
var/
|
| 22 |
+
wheels/
|
| 23 |
+
share/python-wheels/
|
| 24 |
+
*.egg-info/
|
| 25 |
+
.installed.cfg
|
| 26 |
+
*.egg
|
| 27 |
+
MANIFEST
|
| 28 |
+
|
| 29 |
+
# PyInstaller
|
| 30 |
+
# Usually these files are written by a python script from a template
|
| 31 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
| 32 |
+
*.manifest
|
| 33 |
+
*.spec
|
| 34 |
+
|
| 35 |
+
# Installer logs
|
| 36 |
+
pip-log.txt
|
| 37 |
+
pip-delete-this-directory.txt
|
| 38 |
+
|
| 39 |
+
# Unit test / coverage reports
|
| 40 |
+
htmlcov/
|
| 41 |
+
.tox/
|
| 42 |
+
.nox/
|
| 43 |
+
.coverage
|
| 44 |
+
.coverage.*
|
| 45 |
+
.cache
|
| 46 |
+
nosetests.xml
|
| 47 |
+
coverage.xml
|
| 48 |
+
*.cover
|
| 49 |
+
*.py,cover
|
| 50 |
+
.hypothesis/
|
| 51 |
+
.pytest_cache/
|
| 52 |
+
cover/
|
| 53 |
+
|
| 54 |
+
# Translations
|
| 55 |
+
*.mo
|
| 56 |
+
*.pot
|
| 57 |
+
|
| 58 |
+
# Django stuff:
|
| 59 |
+
*.log
|
| 60 |
+
local_settings.py
|
| 61 |
+
db.sqlite3
|
| 62 |
+
db.sqlite3-journal
|
| 63 |
+
|
| 64 |
+
# Flask stuff:
|
| 65 |
+
instance/
|
| 66 |
+
.webassets-cache
|
| 67 |
+
|
| 68 |
+
# Scrapy stuff:
|
| 69 |
+
.scrapy
|
| 70 |
+
|
| 71 |
+
# Sphinx documentation
|
| 72 |
+
docs/_build/
|
| 73 |
+
|
| 74 |
+
# PyBuilder
|
| 75 |
+
.pybuilder/
|
| 76 |
+
target/
|
| 77 |
+
|
| 78 |
+
# Jupyter Notebook
|
| 79 |
+
.ipynb_checkpoints
|
| 80 |
+
|
| 81 |
+
# IPython
|
| 82 |
+
profile_default/
|
| 83 |
+
ipython_config.py
|
| 84 |
+
|
| 85 |
+
# pyenv
|
| 86 |
+
# For a library or package, you might want to ignore these files since the code is
|
| 87 |
+
# intended to run in multiple environments; otherwise, check them in:
|
| 88 |
+
# .python-version
|
| 89 |
+
|
| 90 |
+
# pipenv
|
| 91 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
| 92 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
| 93 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
| 94 |
+
# install all needed dependencies.
|
| 95 |
+
#Pipfile.lock
|
| 96 |
+
|
| 97 |
+
# poetry
|
| 98 |
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
| 99 |
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
| 100 |
+
# commonly ignored for libraries.
|
| 101 |
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
| 102 |
+
#poetry.lock
|
| 103 |
+
|
| 104 |
+
# pdm
|
| 105 |
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
| 106 |
+
#pdm.lock
|
| 107 |
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
| 108 |
+
# in version control.
|
| 109 |
+
# https://pdm.fming.dev/#use-with-ide
|
| 110 |
+
.pdm.toml
|
| 111 |
+
|
| 112 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
| 113 |
+
__pypackages__/
|
| 114 |
+
|
| 115 |
+
# Celery stuff
|
| 116 |
+
celerybeat-schedule
|
| 117 |
+
celerybeat.pid
|
| 118 |
+
|
| 119 |
+
# SageMath parsed files
|
| 120 |
+
*.sage.py
|
| 121 |
+
|
| 122 |
+
# Environments
|
| 123 |
+
.env
|
| 124 |
+
.venv
|
| 125 |
+
env/
|
| 126 |
+
venv/
|
| 127 |
+
ENV/
|
| 128 |
+
env.bak/
|
| 129 |
+
venv.bak/
|
| 130 |
+
|
| 131 |
+
# Spyder project settings
|
| 132 |
+
.spyderproject
|
| 133 |
+
.spyproject
|
| 134 |
+
|
| 135 |
+
# Rope project settings
|
| 136 |
+
.ropeproject
|
| 137 |
+
|
| 138 |
+
# mkdocs documentation
|
| 139 |
+
/site
|
| 140 |
+
|
| 141 |
+
# mypy
|
| 142 |
+
.mypy_cache/
|
| 143 |
+
.dmypy.json
|
| 144 |
+
dmypy.json
|
| 145 |
+
|
| 146 |
+
# Pyre type checker
|
| 147 |
+
.pyre/
|
| 148 |
+
|
| 149 |
+
# pytype static type analyzer
|
| 150 |
+
.pytype/
|
| 151 |
+
|
| 152 |
+
# Cython debug symbols
|
| 153 |
+
cython_debug/
|
| 154 |
+
|
| 155 |
+
# PyCharm
|
| 156 |
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
| 157 |
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
| 158 |
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
| 159 |
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
| 160 |
+
#.idea/
|
DT.pickle
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:15524acb9fb06bccbdbae58f92b63a9074bca93030c1471d953bfef11684f11e
|
| 3 |
+
size 4135
|
Dockerfile
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use Python 3.10.14 as the base image
|
| 2 |
+
FROM python:3.10.14
|
| 3 |
+
|
| 4 |
+
WORKDIR /code
|
| 5 |
+
|
| 6 |
+
COPY ./requirements.txt /code/requirements.txt
|
| 7 |
+
|
| 8 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 9 |
+
|
| 10 |
+
COPY . .
|
| 11 |
+
|
| 12 |
+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
GaussianNB.pickle
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:15524acb9fb06bccbdbae58f92b63a9074bca93030c1471d953bfef11684f11e
|
| 3 |
+
size 4135
|
IRIS FLOWER CLASSIFICATION using machine learning models.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
IRIS-FLOWER-CLASSIFICATION-using-machine-learning-models/.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
IRIS-FLOWER-CLASSIFICATION-using-machine-learning-models/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: IRIS FLOWER CLASSIFICATION Using Machine Learning Models
|
| 3 |
+
emoji: 🏃
|
| 4 |
+
colorFrom: yellow
|
| 5 |
+
colorTo: indigo
|
| 6 |
+
sdk: docker
|
| 7 |
+
pinned: false
|
| 8 |
+
license: apache-2.0
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(an example is provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 90 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You
|
| 92 |
+
meet the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or
|
| 95 |
+
Derivative Works a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 101 |
+
that You distribute, all copyright, patent, trademark, and
|
| 102 |
+
attribution notices from the Source form of the Work,
|
| 103 |
+
excluding those notices that do not pertain to any part of
|
| 104 |
+
the Derivative Works; and
|
| 105 |
+
|
| 106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 107 |
+
distribution, then any Derivative Works that You distribute must
|
| 108 |
+
include a readable copy of the attribution notices contained
|
| 109 |
+
within such NOTICE file, excluding those notices that do not
|
| 110 |
+
pertain to any part of the Derivative Works, in at least one
|
| 111 |
+
of the following places: within a NOTICE text file distributed
|
| 112 |
+
as part of the Derivative Works; within the Source form or
|
| 113 |
+
documentation, if provided along with the Derivative Works; or,
|
| 114 |
+
within a display generated by the Derivative Works, if and
|
| 115 |
+
wherever such third-party notices normally appear. The contents
|
| 116 |
+
of the NOTICE file are for informational purposes only and
|
| 117 |
+
do not modify the License. You may add Your own attribution
|
| 118 |
+
notices within Derivative Works that You distribute, alongside
|
| 119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 120 |
+
that such additional attribution notices cannot be construed
|
| 121 |
+
as modifying the License.
|
| 122 |
+
|
| 123 |
+
You may add Your own copyright statement to Your modifications and
|
| 124 |
+
may provide additional or different license terms and conditions
|
| 125 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 126 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 127 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 128 |
+
the conditions stated in this License.
|
| 129 |
+
|
| 130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 132 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 133 |
+
this License, without any additional terms or conditions.
|
| 134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 135 |
+
the terms of any separate license agreement you may have executed
|
| 136 |
+
with Licensor regarding such Contributions.
|
| 137 |
+
|
| 138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 140 |
+
except as required for reasonable and customary use in describing the
|
| 141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 142 |
+
|
| 143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 144 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 147 |
+
implied, including, without limitation, any warranties or conditions
|
| 148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 150 |
+
appropriateness of using or redistributing the Work and assume any
|
| 151 |
+
risks associated with Your exercise of permissions under this License.
|
| 152 |
+
|
| 153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 154 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 155 |
+
unless required by applicable law (such as deliberate and grossly
|
| 156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 157 |
+
liable to You for damages, including any direct, indirect, special,
|
| 158 |
+
incidental, or consequential damages of any character arising as a
|
| 159 |
+
result of this License or out of the use or inability to use the
|
| 160 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 161 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 162 |
+
other commercial damages or losses), even if such Contributor
|
| 163 |
+
has been advised of the possibility of such damages.
|
| 164 |
+
|
| 165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 168 |
+
or other liability obligations and/or rights consistent with this
|
| 169 |
+
License. However, in accepting such obligations, You may act only
|
| 170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 171 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 172 |
+
defend, and hold each Contributor harmless for any liability
|
| 173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 174 |
+
of your accepting any such warranty or additional liability.
|
| 175 |
+
|
| 176 |
+
END OF TERMS AND CONDITIONS
|
| 177 |
+
|
| 178 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 179 |
+
|
| 180 |
+
To apply the Apache License to your work, attach the following
|
| 181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 182 |
+
replaced with your own identifying information. (Don't include
|
| 183 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 184 |
+
comment syntax for the file format. We also recommend that a
|
| 185 |
+
file or class name and description of purpose be included on the
|
| 186 |
+
same "printed page" as the copyright notice for easier
|
| 187 |
+
identification within third-party archives.
|
| 188 |
+
|
| 189 |
+
Copyright [yyyy] [name of copyright owner]
|
| 190 |
+
|
| 191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 192 |
+
you may not use this file except in compliance with the License.
|
| 193 |
+
You may obtain a copy of the License at
|
| 194 |
+
|
| 195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 196 |
+
|
| 197 |
+
Unless required by applicable law or agreed to in writing, software
|
| 198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 200 |
+
See the License for the specific language governing permissions and
|
| 201 |
+
limitations under the License.
|
Logistic.pickle
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:15524acb9fb06bccbdbae58f92b63a9074bca93030c1471d953bfef11684f11e
|
| 3 |
+
size 4135
|
README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# IRIS-FLOWER-CLASSIFICATION-using-machine-learning-models
|
| 2 |
+
# Software And Tools Requirements
|
| 3 |
+
1. [Github Account](https://github.com)
|
| 4 |
+
2. [HerokuAccount](https://www.heroku.com/)
|
| 5 |
+
3. [VSCodeIDE](https://code.visualstudio.com/)
|
| 6 |
+
4. [GitCLI](https://git-scm.com/book/en/v2/Getting-Started-The-Command-Line)
|
| 7 |
+
|
| 8 |
+
Create a new environment
|
| 9 |
+
|
| 10 |
+
```
|
| 11 |
+
conda create -p venv python==3.10.14 -y
|
| 12 |
+
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
Activating Environment
|
| 16 |
+
|
| 17 |
+
```
|
| 18 |
+
conda activate venv/
|
| 19 |
+
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
Install Requirements
|
| 23 |
+
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
pip install -r requirements.txt
|
| 27 |
+
|
| 28 |
+
```
|
| 29 |
+
Docker image run steps
|
| 30 |
+
|
| 31 |
+
```
|
| 32 |
+
docker build -t flask .
|
| 33 |
+
docker run -it -p 7860:7860 flask
|
| 34 |
+
|
| 35 |
+
docker ps
|
| 36 |
+
|
| 37 |
+
```
|
| 38 |
+
Hugging face deployment steps
|
| 39 |
+
https://huggingface.co/docs/transformers/model_doc/pegasus
|
| 40 |
+
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
pip install transformers
|
| 44 |
+
|
| 45 |
+
pip install torch
|
| 46 |
+
import torch
|
| 47 |
+
git clone https://github.com/huggingface/transformers.git
|
| 48 |
+
huggingface-cli login
|
| 49 |
+
|
| 50 |
+
```
|
| 51 |
+
Configure user name
|
| 52 |
+
|
| 53 |
+
```
|
| 54 |
+
git config --global user.name "Gnaneshwari"
|
| 55 |
+
git config --global user.name
|
| 56 |
+
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
Configure user email
|
| 60 |
+
|
| 61 |
+
```
|
| 62 |
+
git config --global user.email "gnaneshwari.m2009@gmail.com"
|
| 63 |
+
git config --global user.email
|
| 64 |
+
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
Adding Files to github
|
| 68 |
+
|
| 69 |
+
```
|
| 70 |
+
git init
|
| 71 |
+
|
| 72 |
+
git add requirements.txt
|
| 73 |
+
git add .
|
| 74 |
+
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
Checking the Status of git push
|
| 78 |
+
|
| 79 |
+
```
|
| 80 |
+
git status
|
| 81 |
+
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
Commit files to git
|
| 85 |
+
|
| 86 |
+
```
|
| 87 |
+
git commit -m "This commit includes requirements.txt and readme files"
|
| 88 |
+
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
Config email for first time
|
| 92 |
+
|
| 93 |
+
```
|
| 94 |
+
git config --global user.email "gnaneshwari.m2009@gmail.com"
|
| 95 |
+
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
Pushing files in git
|
| 99 |
+
|
| 100 |
+
```
|
| 101 |
+
git push origin main
|
| 102 |
+
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
To Validate Json
|
| 106 |
+
|
| 107 |
+
```
|
| 108 |
+
https://jsonlint.com/
|
| 109 |
+
|
| 110 |
+
```
|
SVM.pickle
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:15524acb9fb06bccbdbae58f92b63a9074bca93030c1471d953bfef11684f11e
|
| 3 |
+
size 4135
|
app.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# from transformers import PegasusForConditionalGeneration, PegasusTokenizer
|
| 2 |
+
import json
|
| 3 |
+
import pickle
|
| 4 |
+
import torch
|
| 5 |
+
|
| 6 |
+
from flask import Flask, request, jsonify, render_template
|
| 7 |
+
import numpy as np
|
| 8 |
+
|
| 9 |
+
app = Flask(__name__)
|
| 10 |
+
# model_name = "google/pegasus-xsum"
|
| 11 |
+
# Load the model
|
| 12 |
+
with open('rf.pickle', 'rb') as f:
|
| 13 |
+
rf = pickle.load(f)
|
| 14 |
+
|
| 15 |
+
@app.route('/')
|
| 16 |
+
def home():
|
| 17 |
+
return render_template('home.html')
|
| 18 |
+
|
| 19 |
+
@app.route('/predict_api', methods=['POST'])
|
| 20 |
+
def predict_api():
|
| 21 |
+
try:
|
| 22 |
+
data = request.json['data']
|
| 23 |
+
new_data = np.array(list(data.values())).reshape(1, -1)
|
| 24 |
+
output = rf.predict(new_data)[0]
|
| 25 |
+
return jsonify({'prediction': str(output)})
|
| 26 |
+
except Exception as e:
|
| 27 |
+
return jsonify({'error': str(e)})
|
| 28 |
+
|
| 29 |
+
@app.route('/predict', methods=['POST'])
|
| 30 |
+
def predict():
|
| 31 |
+
try:
|
| 32 |
+
data = [float(x) for x in request.form.values()]
|
| 33 |
+
final_input = np.array(data).reshape(1, -1)
|
| 34 |
+
output = rf.predict(final_input)[0]
|
| 35 |
+
return render_template("home.html", prediction_text="IRIS-FLOWER-CLASSIFICATION prediction is {}".format(output))
|
| 36 |
+
except Exception as e:
|
| 37 |
+
return render_template("home.html", prediction_text="Error: {}".format(str(e)))
|
| 38 |
+
|
| 39 |
+
if __name__ == "__main__":
|
| 40 |
+
app.run(host="0.0.0.0",port=int("7860"),debug=True)
|
knn.pickle
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:15524acb9fb06bccbdbae58f92b63a9074bca93030c1471d953bfef11684f11e
|
| 3 |
+
size 4135
|
mytree.dot
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
digraph Tree {
|
| 2 |
+
node [shape=box, fontname="helvetica"] ;
|
| 3 |
+
edge [fontname="helvetica"] ;
|
| 4 |
+
0 [label="x[2] <= 2.45\ngini = 0.666\nsamples = 120\nvalue = [42, 39, 39]"] ;
|
| 5 |
+
1 [label="gini = 0.0\nsamples = 42\nvalue = [42, 0, 0]"] ;
|
| 6 |
+
0 -> 1 [labeldistance=2.5, labelangle=45, headlabel="True"] ;
|
| 7 |
+
2 [label="x[3] <= 1.75\ngini = 0.5\nsamples = 78\nvalue = [0, 39, 39]"] ;
|
| 8 |
+
0 -> 2 [labeldistance=2.5, labelangle=-45, headlabel="False"] ;
|
| 9 |
+
3 [label="x[2] <= 4.95\ngini = 0.206\nsamples = 43\nvalue = [0, 38, 5]"] ;
|
| 10 |
+
2 -> 3 ;
|
| 11 |
+
4 [label="x[3] <= 1.65\ngini = 0.053\nsamples = 37\nvalue = [0, 36, 1]"] ;
|
| 12 |
+
3 -> 4 ;
|
| 13 |
+
5 [label="gini = 0.0\nsamples = 36\nvalue = [0, 36, 0]"] ;
|
| 14 |
+
4 -> 5 ;
|
| 15 |
+
6 [label="gini = 0.0\nsamples = 1\nvalue = [0, 0, 1]"] ;
|
| 16 |
+
4 -> 6 ;
|
| 17 |
+
7 [label="x[3] <= 1.55\ngini = 0.444\nsamples = 6\nvalue = [0, 2, 4]"] ;
|
| 18 |
+
3 -> 7 ;
|
| 19 |
+
8 [label="gini = 0.0\nsamples = 3\nvalue = [0, 0, 3]"] ;
|
| 20 |
+
7 -> 8 ;
|
| 21 |
+
9 [label="x[2] <= 5.45\ngini = 0.444\nsamples = 3\nvalue = [0, 2, 1]"] ;
|
| 22 |
+
7 -> 9 ;
|
| 23 |
+
10 [label="gini = 0.0\nsamples = 2\nvalue = [0, 2, 0]"] ;
|
| 24 |
+
9 -> 10 ;
|
| 25 |
+
11 [label="gini = 0.0\nsamples = 1\nvalue = [0, 0, 1]"] ;
|
| 26 |
+
9 -> 11 ;
|
| 27 |
+
12 [label="x[2] <= 4.85\ngini = 0.056\nsamples = 35\nvalue = [0, 1, 34]"] ;
|
| 28 |
+
2 -> 12 ;
|
| 29 |
+
13 [label="x[1] <= 3.1\ngini = 0.444\nsamples = 3\nvalue = [0, 1, 2]"] ;
|
| 30 |
+
12 -> 13 ;
|
| 31 |
+
14 [label="gini = 0.0\nsamples = 2\nvalue = [0, 0, 2]"] ;
|
| 32 |
+
13 -> 14 ;
|
| 33 |
+
15 [label="gini = 0.0\nsamples = 1\nvalue = [0, 1, 0]"] ;
|
| 34 |
+
13 -> 15 ;
|
| 35 |
+
16 [label="gini = 0.0\nsamples = 32\nvalue = [0, 0, 32]"] ;
|
| 36 |
+
12 -> 16 ;
|
| 37 |
+
}
|
requirements.txt
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Flask
|
| 2 |
+
scikit-learn
|
| 3 |
+
pandas
|
| 4 |
+
numpy
|
| 5 |
+
matplotlib
|
| 6 |
+
gunicorn
|
| 7 |
+
seaborn
|
| 8 |
+
gunicorn
|
rf.pickle
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ea33980970b45438f77f58b00c7a78e290014ea3c49b7c9a483db29ad91b1e16
|
| 3 |
+
size 163284
|
templates/home.html
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html>
|
| 3 |
+
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="UTF-8">
|
| 6 |
+
<title>IRIS-FLOWER-CLASSIFICATION Prediction</title>
|
| 7 |
+
<link href='https://fonts.googleapis.com/css?family=Pacifico' rel='stylesheet' type='text/css'>
|
| 8 |
+
<link href='https://fonts.googleapis.com/css?family=Arimo' rel='stylesheet' type='text/css'>
|
| 9 |
+
<link href='https://fonts.googleapis.com/css?family=Hind:300' rel='stylesheet' type='text/css'>
|
| 10 |
+
<link href='https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300' rel='stylesheet' type='text/css'>
|
| 11 |
+
<style>
|
| 12 |
+
body {
|
| 13 |
+
font-family: 'Arimo', sans-serif;
|
| 14 |
+
background-color: #f4f4f4;
|
| 15 |
+
margin: 0;
|
| 16 |
+
padding: 0;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
.container {
|
| 20 |
+
max-width: 600px;
|
| 21 |
+
margin: 50px auto;
|
| 22 |
+
padding: 20px;
|
| 23 |
+
background-color: #fff;
|
| 24 |
+
border-radius: 5px;
|
| 25 |
+
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
h1 {
|
| 29 |
+
font-family: 'Montserrat', cursive;
|
| 30 |
+
font-size: 36px;
|
| 31 |
+
margin-bottom: 20px;
|
| 32 |
+
text-align: center;
|
| 33 |
+
color: #333;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
form {
|
| 37 |
+
text-align: center;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
input[type="text"] {
|
| 41 |
+
width: 100%;
|
| 42 |
+
padding: 10px;
|
| 43 |
+
margin-bottom: 20px;
|
| 44 |
+
border-radius: 5px;
|
| 45 |
+
border: 1px solid #ccc;
|
| 46 |
+
box-sizing: border-box;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
button[type="submit"] {
|
| 50 |
+
width: 100%;
|
| 51 |
+
background-color: #4CAF50;
|
| 52 |
+
color: white;
|
| 53 |
+
padding: 10px 20px;
|
| 54 |
+
border: none;
|
| 55 |
+
border-radius: 5px;
|
| 56 |
+
cursor: pointer;
|
| 57 |
+
font-size: 16px;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
button[type="submit"]:hover {
|
| 61 |
+
background-color: #45a049;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
.error-message {
|
| 65 |
+
color: blue;
|
| 66 |
+
font-size: 14px;
|
| 67 |
+
margin-top: 10px;
|
| 68 |
+
}
|
| 69 |
+
</style>
|
| 70 |
+
</head>
|
| 71 |
+
|
| 72 |
+
<body>
|
| 73 |
+
<div class="container">
|
| 74 |
+
<h1>IRIS-FLOWER-CLASSIFICATION Prediction</h1>
|
| 75 |
+
<form action="{{ url_for('predict')}}" method="post">
|
| 76 |
+
<input type="text" name='SepalLengthCm' placeholder="Sepal Length (cm)" required><br>
|
| 77 |
+
<input type="text" name='SepalWidthCm' placeholder="Sepal Width (cm)" required><br>
|
| 78 |
+
<input type="text" name='PetalLengthCm' placeholder="Petal Length (cm)" required><br>
|
| 79 |
+
<input type="text" name='PetalWidthCm' placeholder="Petal Width (cm)" required><br>
|
| 80 |
+
<button type="submit">Predict</button>
|
| 81 |
+
</form>
|
| 82 |
+
<div class="error-message">{{prediction_text}}</div>
|
| 83 |
+
</div>
|
| 84 |
+
</body>
|
| 85 |
+
|
| 86 |
+
</html>
|
transformers/.circleci/TROUBLESHOOT.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Troubleshooting
|
| 2 |
+
|
| 3 |
+
This is a document explaining how to deal with various issues on Circle-CI. The entries may include actual solutions or pointers to Issues that cover those.
|
| 4 |
+
|
| 5 |
+
## Circle CI
|
| 6 |
+
|
| 7 |
+
* pytest worker runs out of resident RAM and gets killed by `cgroups`: https://github.com/huggingface/transformers/issues/11408
|
transformers/.circleci/config.yml
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version: 2.1
|
| 2 |
+
setup: true
|
| 3 |
+
orbs:
|
| 4 |
+
continuation: circleci/continuation@0.1.0
|
| 5 |
+
|
| 6 |
+
parameters:
|
| 7 |
+
nightly:
|
| 8 |
+
type: boolean
|
| 9 |
+
default: false
|
| 10 |
+
|
| 11 |
+
jobs:
|
| 12 |
+
# Ensure running with CircleCI/huggingface
|
| 13 |
+
check_circleci_user:
|
| 14 |
+
docker:
|
| 15 |
+
- image: cimg/python:3.8.12
|
| 16 |
+
parallelism: 1
|
| 17 |
+
steps:
|
| 18 |
+
- run: echo $CIRCLE_PROJECT_USERNAME
|
| 19 |
+
- run: |
|
| 20 |
+
if [ "$CIRCLE_PROJECT_USERNAME" = "huggingface" ]; then
|
| 21 |
+
exit 0
|
| 22 |
+
else
|
| 23 |
+
echo "The CI is running under $CIRCLE_PROJECT_USERNAME personal account. Please follow https://support.circleci.com/hc/en-us/articles/360008097173-Troubleshooting-why-pull-requests-are-not-triggering-jobs-on-my-organization- to fix it."; exit -1
|
| 24 |
+
fi
|
| 25 |
+
# Fetch the tests to run
|
| 26 |
+
fetch_tests:
|
| 27 |
+
working_directory: ~/transformers
|
| 28 |
+
docker:
|
| 29 |
+
- image: cimg/python:3.8.12
|
| 30 |
+
parallelism: 1
|
| 31 |
+
steps:
|
| 32 |
+
- checkout
|
| 33 |
+
- run: pip install --upgrade --upgrade-strategy eager pip
|
| 34 |
+
- run: pip install -U --upgrade-strategy eager GitPython
|
| 35 |
+
- run: pip install -U --upgrade-strategy eager .
|
| 36 |
+
- run: mkdir -p test_preparation
|
| 37 |
+
- run: python utils/tests_fetcher.py | tee tests_fetched_summary.txt
|
| 38 |
+
- store_artifacts:
|
| 39 |
+
path: ~/transformers/tests_fetched_summary.txt
|
| 40 |
+
- run: |
|
| 41 |
+
if [ -f test_list.txt ]; then
|
| 42 |
+
cp test_list.txt test_preparation/test_list.txt
|
| 43 |
+
else
|
| 44 |
+
touch test_preparation/test_list.txt
|
| 45 |
+
fi
|
| 46 |
+
- run: |
|
| 47 |
+
if [ -f examples_test_list.txt ]; then
|
| 48 |
+
mv examples_test_list.txt test_preparation/examples_test_list.txt
|
| 49 |
+
else
|
| 50 |
+
touch test_preparation/examples_test_list.txt
|
| 51 |
+
fi
|
| 52 |
+
- run: |
|
| 53 |
+
if [ -f filtered_test_list_cross_tests.txt ]; then
|
| 54 |
+
mv filtered_test_list_cross_tests.txt test_preparation/filtered_test_list_cross_tests.txt
|
| 55 |
+
else
|
| 56 |
+
touch test_preparation/filtered_test_list_cross_tests.txt
|
| 57 |
+
fi
|
| 58 |
+
- run: |
|
| 59 |
+
if [ -f doctest_list.txt ]; then
|
| 60 |
+
cp doctest_list.txt test_preparation/doctest_list.txt
|
| 61 |
+
else
|
| 62 |
+
touch test_preparation/doctest_list.txt
|
| 63 |
+
fi
|
| 64 |
+
- run: |
|
| 65 |
+
if [ -f test_repo_utils.txt ]; then
|
| 66 |
+
mv test_repo_utils.txt test_preparation/test_repo_utils.txt
|
| 67 |
+
else
|
| 68 |
+
touch test_preparation/test_repo_utils.txt
|
| 69 |
+
fi
|
| 70 |
+
- run: python utils/tests_fetcher.py --filter_tests
|
| 71 |
+
- run: |
|
| 72 |
+
if [ -f test_list.txt ]; then
|
| 73 |
+
mv test_list.txt test_preparation/filtered_test_list.txt
|
| 74 |
+
else
|
| 75 |
+
touch test_preparation/filtered_test_list.txt
|
| 76 |
+
fi
|
| 77 |
+
- store_artifacts:
|
| 78 |
+
path: test_preparation/test_list.txt
|
| 79 |
+
- store_artifacts:
|
| 80 |
+
path: test_preparation/doctest_list.txt
|
| 81 |
+
- store_artifacts:
|
| 82 |
+
path: ~/transformers/test_preparation/filtered_test_list.txt
|
| 83 |
+
- store_artifacts:
|
| 84 |
+
path: test_preparation/examples_test_list.txt
|
| 85 |
+
- run: python .circleci/create_circleci_config.py --fetcher_folder test_preparation
|
| 86 |
+
- run: |
|
| 87 |
+
if [ ! -s test_preparation/generated_config.yml ]; then
|
| 88 |
+
echo "No tests to run, exiting early!"
|
| 89 |
+
circleci-agent step halt
|
| 90 |
+
fi
|
| 91 |
+
- run: cp test_preparation/generated_config.yml test_preparation/generated_config.txt
|
| 92 |
+
- store_artifacts:
|
| 93 |
+
path: test_preparation/generated_config.txt
|
| 94 |
+
- store_artifacts:
|
| 95 |
+
path: test_preparation/filtered_test_list_cross_tests.txt
|
| 96 |
+
- continuation/continue:
|
| 97 |
+
configuration_path: test_preparation/generated_config.yml
|
| 98 |
+
|
| 99 |
+
# To run all tests for the nightly build
|
| 100 |
+
fetch_all_tests:
|
| 101 |
+
working_directory: ~/transformers
|
| 102 |
+
docker:
|
| 103 |
+
- image: cimg/python:3.8.12
|
| 104 |
+
parallelism: 1
|
| 105 |
+
steps:
|
| 106 |
+
- checkout
|
| 107 |
+
- run: pip install --upgrade --upgrade-strategy eager pip
|
| 108 |
+
- run: pip install -U --upgrade-strategy eager GitPython
|
| 109 |
+
- run: pip install -U --upgrade-strategy eager .
|
| 110 |
+
- run: |
|
| 111 |
+
mkdir test_preparation
|
| 112 |
+
echo -n "tests" > test_preparation/test_list.txt
|
| 113 |
+
echo -n "all" > test_preparation/examples_test_list.txt
|
| 114 |
+
echo -n "tests/repo_utils" > test_preparation/test_repo_utils.txt
|
| 115 |
+
- run: |
|
| 116 |
+
echo -n "tests" > test_list.txt
|
| 117 |
+
python utils/tests_fetcher.py --filter_tests
|
| 118 |
+
mv test_list.txt test_preparation/filtered_test_list.txt
|
| 119 |
+
- run: python .circleci/create_circleci_config.py --fetcher_folder test_preparation
|
| 120 |
+
- run: cp test_preparation/generated_config.yml test_preparation/generated_config.txt
|
| 121 |
+
- store_artifacts:
|
| 122 |
+
path: test_preparation/generated_config.txt
|
| 123 |
+
- continuation/continue:
|
| 124 |
+
configuration_path: test_preparation/generated_config.yml
|
| 125 |
+
|
| 126 |
+
check_code_quality:
|
| 127 |
+
working_directory: ~/transformers
|
| 128 |
+
docker:
|
| 129 |
+
- image: cimg/python:3.8.12
|
| 130 |
+
resource_class: large
|
| 131 |
+
environment:
|
| 132 |
+
TRANSFORMERS_IS_CI: yes
|
| 133 |
+
PYTEST_TIMEOUT: 120
|
| 134 |
+
parallelism: 1
|
| 135 |
+
steps:
|
| 136 |
+
- checkout
|
| 137 |
+
- restore_cache:
|
| 138 |
+
keys:
|
| 139 |
+
- v0.7-code_quality-pip-{{ checksum "setup.py" }}
|
| 140 |
+
- v0.7-code-quality-pip
|
| 141 |
+
- restore_cache:
|
| 142 |
+
keys:
|
| 143 |
+
- v0.7-code_quality-site-packages-{{ checksum "setup.py" }}
|
| 144 |
+
- v0.7-code-quality-site-packages
|
| 145 |
+
- run: pip install --upgrade --upgrade-strategy eager pip
|
| 146 |
+
- run: pip install -U --upgrade-strategy eager .[all,quality]
|
| 147 |
+
- save_cache:
|
| 148 |
+
key: v0.7-code_quality-pip-{{ checksum "setup.py" }}
|
| 149 |
+
paths:
|
| 150 |
+
- '~/.cache/pip'
|
| 151 |
+
- save_cache:
|
| 152 |
+
key: v0.7-code_quality-site-packages-{{ checksum "setup.py" }}
|
| 153 |
+
paths:
|
| 154 |
+
- '~/.pyenv/versions/'
|
| 155 |
+
- run:
|
| 156 |
+
name: Show installed libraries and their versions
|
| 157 |
+
command: pip freeze | tee installed.txt
|
| 158 |
+
- store_artifacts:
|
| 159 |
+
path: ~/transformers/installed.txt
|
| 160 |
+
- run: python -c "from transformers import *" || (echo '🚨 import failed, this means you introduced unprotected imports! 🚨'; exit 1)
|
| 161 |
+
- run: ruff check examples tests src utils
|
| 162 |
+
- run: ruff format tests src utils --check
|
| 163 |
+
- run: python utils/custom_init_isort.py --check_only
|
| 164 |
+
- run: python utils/sort_auto_mappings.py --check_only
|
| 165 |
+
- run: python utils/check_doc_toc.py
|
| 166 |
+
|
| 167 |
+
check_repository_consistency:
|
| 168 |
+
working_directory: ~/transformers
|
| 169 |
+
docker:
|
| 170 |
+
- image: cimg/python:3.8.12
|
| 171 |
+
resource_class: large
|
| 172 |
+
environment:
|
| 173 |
+
TRANSFORMERS_IS_CI: yes
|
| 174 |
+
PYTEST_TIMEOUT: 120
|
| 175 |
+
parallelism: 1
|
| 176 |
+
steps:
|
| 177 |
+
- checkout
|
| 178 |
+
- restore_cache:
|
| 179 |
+
keys:
|
| 180 |
+
- v0.7-repository_consistency-pip-{{ checksum "setup.py" }}
|
| 181 |
+
- v0.7-repository_consistency-pip
|
| 182 |
+
- restore_cache:
|
| 183 |
+
keys:
|
| 184 |
+
- v0.7-repository_consistency-site-packages-{{ checksum "setup.py" }}
|
| 185 |
+
- v0.7-repository_consistency-site-packages
|
| 186 |
+
- run: pip install --upgrade --upgrade-strategy eager pip
|
| 187 |
+
- run: pip install -U --upgrade-strategy eager .[all,quality]
|
| 188 |
+
- save_cache:
|
| 189 |
+
key: v0.7-repository_consistency-pip-{{ checksum "setup.py" }}
|
| 190 |
+
paths:
|
| 191 |
+
- '~/.cache/pip'
|
| 192 |
+
- save_cache:
|
| 193 |
+
key: v0.7-repository_consistency-site-packages-{{ checksum "setup.py" }}
|
| 194 |
+
paths:
|
| 195 |
+
- '~/.pyenv/versions/'
|
| 196 |
+
- run:
|
| 197 |
+
name: Show installed libraries and their versions
|
| 198 |
+
command: pip freeze | tee installed.txt
|
| 199 |
+
- store_artifacts:
|
| 200 |
+
path: ~/transformers/installed.txt
|
| 201 |
+
- run: python utils/check_copies.py
|
| 202 |
+
- run: python utils/check_table.py
|
| 203 |
+
- run: python utils/check_dummies.py
|
| 204 |
+
- run: python utils/check_repo.py
|
| 205 |
+
- run: python utils/check_inits.py
|
| 206 |
+
- run: python utils/check_config_docstrings.py
|
| 207 |
+
- run: python utils/check_config_attributes.py
|
| 208 |
+
- run: python utils/check_doctest_list.py
|
| 209 |
+
- run: make deps_table_check_updated
|
| 210 |
+
- run: python utils/update_metadata.py --check-only
|
| 211 |
+
- run: python utils/check_task_guides.py
|
| 212 |
+
- run: python utils/check_docstrings.py
|
| 213 |
+
- run: python utils/check_support_list.py
|
| 214 |
+
|
| 215 |
+
workflows:
|
| 216 |
+
version: 2
|
| 217 |
+
setup_and_quality:
|
| 218 |
+
when:
|
| 219 |
+
not: <<pipeline.parameters.nightly>>
|
| 220 |
+
jobs:
|
| 221 |
+
- check_circleci_user
|
| 222 |
+
- check_code_quality
|
| 223 |
+
- check_repository_consistency
|
| 224 |
+
- fetch_tests
|
| 225 |
+
|
| 226 |
+
nightly:
|
| 227 |
+
when: <<pipeline.parameters.nightly>>
|
| 228 |
+
jobs:
|
| 229 |
+
- check_circleci_user
|
| 230 |
+
- check_code_quality
|
| 231 |
+
- check_repository_consistency
|
| 232 |
+
- fetch_all_tests
|
transformers/.circleci/create_circleci_config.py
ADDED
|
@@ -0,0 +1,678 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coding=utf-8
|
| 2 |
+
# Copyright 2022 The HuggingFace Inc. team.
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
|
| 16 |
+
import argparse
|
| 17 |
+
import copy
|
| 18 |
+
import os
|
| 19 |
+
import random
|
| 20 |
+
from dataclasses import dataclass
|
| 21 |
+
from typing import Any, Dict, List, Optional
|
| 22 |
+
|
| 23 |
+
import yaml
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
COMMON_ENV_VARIABLES = {
|
| 27 |
+
"OMP_NUM_THREADS": 1,
|
| 28 |
+
"TRANSFORMERS_IS_CI": True,
|
| 29 |
+
"PYTEST_TIMEOUT": 120,
|
| 30 |
+
"RUN_PIPELINE_TESTS": False,
|
| 31 |
+
"RUN_PT_TF_CROSS_TESTS": False,
|
| 32 |
+
"RUN_PT_FLAX_CROSS_TESTS": False,
|
| 33 |
+
}
|
| 34 |
+
# Disable the use of {"s": None} as the output is way too long, causing the navigation on CircleCI impractical
|
| 35 |
+
COMMON_PYTEST_OPTIONS = {"max-worker-restart": 0, "dist": "loadfile", "v": None}
|
| 36 |
+
DEFAULT_DOCKER_IMAGE = [{"image": "cimg/python:3.8.12"}]
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
class EmptyJob:
|
| 40 |
+
job_name = "empty"
|
| 41 |
+
|
| 42 |
+
def to_dict(self):
|
| 43 |
+
return {
|
| 44 |
+
"working_directory": "~/transformers",
|
| 45 |
+
"docker": copy.deepcopy(DEFAULT_DOCKER_IMAGE),
|
| 46 |
+
"steps":["checkout"],
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
@dataclass
|
| 51 |
+
class CircleCIJob:
|
| 52 |
+
name: str
|
| 53 |
+
additional_env: Dict[str, Any] = None
|
| 54 |
+
cache_name: str = None
|
| 55 |
+
cache_version: str = "0.8.2"
|
| 56 |
+
docker_image: List[Dict[str, str]] = None
|
| 57 |
+
install_steps: List[str] = None
|
| 58 |
+
marker: Optional[str] = None
|
| 59 |
+
parallelism: Optional[int] = 1
|
| 60 |
+
pytest_num_workers: int = 12
|
| 61 |
+
pytest_options: Dict[str, Any] = None
|
| 62 |
+
resource_class: Optional[str] = "2xlarge"
|
| 63 |
+
tests_to_run: Optional[List[str]] = None
|
| 64 |
+
working_directory: str = "~/transformers"
|
| 65 |
+
# This should be only used for doctest job!
|
| 66 |
+
command_timeout: Optional[int] = None
|
| 67 |
+
|
| 68 |
+
def __post_init__(self):
|
| 69 |
+
# Deal with defaults for mutable attributes.
|
| 70 |
+
if self.additional_env is None:
|
| 71 |
+
self.additional_env = {}
|
| 72 |
+
if self.cache_name is None:
|
| 73 |
+
self.cache_name = self.name
|
| 74 |
+
if self.docker_image is None:
|
| 75 |
+
# Let's avoid changing the default list and make a copy.
|
| 76 |
+
self.docker_image = copy.deepcopy(DEFAULT_DOCKER_IMAGE)
|
| 77 |
+
if self.install_steps is None:
|
| 78 |
+
self.install_steps = []
|
| 79 |
+
if self.pytest_options is None:
|
| 80 |
+
self.pytest_options = {}
|
| 81 |
+
if isinstance(self.tests_to_run, str):
|
| 82 |
+
self.tests_to_run = [self.tests_to_run]
|
| 83 |
+
if self.parallelism is None:
|
| 84 |
+
self.parallelism = 1
|
| 85 |
+
|
| 86 |
+
def to_dict(self):
|
| 87 |
+
env = COMMON_ENV_VARIABLES.copy()
|
| 88 |
+
env.update(self.additional_env)
|
| 89 |
+
|
| 90 |
+
cache_branch_prefix = os.environ.get("CIRCLE_BRANCH", "pull")
|
| 91 |
+
if cache_branch_prefix != "main":
|
| 92 |
+
cache_branch_prefix = "pull"
|
| 93 |
+
|
| 94 |
+
job = {
|
| 95 |
+
"working_directory": self.working_directory,
|
| 96 |
+
"docker": self.docker_image,
|
| 97 |
+
"environment": env,
|
| 98 |
+
}
|
| 99 |
+
if self.resource_class is not None:
|
| 100 |
+
job["resource_class"] = self.resource_class
|
| 101 |
+
if self.parallelism is not None:
|
| 102 |
+
job["parallelism"] = self.parallelism
|
| 103 |
+
steps = [
|
| 104 |
+
"checkout",
|
| 105 |
+
{"attach_workspace": {"at": "~/transformers/test_preparation"}},
|
| 106 |
+
{
|
| 107 |
+
"restore_cache": {
|
| 108 |
+
"keys": [
|
| 109 |
+
# check the fully-matched cache first
|
| 110 |
+
f"v{self.cache_version}-{self.cache_name}-{cache_branch_prefix}-pip-" + '{{ checksum "setup.py" }}',
|
| 111 |
+
# try the partially-matched cache from `main`
|
| 112 |
+
f"v{self.cache_version}-{self.cache_name}-main-pip-",
|
| 113 |
+
# try the general partially-matched cache
|
| 114 |
+
f"v{self.cache_version}-{self.cache_name}-{cache_branch_prefix}-pip-",
|
| 115 |
+
]
|
| 116 |
+
}
|
| 117 |
+
},
|
| 118 |
+
{
|
| 119 |
+
"restore_cache": {
|
| 120 |
+
"keys": [
|
| 121 |
+
f"v{self.cache_version}-{self.cache_name}-{cache_branch_prefix}-site-packages-" + '{{ checksum "setup.py" }}',
|
| 122 |
+
f"v{self.cache_version}-{self.cache_name}-main-site-packages-",
|
| 123 |
+
f"v{self.cache_version}-{self.cache_name}-{cache_branch_prefix}-site-packages-",
|
| 124 |
+
]
|
| 125 |
+
}
|
| 126 |
+
},
|
| 127 |
+
]
|
| 128 |
+
steps.extend([{"run": l} for l in self.install_steps])
|
| 129 |
+
steps.extend([{"run": 'pip install "fsspec>=2023.5.0,<2023.10.0"'}])
|
| 130 |
+
steps.extend([{"run": "pip install pytest-subtests"}])
|
| 131 |
+
steps.append({"run": {"name": "Show installed libraries and their versions", "command": "pip freeze | tee installed.txt"}})
|
| 132 |
+
steps.append({"store_artifacts": {"path": "~/transformers/installed.txt"}})
|
| 133 |
+
|
| 134 |
+
all_options = {**COMMON_PYTEST_OPTIONS, **self.pytest_options}
|
| 135 |
+
pytest_flags = [f"--{key}={value}" if (value is not None or key in ["doctest-modules"]) else f"-{key}" for key, value in all_options.items()]
|
| 136 |
+
pytest_flags.append(
|
| 137 |
+
f"--make-reports={self.name}" if "examples" in self.name else f"--make-reports=tests_{self.name}"
|
| 138 |
+
)
|
| 139 |
+
|
| 140 |
+
steps.append({"run": {"name": "Create `test-results` directory", "command": "mkdir test-results"}})
|
| 141 |
+
|
| 142 |
+
test_command = ""
|
| 143 |
+
if self.command_timeout:
|
| 144 |
+
test_command = f"timeout {self.command_timeout} "
|
| 145 |
+
test_command += f"python -m pytest --junitxml=test-results/junit.xml -n {self.pytest_num_workers} " + " ".join(pytest_flags)
|
| 146 |
+
|
| 147 |
+
if self.parallelism == 1:
|
| 148 |
+
if self.tests_to_run is None:
|
| 149 |
+
test_command += " << pipeline.parameters.tests_to_run >>"
|
| 150 |
+
else:
|
| 151 |
+
test_command += " " + " ".join(self.tests_to_run)
|
| 152 |
+
else:
|
| 153 |
+
# We need explicit list instead of `pipeline.parameters.tests_to_run` (only available at job runtime)
|
| 154 |
+
tests = self.tests_to_run
|
| 155 |
+
if tests is None:
|
| 156 |
+
folder = os.environ["test_preparation_dir"]
|
| 157 |
+
test_file = os.path.join(folder, "filtered_test_list.txt")
|
| 158 |
+
if os.path.exists(test_file):
|
| 159 |
+
with open(test_file) as f:
|
| 160 |
+
tests = f.read().split(" ")
|
| 161 |
+
|
| 162 |
+
# expand the test list
|
| 163 |
+
if tests == ["tests"]:
|
| 164 |
+
tests = [os.path.join("tests", x) for x in os.listdir("tests")]
|
| 165 |
+
expanded_tests = []
|
| 166 |
+
for test in tests:
|
| 167 |
+
if test.endswith(".py"):
|
| 168 |
+
expanded_tests.append(test)
|
| 169 |
+
elif test == "tests/models":
|
| 170 |
+
expanded_tests.extend([os.path.join(test, x) for x in os.listdir(test)])
|
| 171 |
+
elif test == "tests/pipelines":
|
| 172 |
+
expanded_tests.extend([os.path.join(test, x) for x in os.listdir(test)])
|
| 173 |
+
else:
|
| 174 |
+
expanded_tests.append(test)
|
| 175 |
+
# Avoid long tests always being collected together
|
| 176 |
+
random.shuffle(expanded_tests)
|
| 177 |
+
tests = " ".join(expanded_tests)
|
| 178 |
+
|
| 179 |
+
# Each executor to run ~10 tests
|
| 180 |
+
n_executors = max(len(tests) // 10, 1)
|
| 181 |
+
# Avoid empty test list on some executor(s) or launching too many executors
|
| 182 |
+
if n_executors > self.parallelism:
|
| 183 |
+
n_executors = self.parallelism
|
| 184 |
+
job["parallelism"] = n_executors
|
| 185 |
+
|
| 186 |
+
# Need to be newline separated for the command `circleci tests split` below
|
| 187 |
+
command = f'echo {tests} | tr " " "\\n" >> tests.txt'
|
| 188 |
+
steps.append({"run": {"name": "Get tests", "command": command}})
|
| 189 |
+
|
| 190 |
+
command = 'TESTS=$(circleci tests split tests.txt) && echo $TESTS > splitted_tests.txt'
|
| 191 |
+
steps.append({"run": {"name": "Split tests", "command": command}})
|
| 192 |
+
|
| 193 |
+
steps.append({"store_artifacts": {"path": "~/transformers/tests.txt"}})
|
| 194 |
+
steps.append({"store_artifacts": {"path": "~/transformers/splitted_tests.txt"}})
|
| 195 |
+
|
| 196 |
+
test_command = ""
|
| 197 |
+
if self.timeout:
|
| 198 |
+
test_command = f"timeout {self.timeout} "
|
| 199 |
+
test_command += f"python -m pytest -n {self.pytest_num_workers} " + " ".join(pytest_flags)
|
| 200 |
+
test_command += " $(cat splitted_tests.txt)"
|
| 201 |
+
if self.marker is not None:
|
| 202 |
+
test_command += f" -m {self.marker}"
|
| 203 |
+
|
| 204 |
+
if self.name == "pr_documentation_tests":
|
| 205 |
+
# can't use ` | tee tee tests_output.txt` as usual
|
| 206 |
+
test_command += " > tests_output.txt"
|
| 207 |
+
# Save the return code, so we can check if it is timeout in the next step.
|
| 208 |
+
test_command += '; touch "$?".txt'
|
| 209 |
+
# Never fail the test step for the doctest job. We will check the results in the next step, and fail that
|
| 210 |
+
# step instead if the actual test failures are found. This is to avoid the timeout being reported as test
|
| 211 |
+
# failure.
|
| 212 |
+
test_command = f"({test_command}) || true"
|
| 213 |
+
else:
|
| 214 |
+
test_command = f"({test_command} | tee tests_output.txt) || true"
|
| 215 |
+
steps.append({"run": {"name": "Run tests", "command": test_command}})
|
| 216 |
+
|
| 217 |
+
# Deal with errors
|
| 218 |
+
check_test_command = f'if [ -s reports/{self.job_name}/errors.txt ]; '
|
| 219 |
+
check_test_command += 'then echo "Some tests errored out!"; echo ""; '
|
| 220 |
+
check_test_command += f'cat reports/{self.job_name}/errors.txt; '
|
| 221 |
+
check_test_command += 'echo ""; echo ""; '
|
| 222 |
+
|
| 223 |
+
py_command = f'import os; fp = open("reports/{self.job_name}/summary_short.txt"); failed = os.linesep.join([x for x in fp.read().split(os.linesep) if x.startswith("ERROR ")]); fp.close(); fp = open("summary_short.txt", "w"); fp.write(failed); fp.close()'
|
| 224 |
+
check_test_command += f"$(python3 -c '{py_command}'); "
|
| 225 |
+
check_test_command += 'cat summary_short.txt; echo ""; exit -1; '
|
| 226 |
+
|
| 227 |
+
# Deeal with failed tests
|
| 228 |
+
check_test_command += f'elif [ -s reports/{self.job_name}/failures_short.txt ]; '
|
| 229 |
+
check_test_command += 'then echo "Some tests failed!"; echo ""; '
|
| 230 |
+
check_test_command += f'cat reports/{self.job_name}/failures_short.txt; '
|
| 231 |
+
check_test_command += 'echo ""; echo ""; '
|
| 232 |
+
|
| 233 |
+
py_command = f'import os; fp = open("reports/{self.job_name}/summary_short.txt"); failed = os.linesep.join([x for x in fp.read().split(os.linesep) if x.startswith("FAILED ")]); fp.close(); fp = open("summary_short.txt", "w"); fp.write(failed); fp.close()'
|
| 234 |
+
check_test_command += f"$(python3 -c '{py_command}'); "
|
| 235 |
+
check_test_command += 'cat summary_short.txt; echo ""; exit -1; '
|
| 236 |
+
|
| 237 |
+
check_test_command += f'elif [ -s reports/{self.job_name}/stats.txt ]; then echo "All tests pass!"; '
|
| 238 |
+
|
| 239 |
+
# return code `124` means the previous (pytest run) step is timeout
|
| 240 |
+
if self.name == "pr_documentation_tests":
|
| 241 |
+
check_test_command += 'elif [ -f 124.txt ]; then echo "doctest timeout!"; '
|
| 242 |
+
|
| 243 |
+
check_test_command += 'else echo "other fatal error"; echo ""; exit -1; fi;'
|
| 244 |
+
|
| 245 |
+
steps.append({"run": {"name": "Check test results", "command": check_test_command}})
|
| 246 |
+
|
| 247 |
+
steps.append({"store_test_results": {"path": "test-results"}})
|
| 248 |
+
|
| 249 |
+
steps.append({"store_artifacts": {"path": "~/transformers/tests_output.txt"}})
|
| 250 |
+
steps.append({"store_artifacts": {"path": "~/transformers/reports"}})
|
| 251 |
+
|
| 252 |
+
# save cache at the end: so pytest step runs before cache saving and we can see results earlier
|
| 253 |
+
steps.append(
|
| 254 |
+
{
|
| 255 |
+
"save_cache": {
|
| 256 |
+
"key": f"v{self.cache_version}-{self.cache_name}-{cache_branch_prefix}-pip-" + '{{ checksum "setup.py" }}',
|
| 257 |
+
"paths": ["~/.cache/pip"],
|
| 258 |
+
}
|
| 259 |
+
}
|
| 260 |
+
)
|
| 261 |
+
steps.append(
|
| 262 |
+
{
|
| 263 |
+
"save_cache": {
|
| 264 |
+
"key": f"v{self.cache_version}-{self.cache_name}-{cache_branch_prefix}-site-packages-" + '{{ checksum "setup.py" }}',
|
| 265 |
+
"paths": ["~/.pyenv/versions/"],
|
| 266 |
+
}
|
| 267 |
+
}
|
| 268 |
+
)
|
| 269 |
+
|
| 270 |
+
job["steps"] = steps
|
| 271 |
+
return job
|
| 272 |
+
|
| 273 |
+
@property
|
| 274 |
+
def job_name(self):
|
| 275 |
+
return self.name if "examples" in self.name else f"tests_{self.name}"
|
| 276 |
+
|
| 277 |
+
|
| 278 |
+
# JOBS
|
| 279 |
+
torch_and_tf_job = CircleCIJob(
|
| 280 |
+
"torch_and_tf",
|
| 281 |
+
additional_env={"RUN_PT_TF_CROSS_TESTS": True},
|
| 282 |
+
install_steps=[
|
| 283 |
+
"sudo apt-get -y update && sudo apt-get install -y libsndfile1-dev espeak-ng git-lfs cmake",
|
| 284 |
+
"git lfs install",
|
| 285 |
+
"pip install --upgrade --upgrade-strategy eager pip",
|
| 286 |
+
"pip install -U --upgrade-strategy eager .[sklearn,tf-cpu,torch,testing,sentencepiece,torch-speech,vision]",
|
| 287 |
+
"pip install -U --upgrade-strategy eager tensorflow_probability",
|
| 288 |
+
"pip install -U --upgrade-strategy eager -e git+https://github.com/huggingface/accelerate@main#egg=accelerate",
|
| 289 |
+
# TODO: remove this one after fixing the dependency issue(s) above
|
| 290 |
+
"pip install -U --upgrade-strategy eager torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu",
|
| 291 |
+
],
|
| 292 |
+
marker="is_pt_tf_cross_test",
|
| 293 |
+
pytest_options={"rA": None, "durations": 0},
|
| 294 |
+
)
|
| 295 |
+
|
| 296 |
+
|
| 297 |
+
torch_and_flax_job = CircleCIJob(
|
| 298 |
+
"torch_and_flax",
|
| 299 |
+
additional_env={"RUN_PT_FLAX_CROSS_TESTS": True},
|
| 300 |
+
install_steps=[
|
| 301 |
+
"sudo apt-get -y update && sudo apt-get install -y libsndfile1-dev espeak-ng",
|
| 302 |
+
"pip install -U --upgrade-strategy eager --upgrade pip",
|
| 303 |
+
"pip install -U --upgrade-strategy eager .[sklearn,flax,torch,testing,sentencepiece,torch-speech,vision]",
|
| 304 |
+
"pip install -U --upgrade-strategy eager -e git+https://github.com/huggingface/accelerate@main#egg=accelerate",
|
| 305 |
+
],
|
| 306 |
+
marker="is_pt_flax_cross_test",
|
| 307 |
+
pytest_options={"rA": None, "durations": 0},
|
| 308 |
+
)
|
| 309 |
+
|
| 310 |
+
|
| 311 |
+
torch_job = CircleCIJob(
|
| 312 |
+
"torch",
|
| 313 |
+
install_steps=[
|
| 314 |
+
"sudo apt-get -y update && sudo apt-get install -y libsndfile1-dev espeak-ng time",
|
| 315 |
+
"pip install --upgrade --upgrade-strategy eager pip",
|
| 316 |
+
"pip install -U --upgrade-strategy eager .[sklearn,torch,testing,sentencepiece,torch-speech,vision,timm]",
|
| 317 |
+
"pip install -U --upgrade-strategy eager -e git+https://github.com/huggingface/accelerate@main#egg=accelerate",
|
| 318 |
+
],
|
| 319 |
+
parallelism=1,
|
| 320 |
+
pytest_num_workers=12,
|
| 321 |
+
)
|
| 322 |
+
|
| 323 |
+
|
| 324 |
+
tf_job = CircleCIJob(
|
| 325 |
+
"tf",
|
| 326 |
+
install_steps=[
|
| 327 |
+
"sudo apt-get -y update && sudo apt-get install -y libsndfile1-dev espeak-ng cmake",
|
| 328 |
+
"pip install --upgrade --upgrade-strategy eager pip",
|
| 329 |
+
"pip install -U --upgrade-strategy eager .[sklearn,tf-cpu,testing,sentencepiece,tf-speech,vision]",
|
| 330 |
+
"pip install -U --upgrade-strategy eager tensorflow_probability",
|
| 331 |
+
],
|
| 332 |
+
parallelism=1,
|
| 333 |
+
)
|
| 334 |
+
|
| 335 |
+
|
| 336 |
+
flax_job = CircleCIJob(
|
| 337 |
+
"flax",
|
| 338 |
+
install_steps=[
|
| 339 |
+
"sudo apt-get -y update && sudo apt-get install -y libsndfile1-dev espeak-ng",
|
| 340 |
+
"pip install --upgrade --upgrade-strategy eager pip",
|
| 341 |
+
"pip install -U --upgrade-strategy eager .[flax,testing,sentencepiece,flax-speech,vision]",
|
| 342 |
+
],
|
| 343 |
+
parallelism=1,
|
| 344 |
+
)
|
| 345 |
+
|
| 346 |
+
|
| 347 |
+
pipelines_torch_job = CircleCIJob(
|
| 348 |
+
"pipelines_torch",
|
| 349 |
+
additional_env={"RUN_PIPELINE_TESTS": True},
|
| 350 |
+
install_steps=[
|
| 351 |
+
"sudo apt-get -y update && sudo apt-get install -y libsndfile1-dev espeak-ng",
|
| 352 |
+
"pip install --upgrade --upgrade-strategy eager pip",
|
| 353 |
+
"pip install -U --upgrade-strategy eager .[sklearn,torch,testing,sentencepiece,torch-speech,vision,timm,video]",
|
| 354 |
+
],
|
| 355 |
+
marker="is_pipeline_test",
|
| 356 |
+
pytest_num_workers=12,
|
| 357 |
+
)
|
| 358 |
+
|
| 359 |
+
|
| 360 |
+
pipelines_tf_job = CircleCIJob(
|
| 361 |
+
"pipelines_tf",
|
| 362 |
+
additional_env={"RUN_PIPELINE_TESTS": True},
|
| 363 |
+
install_steps=[
|
| 364 |
+
"sudo apt-get -y update && sudo apt-get install -y cmake",
|
| 365 |
+
"pip install --upgrade --upgrade-strategy eager pip",
|
| 366 |
+
"pip install -U --upgrade-strategy eager .[sklearn,tf-cpu,testing,sentencepiece,vision]",
|
| 367 |
+
"pip install -U --upgrade-strategy eager tensorflow_probability",
|
| 368 |
+
],
|
| 369 |
+
marker="is_pipeline_test",
|
| 370 |
+
)
|
| 371 |
+
|
| 372 |
+
|
| 373 |
+
custom_tokenizers_job = CircleCIJob(
|
| 374 |
+
"custom_tokenizers",
|
| 375 |
+
additional_env={"RUN_CUSTOM_TOKENIZERS": True},
|
| 376 |
+
install_steps=[
|
| 377 |
+
"sudo apt-get -y update && sudo apt-get install -y cmake",
|
| 378 |
+
{
|
| 379 |
+
"name": "install jumanpp",
|
| 380 |
+
"command":
|
| 381 |
+
"wget https://github.com/ku-nlp/jumanpp/releases/download/v2.0.0-rc3/jumanpp-2.0.0-rc3.tar.xz\n"
|
| 382 |
+
"tar xvf jumanpp-2.0.0-rc3.tar.xz\n"
|
| 383 |
+
"mkdir jumanpp-2.0.0-rc3/bld\n"
|
| 384 |
+
"cd jumanpp-2.0.0-rc3/bld\n"
|
| 385 |
+
"sudo cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local\n"
|
| 386 |
+
"sudo make install\n",
|
| 387 |
+
},
|
| 388 |
+
"pip install --upgrade --upgrade-strategy eager pip",
|
| 389 |
+
"pip install -U --upgrade-strategy eager .[ja,testing,sentencepiece,jieba,spacy,ftfy,rjieba]",
|
| 390 |
+
"python -m unidic download",
|
| 391 |
+
],
|
| 392 |
+
parallelism=None,
|
| 393 |
+
resource_class=None,
|
| 394 |
+
tests_to_run=[
|
| 395 |
+
"./tests/models/bert_japanese/test_tokenization_bert_japanese.py",
|
| 396 |
+
"./tests/models/openai/test_tokenization_openai.py",
|
| 397 |
+
"./tests/models/clip/test_tokenization_clip.py",
|
| 398 |
+
],
|
| 399 |
+
)
|
| 400 |
+
|
| 401 |
+
|
| 402 |
+
examples_torch_job = CircleCIJob(
|
| 403 |
+
"examples_torch",
|
| 404 |
+
additional_env={"OMP_NUM_THREADS": 8},
|
| 405 |
+
cache_name="torch_examples",
|
| 406 |
+
install_steps=[
|
| 407 |
+
"sudo apt-get -y update && sudo apt-get install -y libsndfile1-dev espeak-ng",
|
| 408 |
+
"pip install --upgrade --upgrade-strategy eager pip",
|
| 409 |
+
"pip install -U --upgrade-strategy eager .[sklearn,torch,sentencepiece,testing,torch-speech]",
|
| 410 |
+
"pip install -U --upgrade-strategy eager -r examples/pytorch/_tests_requirements.txt",
|
| 411 |
+
"pip install -U --upgrade-strategy eager -e git+https://github.com/huggingface/accelerate@main#egg=accelerate",
|
| 412 |
+
],
|
| 413 |
+
pytest_num_workers=1,
|
| 414 |
+
)
|
| 415 |
+
|
| 416 |
+
|
| 417 |
+
examples_tensorflow_job = CircleCIJob(
|
| 418 |
+
"examples_tensorflow",
|
| 419 |
+
cache_name="tensorflow_examples",
|
| 420 |
+
install_steps=[
|
| 421 |
+
"sudo apt-get -y update && sudo apt-get install -y cmake",
|
| 422 |
+
"pip install --upgrade --upgrade-strategy eager pip",
|
| 423 |
+
"pip install -U --upgrade-strategy eager .[sklearn,tensorflow,sentencepiece,testing]",
|
| 424 |
+
"pip install -U --upgrade-strategy eager -r examples/tensorflow/_tests_requirements.txt",
|
| 425 |
+
],
|
| 426 |
+
)
|
| 427 |
+
|
| 428 |
+
|
| 429 |
+
examples_flax_job = CircleCIJob(
|
| 430 |
+
"examples_flax",
|
| 431 |
+
cache_name="flax_examples",
|
| 432 |
+
install_steps=[
|
| 433 |
+
"pip install --upgrade --upgrade-strategy eager pip",
|
| 434 |
+
"pip install -U --upgrade-strategy eager .[flax,testing,sentencepiece]",
|
| 435 |
+
"pip install -U --upgrade-strategy eager -r examples/flax/_tests_requirements.txt",
|
| 436 |
+
],
|
| 437 |
+
)
|
| 438 |
+
|
| 439 |
+
|
| 440 |
+
hub_job = CircleCIJob(
|
| 441 |
+
"hub",
|
| 442 |
+
additional_env={"HUGGINGFACE_CO_STAGING": True},
|
| 443 |
+
install_steps=[
|
| 444 |
+
"sudo apt-get -y update && sudo apt-get install git-lfs",
|
| 445 |
+
'git config --global user.email "ci@dummy.com"',
|
| 446 |
+
'git config --global user.name "ci"',
|
| 447 |
+
"pip install --upgrade --upgrade-strategy eager pip",
|
| 448 |
+
"pip install -U --upgrade-strategy eager .[torch,sentencepiece,testing,vision]",
|
| 449 |
+
],
|
| 450 |
+
marker="is_staging_test",
|
| 451 |
+
pytest_num_workers=1,
|
| 452 |
+
)
|
| 453 |
+
|
| 454 |
+
|
| 455 |
+
onnx_job = CircleCIJob(
|
| 456 |
+
"onnx",
|
| 457 |
+
install_steps=[
|
| 458 |
+
"sudo apt-get -y update && sudo apt-get install -y cmake",
|
| 459 |
+
"pip install --upgrade --upgrade-strategy eager pip",
|
| 460 |
+
"pip install -U --upgrade-strategy eager .[torch,tf,testing,sentencepiece,onnxruntime,vision,rjieba]",
|
| 461 |
+
],
|
| 462 |
+
pytest_options={"k onnx": None},
|
| 463 |
+
pytest_num_workers=1,
|
| 464 |
+
)
|
| 465 |
+
|
| 466 |
+
|
| 467 |
+
exotic_models_job = CircleCIJob(
|
| 468 |
+
"exotic_models",
|
| 469 |
+
install_steps=[
|
| 470 |
+
"sudo apt-get -y update && sudo apt-get install -y libsndfile1-dev",
|
| 471 |
+
"pip install --upgrade --upgrade-strategy eager pip",
|
| 472 |
+
"pip install -U --upgrade-strategy eager .[torch,testing,vision]",
|
| 473 |
+
"pip install -U --upgrade-strategy eager torchvision",
|
| 474 |
+
"pip install -U --upgrade-strategy eager scipy",
|
| 475 |
+
"pip install -U --upgrade-strategy eager 'git+https://github.com/facebookresearch/detectron2.git'",
|
| 476 |
+
"sudo apt install tesseract-ocr",
|
| 477 |
+
"pip install -U --upgrade-strategy eager pytesseract",
|
| 478 |
+
"pip install --upgrade-strategy eager sentencepiece",
|
| 479 |
+
"pip install -U --upgrade-strategy eager natten==0.15.1+torch210cpu -f https://shi-labs.com/natten/wheels",
|
| 480 |
+
"pip install -U --upgrade-strategy eager python-Levenshtein",
|
| 481 |
+
"pip install -U --upgrade-strategy eager opencv-python",
|
| 482 |
+
"pip install -U --upgrade-strategy eager nltk",
|
| 483 |
+
"pip uninstall -y torch torchvision torchaudio && pip install -U --upgrade-strategy eager 'torch<2.2.0' 'torchvision<0.17' 'torchaudio<2.2.0'"
|
| 484 |
+
],
|
| 485 |
+
tests_to_run=[
|
| 486 |
+
"tests/models/*layoutlmv*",
|
| 487 |
+
"tests/models/*nat",
|
| 488 |
+
"tests/models/deta",
|
| 489 |
+
"tests/models/udop",
|
| 490 |
+
"tests/models/nougat",
|
| 491 |
+
],
|
| 492 |
+
pytest_num_workers=1,
|
| 493 |
+
pytest_options={"durations": 100},
|
| 494 |
+
)
|
| 495 |
+
|
| 496 |
+
|
| 497 |
+
repo_utils_job = CircleCIJob(
|
| 498 |
+
"repo_utils",
|
| 499 |
+
install_steps=[
|
| 500 |
+
"pip install --upgrade --upgrade-strategy eager pip",
|
| 501 |
+
"pip install -U --upgrade-strategy eager .[quality,testing,torch]",
|
| 502 |
+
],
|
| 503 |
+
parallelism=None,
|
| 504 |
+
pytest_num_workers=1,
|
| 505 |
+
resource_class="large",
|
| 506 |
+
tests_to_run="tests/repo_utils",
|
| 507 |
+
)
|
| 508 |
+
|
| 509 |
+
|
| 510 |
+
# We also include a `dummy.py` file in the files to be doc-tested to prevent edge case failure. Otherwise, the pytest
|
| 511 |
+
# hangs forever during test collection while showing `collecting 0 items / 21 errors`. (To see this, we have to remove
|
| 512 |
+
# the bash output redirection.)
|
| 513 |
+
py_command = 'from utils.tests_fetcher import get_doctest_files; to_test = get_doctest_files() + ["dummy.py"]; to_test = " ".join(to_test); print(to_test)'
|
| 514 |
+
py_command = f"$(python3 -c '{py_command}')"
|
| 515 |
+
command = f'echo "{py_command}" > pr_documentation_tests_temp.txt'
|
| 516 |
+
doc_test_job = CircleCIJob(
|
| 517 |
+
"pr_documentation_tests",
|
| 518 |
+
additional_env={"TRANSFORMERS_VERBOSITY": "error", "DATASETS_VERBOSITY": "error", "SKIP_CUDA_DOCTEST": "1"},
|
| 519 |
+
install_steps=[
|
| 520 |
+
"sudo apt-get -y update && sudo apt-get install -y libsndfile1-dev espeak-ng time ffmpeg",
|
| 521 |
+
"pip install --upgrade --upgrade-strategy eager pip",
|
| 522 |
+
"pip install -U --upgrade-strategy eager -e .[dev]",
|
| 523 |
+
"pip install -U --upgrade-strategy eager -e git+https://github.com/huggingface/accelerate@main#egg=accelerate",
|
| 524 |
+
"pip install --upgrade --upgrade-strategy eager 'pytest<8.0.0' pytest-sugar",
|
| 525 |
+
"pip install -U --upgrade-strategy eager natten==0.15.1+torch210cpu -f https://shi-labs.com/natten/wheels",
|
| 526 |
+
"pip install -U --upgrade-strategy eager g2p-en",
|
| 527 |
+
# TODO: remove this one after fixing the dependency issue(s) above
|
| 528 |
+
"pip install -U --upgrade-strategy eager torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu",
|
| 529 |
+
"find -name __pycache__ -delete",
|
| 530 |
+
"find . -name \*.pyc -delete",
|
| 531 |
+
# Add an empty file to keep the test step running correctly even no file is selected to be tested.
|
| 532 |
+
"touch dummy.py",
|
| 533 |
+
{
|
| 534 |
+
"name": "Get files to test",
|
| 535 |
+
"command": command,
|
| 536 |
+
},
|
| 537 |
+
{
|
| 538 |
+
"name": "Show information in `Get files to test`",
|
| 539 |
+
"command":
|
| 540 |
+
"cat pr_documentation_tests_temp.txt"
|
| 541 |
+
},
|
| 542 |
+
{
|
| 543 |
+
"name": "Get the last line in `pr_documentation_tests.txt`",
|
| 544 |
+
"command":
|
| 545 |
+
"tail -n1 pr_documentation_tests_temp.txt | tee pr_documentation_tests.txt"
|
| 546 |
+
},
|
| 547 |
+
],
|
| 548 |
+
tests_to_run="$(cat pr_documentation_tests.txt)", # noqa
|
| 549 |
+
pytest_options={"-doctest-modules": None, "doctest-glob": "*.md", "dist": "loadfile", "rvsA": None},
|
| 550 |
+
command_timeout=1200, # test cannot run longer than 1200 seconds
|
| 551 |
+
pytest_num_workers=1,
|
| 552 |
+
)
|
| 553 |
+
|
| 554 |
+
REGULAR_TESTS = [
|
| 555 |
+
torch_and_tf_job,
|
| 556 |
+
torch_and_flax_job,
|
| 557 |
+
torch_job,
|
| 558 |
+
tf_job,
|
| 559 |
+
flax_job,
|
| 560 |
+
custom_tokenizers_job,
|
| 561 |
+
hub_job,
|
| 562 |
+
onnx_job,
|
| 563 |
+
exotic_models_job,
|
| 564 |
+
]
|
| 565 |
+
EXAMPLES_TESTS = [
|
| 566 |
+
examples_torch_job,
|
| 567 |
+
examples_tensorflow_job,
|
| 568 |
+
examples_flax_job,
|
| 569 |
+
]
|
| 570 |
+
PIPELINE_TESTS = [
|
| 571 |
+
pipelines_torch_job,
|
| 572 |
+
pipelines_tf_job,
|
| 573 |
+
]
|
| 574 |
+
REPO_UTIL_TESTS = [repo_utils_job]
|
| 575 |
+
DOC_TESTS = [doc_test_job]
|
| 576 |
+
|
| 577 |
+
|
| 578 |
+
def create_circleci_config(folder=None):
|
| 579 |
+
if folder is None:
|
| 580 |
+
folder = os.getcwd()
|
| 581 |
+
# Used in CircleCIJob.to_dict() to expand the test list (for using parallelism)
|
| 582 |
+
os.environ["test_preparation_dir"] = folder
|
| 583 |
+
jobs = []
|
| 584 |
+
all_test_file = os.path.join(folder, "test_list.txt")
|
| 585 |
+
if os.path.exists(all_test_file):
|
| 586 |
+
with open(all_test_file) as f:
|
| 587 |
+
all_test_list = f.read()
|
| 588 |
+
else:
|
| 589 |
+
all_test_list = []
|
| 590 |
+
if len(all_test_list) > 0:
|
| 591 |
+
jobs.extend(PIPELINE_TESTS)
|
| 592 |
+
|
| 593 |
+
test_file = os.path.join(folder, "filtered_test_list.txt")
|
| 594 |
+
if os.path.exists(test_file):
|
| 595 |
+
with open(test_file) as f:
|
| 596 |
+
test_list = f.read()
|
| 597 |
+
else:
|
| 598 |
+
test_list = []
|
| 599 |
+
if len(test_list) > 0:
|
| 600 |
+
jobs.extend(REGULAR_TESTS)
|
| 601 |
+
|
| 602 |
+
extended_tests_to_run = set(test_list.split())
|
| 603 |
+
# Extend the test files for cross test jobs
|
| 604 |
+
for job in jobs:
|
| 605 |
+
if job.job_name in ["tests_torch_and_tf", "tests_torch_and_flax"]:
|
| 606 |
+
for test_path in copy.copy(extended_tests_to_run):
|
| 607 |
+
dir_path, fn = os.path.split(test_path)
|
| 608 |
+
if fn.startswith("test_modeling_tf_"):
|
| 609 |
+
fn = fn.replace("test_modeling_tf_", "test_modeling_")
|
| 610 |
+
elif fn.startswith("test_modeling_flax_"):
|
| 611 |
+
fn = fn.replace("test_modeling_flax_", "test_modeling_")
|
| 612 |
+
else:
|
| 613 |
+
if job.job_name == "test_torch_and_tf":
|
| 614 |
+
fn = fn.replace("test_modeling_", "test_modeling_tf_")
|
| 615 |
+
elif job.job_name == "test_torch_and_flax":
|
| 616 |
+
fn = fn.replace("test_modeling_", "test_modeling_flax_")
|
| 617 |
+
new_test_file = str(os.path.join(dir_path, fn))
|
| 618 |
+
if os.path.isfile(new_test_file):
|
| 619 |
+
if new_test_file not in extended_tests_to_run:
|
| 620 |
+
extended_tests_to_run.add(new_test_file)
|
| 621 |
+
extended_tests_to_run = sorted(extended_tests_to_run)
|
| 622 |
+
for job in jobs:
|
| 623 |
+
if job.job_name in ["tests_torch_and_tf", "tests_torch_and_flax"]:
|
| 624 |
+
job.tests_to_run = extended_tests_to_run
|
| 625 |
+
fn = "filtered_test_list_cross_tests.txt"
|
| 626 |
+
f_path = os.path.join(folder, fn)
|
| 627 |
+
with open(f_path, "w") as fp:
|
| 628 |
+
fp.write(" ".join(extended_tests_to_run))
|
| 629 |
+
|
| 630 |
+
example_file = os.path.join(folder, "examples_test_list.txt")
|
| 631 |
+
if os.path.exists(example_file) and os.path.getsize(example_file) > 0:
|
| 632 |
+
with open(example_file, "r", encoding="utf-8") as f:
|
| 633 |
+
example_tests = f.read()
|
| 634 |
+
for job in EXAMPLES_TESTS:
|
| 635 |
+
framework = job.name.replace("examples_", "").replace("torch", "pytorch")
|
| 636 |
+
if example_tests == "all":
|
| 637 |
+
job.tests_to_run = [f"examples/{framework}"]
|
| 638 |
+
else:
|
| 639 |
+
job.tests_to_run = [f for f in example_tests.split(" ") if f.startswith(f"examples/{framework}")]
|
| 640 |
+
|
| 641 |
+
if len(job.tests_to_run) > 0:
|
| 642 |
+
jobs.append(job)
|
| 643 |
+
|
| 644 |
+
doctest_file = os.path.join(folder, "doctest_list.txt")
|
| 645 |
+
if os.path.exists(doctest_file):
|
| 646 |
+
with open(doctest_file) as f:
|
| 647 |
+
doctest_list = f.read()
|
| 648 |
+
else:
|
| 649 |
+
doctest_list = []
|
| 650 |
+
if len(doctest_list) > 0:
|
| 651 |
+
jobs.extend(DOC_TESTS)
|
| 652 |
+
|
| 653 |
+
repo_util_file = os.path.join(folder, "test_repo_utils.txt")
|
| 654 |
+
if os.path.exists(repo_util_file) and os.path.getsize(repo_util_file) > 0:
|
| 655 |
+
jobs.extend(REPO_UTIL_TESTS)
|
| 656 |
+
|
| 657 |
+
if len(jobs) == 0:
|
| 658 |
+
jobs = [EmptyJob()]
|
| 659 |
+
config = {"version": "2.1"}
|
| 660 |
+
config["parameters"] = {
|
| 661 |
+
# Only used to accept the parameters from the trigger
|
| 662 |
+
"nightly": {"type": "boolean", "default": False},
|
| 663 |
+
"tests_to_run": {"type": "string", "default": test_list},
|
| 664 |
+
}
|
| 665 |
+
config["jobs"] = {j.job_name: j.to_dict() for j in jobs}
|
| 666 |
+
config["workflows"] = {"version": 2, "run_tests": {"jobs": [j.job_name for j in jobs]}}
|
| 667 |
+
with open(os.path.join(folder, "generated_config.yml"), "w") as f:
|
| 668 |
+
f.write(yaml.dump(config, indent=2, width=1000000, sort_keys=False))
|
| 669 |
+
|
| 670 |
+
|
| 671 |
+
if __name__ == "__main__":
|
| 672 |
+
parser = argparse.ArgumentParser()
|
| 673 |
+
parser.add_argument(
|
| 674 |
+
"--fetcher_folder", type=str, default=None, help="Only test that all tests and modules are accounted for."
|
| 675 |
+
)
|
| 676 |
+
args = parser.parse_args()
|
| 677 |
+
|
| 678 |
+
create_circleci_config(args.fetcher_folder)
|
transformers/.coveragerc
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[run]
|
| 2 |
+
source=transformers
|
| 3 |
+
omit =
|
| 4 |
+
# skip convertion scripts from testing for now
|
| 5 |
+
*/convert_*
|
| 6 |
+
*/__main__.py
|
| 7 |
+
[report]
|
| 8 |
+
exclude_lines =
|
| 9 |
+
pragma: no cover
|
| 10 |
+
raise
|
| 11 |
+
except
|
| 12 |
+
register_parameter
|
transformers/.gitattributes
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.py eol=lf
|
| 2 |
+
*.rst eol=lf
|
| 3 |
+
*.md eol=lf
|
| 4 |
+
*.mdx eol=lf
|
transformers/.github/ISSUE_TEMPLATE/bug-report.yml
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: "\U0001F41B Bug Report"
|
| 2 |
+
description: Submit a bug report to help us improve transformers
|
| 3 |
+
body:
|
| 4 |
+
- type: textarea
|
| 5 |
+
id: system-info
|
| 6 |
+
attributes:
|
| 7 |
+
label: System Info
|
| 8 |
+
description: Please share your system info with us. You can run the command `transformers-cli env` and copy-paste its output below.
|
| 9 |
+
placeholder: transformers version, platform, python version, ...
|
| 10 |
+
validations:
|
| 11 |
+
required: true
|
| 12 |
+
|
| 13 |
+
- type: textarea
|
| 14 |
+
id: who-can-help
|
| 15 |
+
attributes:
|
| 16 |
+
label: Who can help?
|
| 17 |
+
description: |
|
| 18 |
+
Your issue will be replied to more quickly if you can figure out the right person to tag with @
|
| 19 |
+
If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
|
| 20 |
+
|
| 21 |
+
All issues are read by one of the core maintainers, so if you don't know who to tag, just leave this blank and
|
| 22 |
+
a core maintainer will ping the right person.
|
| 23 |
+
|
| 24 |
+
Please tag fewer than 3 people.
|
| 25 |
+
|
| 26 |
+
Models:
|
| 27 |
+
|
| 28 |
+
- text models: @ArthurZucker and @younesbelkada
|
| 29 |
+
- vision models: @amyeroberts
|
| 30 |
+
- speech models: @sanchit-gandhi
|
| 31 |
+
- graph models: @clefourrier
|
| 32 |
+
|
| 33 |
+
Library:
|
| 34 |
+
|
| 35 |
+
- flax: @sanchit-gandhi
|
| 36 |
+
- generate: @gante
|
| 37 |
+
- pipelines: @Narsil
|
| 38 |
+
- tensorflow: @gante and @Rocketknight1
|
| 39 |
+
- tokenizers: @ArthurZucker
|
| 40 |
+
- trainer: @muellerzr and @pacman100
|
| 41 |
+
|
| 42 |
+
Integrations:
|
| 43 |
+
|
| 44 |
+
- deepspeed: HF Trainer/Accelerate: @pacman100
|
| 45 |
+
- ray/raytune: @richardliaw, @amogkam
|
| 46 |
+
- Big Model Inference: @SunMarc
|
| 47 |
+
- quantization (bitsandbytes, autogpt): @SunMarc and @younesbelkada
|
| 48 |
+
|
| 49 |
+
Documentation: @stevhliu and @MKhalusova
|
| 50 |
+
|
| 51 |
+
Model hub:
|
| 52 |
+
|
| 53 |
+
- for issues with a model, report at https://discuss.huggingface.co/ and tag the model's creator.
|
| 54 |
+
|
| 55 |
+
HF projects:
|
| 56 |
+
|
| 57 |
+
- accelerate: [different repo](https://github.com/huggingface/accelerate)
|
| 58 |
+
- datasets: [different repo](https://github.com/huggingface/datasets)
|
| 59 |
+
- diffusers: [different repo](https://github.com/huggingface/diffusers)
|
| 60 |
+
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)
|
| 61 |
+
|
| 62 |
+
Maintained examples (not research project or legacy):
|
| 63 |
+
|
| 64 |
+
- Flax: @sanchit-gandhi
|
| 65 |
+
- PyTorch: See Models above and tag the person corresponding to the modality of the example.
|
| 66 |
+
- TensorFlow: @Rocketknight1
|
| 67 |
+
|
| 68 |
+
Research projects are not maintained and should be taken as is.
|
| 69 |
+
|
| 70 |
+
placeholder: "@Username ..."
|
| 71 |
+
|
| 72 |
+
- type: checkboxes
|
| 73 |
+
id: information-scripts-examples
|
| 74 |
+
attributes:
|
| 75 |
+
label: Information
|
| 76 |
+
description: 'The problem arises when using:'
|
| 77 |
+
options:
|
| 78 |
+
- label: "The official example scripts"
|
| 79 |
+
- label: "My own modified scripts"
|
| 80 |
+
|
| 81 |
+
- type: checkboxes
|
| 82 |
+
id: information-tasks
|
| 83 |
+
attributes:
|
| 84 |
+
label: Tasks
|
| 85 |
+
description: "The tasks I am working on are:"
|
| 86 |
+
options:
|
| 87 |
+
- label: "An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)"
|
| 88 |
+
- label: "My own task or dataset (give details below)"
|
| 89 |
+
|
| 90 |
+
- type: textarea
|
| 91 |
+
id: reproduction
|
| 92 |
+
validations:
|
| 93 |
+
required: true
|
| 94 |
+
attributes:
|
| 95 |
+
label: Reproduction
|
| 96 |
+
description: |
|
| 97 |
+
Please provide a code sample that reproduces the problem you ran into. It can be a Colab link or just a code snippet.
|
| 98 |
+
If you have code snippets, error messages, stack traces please provide them here as well.
|
| 99 |
+
Important! Use code tags to correctly format your code. See https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks#syntax-highlighting
|
| 100 |
+
Do not use screenshots, as they are hard to read and (more importantly) don't allow others to copy-and-paste your code.
|
| 101 |
+
|
| 102 |
+
placeholder: |
|
| 103 |
+
Steps to reproduce the behavior:
|
| 104 |
+
|
| 105 |
+
1.
|
| 106 |
+
2.
|
| 107 |
+
3.
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
- type: textarea
|
| 111 |
+
id: expected-behavior
|
| 112 |
+
validations:
|
| 113 |
+
required: true
|
| 114 |
+
attributes:
|
| 115 |
+
label: Expected behavior
|
| 116 |
+
description: "A clear and concise description of what you would expect to happen."
|
transformers/.github/ISSUE_TEMPLATE/config.yml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
blank_issues_enabled: true
|
| 2 |
+
version: 2.1
|
| 3 |
+
contact_links:
|
| 4 |
+
- name: Model checkpoints on the Hugging Face Hub
|
| 5 |
+
url: https://huggingface.co/models
|
| 6 |
+
about: Open a Pull request / Discussion related to a specific model checkpoint directly on the Hugging Face Hub
|
| 7 |
+
- name: Website Related
|
| 8 |
+
url: https://github.com/huggingface/hub-docs/issues
|
| 9 |
+
about: Feature requests and bug reports related to the website
|
| 10 |
+
- name: Forum
|
| 11 |
+
url: https://discuss.huggingface.co/
|
| 12 |
+
about: General usage questions and community discussions
|
transformers/.github/ISSUE_TEMPLATE/feature-request.yml
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: "\U0001F680 Feature request"
|
| 2 |
+
description: Submit a proposal/request for a new transformers feature
|
| 3 |
+
labels: [ "feature" ]
|
| 4 |
+
body:
|
| 5 |
+
- type: textarea
|
| 6 |
+
id: feature-request
|
| 7 |
+
validations:
|
| 8 |
+
required: true
|
| 9 |
+
attributes:
|
| 10 |
+
label: Feature request
|
| 11 |
+
description: |
|
| 12 |
+
A clear and concise description of the feature proposal. Please provide a link to the paper and code in case they exist.
|
| 13 |
+
|
| 14 |
+
- type: textarea
|
| 15 |
+
id: motivation
|
| 16 |
+
validations:
|
| 17 |
+
required: true
|
| 18 |
+
attributes:
|
| 19 |
+
label: Motivation
|
| 20 |
+
description: |
|
| 21 |
+
Please outline the motivation for the proposal. Is your feature request related to a problem? e.g., I'm always frustrated when [...]. If this is related to another GitHub issue, please link here too.
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
- type: textarea
|
| 25 |
+
id: contribution
|
| 26 |
+
validations:
|
| 27 |
+
required: true
|
| 28 |
+
attributes:
|
| 29 |
+
label: Your contribution
|
| 30 |
+
description: |
|
| 31 |
+
Is there any way that you could help, e.g. by submitting a PR? Make sure to read the CONTRIBUTING.MD [readme](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md)
|
transformers/.github/ISSUE_TEMPLATE/i18n.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: 🌐 Translating a new language?
|
| 3 |
+
about: Start a new translation effort in your language
|
| 4 |
+
title: '[i18n-<languageCode>] Translating docs to <languageName>'
|
| 5 |
+
labels: WIP
|
| 6 |
+
assignees: ''
|
| 7 |
+
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
<!--
|
| 11 |
+
Note: Please search to see if an issue already exists for the language you are trying to translate.
|
| 12 |
+
-->
|
| 13 |
+
|
| 14 |
+
Hi!
|
| 15 |
+
|
| 16 |
+
Let's bring the documentation to all the <languageName>-speaking community 🌐 (currently 0 out of 267 complete)
|
| 17 |
+
|
| 18 |
+
Who would want to translate? Please follow the 🤗 [TRANSLATING guide](https://github.com/huggingface/transformers/blob/main/docs/TRANSLATING.md). Here is a list of the files ready for translation. Let us know in this issue if you'd like to translate any, and we'll add your name to the list.
|
| 19 |
+
|
| 20 |
+
Some notes:
|
| 21 |
+
|
| 22 |
+
* Please translate using an informal tone (imagine you are talking with a friend about transformers 🤗).
|
| 23 |
+
* Please translate in a gender-neutral way.
|
| 24 |
+
* Add your translations to the folder called `<languageCode>` inside the [source folder](https://github.com/huggingface/transformers/tree/main/docs/source).
|
| 25 |
+
* Register your translation in `<languageCode>/_toctree.yml`; please follow the order of the [English version](https://github.com/huggingface/transformers/blob/main/docs/source/en/_toctree.yml).
|
| 26 |
+
* Once you're finished, open a pull request and tag this issue by including #issue-number in the description, where issue-number is the number of this issue. Please ping @stevhliu and @MKhalusova for review.
|
| 27 |
+
* 🙋 If you'd like others to help you with the translation, you can also post in the 🤗 [forums](https://discuss.huggingface.co/).
|
| 28 |
+
|
| 29 |
+
## Get Started section
|
| 30 |
+
|
| 31 |
+
- [ ] [index.md](https://github.com/huggingface/transformers/blob/main/docs/source/en/index.md) https://github.com/huggingface/transformers/pull/20180
|
| 32 |
+
- [ ] [quicktour.md](https://github.com/huggingface/transformers/blob/main/docs/source/en/quicktour.md) (waiting for initial PR to go through)
|
| 33 |
+
- [ ] [installation.md](https://github.com/huggingface/transformers/blob/main/docs/source/en/installation.md).
|
| 34 |
+
|
| 35 |
+
## Tutorial section
|
| 36 |
+
- [ ] [pipeline_tutorial.md](https://github.com/huggingface/transformers/blob/main/docs/source/en/pipeline_tutorial.md)
|
| 37 |
+
- [ ] [autoclass_tutorial.md](https://github.com/huggingface/transformers/blob/master/docs/source/autoclass_tutorial.md)
|
| 38 |
+
- [ ] [preprocessing.md](https://github.com/huggingface/transformers/blob/main/docs/source/en/preprocessing.md)
|
| 39 |
+
- [ ] [training.md](https://github.com/huggingface/transformers/blob/main/docs/source/en/training.md)
|
| 40 |
+
- [ ] [accelerate.md](https://github.com/huggingface/transformers/blob/main/docs/source/en/accelerate.md)
|
| 41 |
+
- [ ] [model_sharing.md](https://github.com/huggingface/transformers/blob/main/docs/source/en/model_sharing.md)
|
| 42 |
+
- [ ] [multilingual.md](https://github.com/huggingface/transformers/blob/main/docs/source/en/multilingual.md)
|
| 43 |
+
|
| 44 |
+
<!--
|
| 45 |
+
Keep on adding more as you go 🔥
|
| 46 |
+
-->
|
transformers/.github/ISSUE_TEMPLATE/migration.yml
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: "\U0001F4DA Migration from pytorch-pretrained-bert or pytorch-transformers"
|
| 2 |
+
description: Report a problem when migrating from pytorch-pretrained-bert or pytorch-transformers to transformers
|
| 3 |
+
labels: [ "migration" ]
|
| 4 |
+
body:
|
| 5 |
+
- type: textarea
|
| 6 |
+
id: system-info
|
| 7 |
+
attributes:
|
| 8 |
+
label: System Info
|
| 9 |
+
description: Please share your system info with us. You can run the command `transformers-cli env` and copy-paste its output below.
|
| 10 |
+
render: shell
|
| 11 |
+
placeholder: transformers version, platform, python version, ...
|
| 12 |
+
validations:
|
| 13 |
+
required: true
|
| 14 |
+
|
| 15 |
+
- type: checkboxes
|
| 16 |
+
id: information-scripts-examples
|
| 17 |
+
attributes:
|
| 18 |
+
label: Information
|
| 19 |
+
description: 'The problem arises when using:'
|
| 20 |
+
options:
|
| 21 |
+
- label: "The official example scripts"
|
| 22 |
+
- label: "My own modified scripts"
|
| 23 |
+
|
| 24 |
+
- type: checkboxes
|
| 25 |
+
id: information-tasks
|
| 26 |
+
attributes:
|
| 27 |
+
label: Tasks
|
| 28 |
+
description: "The tasks I am working on are:"
|
| 29 |
+
options:
|
| 30 |
+
- label: "An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)"
|
| 31 |
+
- label: "My own task or dataset (give details below)"
|
| 32 |
+
|
| 33 |
+
- type: textarea
|
| 34 |
+
id: reproduction
|
| 35 |
+
validations:
|
| 36 |
+
required: true
|
| 37 |
+
attributes:
|
| 38 |
+
label: Reproduction
|
| 39 |
+
description: |
|
| 40 |
+
Please provide a code sample that reproduces the problem you ran into. It can be a Colab link or just a code snippet.
|
| 41 |
+
If you have code snippets, error messages, stack traces please provide them here as well.
|
| 42 |
+
Important! Use code tags to correctly format your code. See https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks#syntax-highlighting
|
| 43 |
+
Do not use screenshots, as they are hard to read and (more importantly) don't allow others to copy-and-paste your code.
|
| 44 |
+
|
| 45 |
+
placeholder: |
|
| 46 |
+
Steps to reproduce the behavior:
|
| 47 |
+
|
| 48 |
+
1.
|
| 49 |
+
2.
|
| 50 |
+
3.
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
- type: textarea
|
| 54 |
+
id: expected-behavior
|
| 55 |
+
validations:
|
| 56 |
+
required: true
|
| 57 |
+
attributes:
|
| 58 |
+
label: Expected behavior
|
| 59 |
+
description: "A clear and concise description of what you would expect to happen."
|
| 60 |
+
render: shell
|
| 61 |
+
|
| 62 |
+
- type: checkboxes
|
| 63 |
+
id: checklist
|
| 64 |
+
attributes:
|
| 65 |
+
label: Checklist
|
| 66 |
+
options:
|
| 67 |
+
- label: "I have read the migration guide in the readme.
|
| 68 |
+
([pytorch-transformers](https://github.com/huggingface/transformers#migrating-from-pytorch-transformers-to-transformers);
|
| 69 |
+
[pytorch-pretrained-bert](https://github.com/huggingface/transformers#migrating-from-pytorch-pretrained-bert-to-transformers))"
|
| 70 |
+
required: true
|
| 71 |
+
- label: "I checked if a related official extension example runs on my machine."
|
| 72 |
+
required: true
|
transformers/.github/ISSUE_TEMPLATE/new-model-addition.yml
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: "\U0001F31F New model addition"
|
| 2 |
+
description: Submit a proposal/request to implement a new model
|
| 3 |
+
labels: [ "New model" ]
|
| 4 |
+
|
| 5 |
+
body:
|
| 6 |
+
- type: textarea
|
| 7 |
+
id: description-request
|
| 8 |
+
validations:
|
| 9 |
+
required: true
|
| 10 |
+
attributes:
|
| 11 |
+
label: Model description
|
| 12 |
+
description: |
|
| 13 |
+
Put any and all important information relative to the model
|
| 14 |
+
|
| 15 |
+
- type: checkboxes
|
| 16 |
+
id: information-tasks
|
| 17 |
+
attributes:
|
| 18 |
+
label: Open source status
|
| 19 |
+
description: |
|
| 20 |
+
Please note that if the model implementation isn't available or if the weights aren't open-source, we are less likely to implement it in `transformers`.
|
| 21 |
+
options:
|
| 22 |
+
- label: "The model implementation is available"
|
| 23 |
+
- label: "The model weights are available"
|
| 24 |
+
|
| 25 |
+
- type: textarea
|
| 26 |
+
id: additional-info
|
| 27 |
+
attributes:
|
| 28 |
+
label: Provide useful links for the implementation
|
| 29 |
+
description: |
|
| 30 |
+
Please provide information regarding the implementation, the weights, and the authors.
|
| 31 |
+
Please mention the authors by @gh-username if you're aware of their usernames.
|
transformers/.github/PULL_REQUEST_TEMPLATE.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# What does this PR do?
|
| 2 |
+
|
| 3 |
+
<!--
|
| 4 |
+
Congratulations! You've made it this far! You're not quite done yet though.
|
| 5 |
+
|
| 6 |
+
Once merged, your PR is going to appear in the release notes with the title you set, so make sure it's a great title that fully reflects the extent of your awesome contribution.
|
| 7 |
+
|
| 8 |
+
Then, please replace this with a description of the change and which issue is fixed (if applicable). Please also include relevant motivation and context. List any dependencies (if any) that are required for this change.
|
| 9 |
+
|
| 10 |
+
Once you're done, someone will review your PR shortly (see the section "Who can review?" below to tag some potential reviewers). They may suggest changes to make the code even better. If no one reviewed your PR after a week has passed, don't hesitate to post a new comment @-mentioning the same persons---sometimes notifications get lost.
|
| 11 |
+
-->
|
| 12 |
+
|
| 13 |
+
<!-- Remove if not applicable -->
|
| 14 |
+
|
| 15 |
+
Fixes # (issue)
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
## Before submitting
|
| 19 |
+
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
|
| 20 |
+
- [ ] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#create-a-pull-request),
|
| 21 |
+
Pull Request section?
|
| 22 |
+
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
|
| 23 |
+
to it if that's the case.
|
| 24 |
+
- [ ] Did you make sure to update the documentation with your changes? Here are the
|
| 25 |
+
[documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
|
| 26 |
+
[here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
|
| 27 |
+
- [ ] Did you write any new necessary tests?
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
## Who can review?
|
| 31 |
+
|
| 32 |
+
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
|
| 33 |
+
members/contributors who may be interested in your PR.
|
| 34 |
+
|
| 35 |
+
<!-- Your PR will be replied to more quickly if you can figure out the right person to tag with @
|
| 36 |
+
|
| 37 |
+
If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
|
| 38 |
+
Please tag fewer than 3 people.
|
| 39 |
+
|
| 40 |
+
Models:
|
| 41 |
+
|
| 42 |
+
- text models: @ArthurZucker and @younesbelkada
|
| 43 |
+
- vision models: @amyeroberts
|
| 44 |
+
- speech models: @sanchit-gandhi
|
| 45 |
+
- graph models: @clefourrier
|
| 46 |
+
|
| 47 |
+
Library:
|
| 48 |
+
|
| 49 |
+
- flax: @sanchit-gandhi
|
| 50 |
+
- generate: @gante
|
| 51 |
+
- pipelines: @Narsil
|
| 52 |
+
- tensorflow: @gante and @Rocketknight1
|
| 53 |
+
- tokenizers: @ArthurZucker
|
| 54 |
+
- trainer: @muellerzr and @pacman100
|
| 55 |
+
|
| 56 |
+
Integrations:
|
| 57 |
+
|
| 58 |
+
- deepspeed: HF Trainer/Accelerate: @pacman100
|
| 59 |
+
- ray/raytune: @richardliaw, @amogkam
|
| 60 |
+
- Big Model Inference: @SunMarc
|
| 61 |
+
- quantization (bitsandbytes, autogpt): @SunMarc and @younesbelkada
|
| 62 |
+
|
| 63 |
+
Documentation: @stevhliu and @MKhalusova
|
| 64 |
+
|
| 65 |
+
HF projects:
|
| 66 |
+
|
| 67 |
+
- accelerate: [different repo](https://github.com/huggingface/accelerate)
|
| 68 |
+
- datasets: [different repo](https://github.com/huggingface/datasets)
|
| 69 |
+
- diffusers: [different repo](https://github.com/huggingface/diffusers)
|
| 70 |
+
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)
|
| 71 |
+
|
| 72 |
+
Maintained examples (not research project or legacy):
|
| 73 |
+
|
| 74 |
+
- Flax: @sanchit-gandhi
|
| 75 |
+
- PyTorch: See Models above and tag the person corresponding to the modality of the example.
|
| 76 |
+
- TensorFlow: @Rocketknight1
|
| 77 |
+
|
| 78 |
+
-->
|
transformers/.github/conda/build.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
$PYTHON setup.py install # Python command to install the script.
|
transformers/.github/conda/meta.yaml
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% set name = "transformers" %}
|
| 2 |
+
|
| 3 |
+
package:
|
| 4 |
+
name: "{{ name|lower }}"
|
| 5 |
+
version: "{{ TRANSFORMERS_VERSION }}"
|
| 6 |
+
|
| 7 |
+
source:
|
| 8 |
+
path: ../../
|
| 9 |
+
|
| 10 |
+
build:
|
| 11 |
+
noarch: python
|
| 12 |
+
|
| 13 |
+
requirements:
|
| 14 |
+
host:
|
| 15 |
+
- python
|
| 16 |
+
- pip
|
| 17 |
+
- numpy >=1.17
|
| 18 |
+
- dataclasses
|
| 19 |
+
- huggingface_hub
|
| 20 |
+
- packaging
|
| 21 |
+
- filelock
|
| 22 |
+
- requests
|
| 23 |
+
- tqdm >=4.27
|
| 24 |
+
- sacremoses
|
| 25 |
+
- regex !=2019.12.17
|
| 26 |
+
- protobuf
|
| 27 |
+
- tokenizers >=0.11.1,!=0.11.3,<0.13
|
| 28 |
+
- pyyaml >=5.1
|
| 29 |
+
- safetensors
|
| 30 |
+
- fsspec
|
| 31 |
+
run:
|
| 32 |
+
- python
|
| 33 |
+
- numpy >=1.17
|
| 34 |
+
- dataclasses
|
| 35 |
+
- huggingface_hub
|
| 36 |
+
- packaging
|
| 37 |
+
- filelock
|
| 38 |
+
- requests
|
| 39 |
+
- tqdm >=4.27
|
| 40 |
+
- sacremoses
|
| 41 |
+
- regex !=2019.12.17
|
| 42 |
+
- protobuf
|
| 43 |
+
- tokenizers >=0.11.1,!=0.11.3,<0.13
|
| 44 |
+
- pyyaml >=5.1
|
| 45 |
+
- safetensors
|
| 46 |
+
- fsspec
|
| 47 |
+
|
| 48 |
+
test:
|
| 49 |
+
imports:
|
| 50 |
+
- transformers
|
| 51 |
+
|
| 52 |
+
about:
|
| 53 |
+
home: https://huggingface.co
|
| 54 |
+
license: Apache License 2.0
|
| 55 |
+
license_file: LICENSE
|
| 56 |
+
summary: "🤗Transformers: State-of-the-art Natural Language Processing for Pytorch and TensorFlow 2.0."
|
transformers/.github/workflows/TROUBLESHOOT.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Troubleshooting
|
| 2 |
+
|
| 3 |
+
This is a document explaining how to deal with various issues on github-actions self-hosted CI. The entries may include actual solutions or pointers to Issues that cover those.
|
| 4 |
+
|
| 5 |
+
## GitHub Actions (self-hosted CI)
|
| 6 |
+
|
| 7 |
+
* Deepspeed
|
| 8 |
+
|
| 9 |
+
- if jit build hangs, clear out `rm -rf ~/.cache/torch_extensions/` reference: https://github.com/huggingface/transformers/pull/12723
|
transformers/.github/workflows/add-model-like.yml
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Add model like runner
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches:
|
| 6 |
+
- none # put main here when this is fixed
|
| 7 |
+
#pull_request:
|
| 8 |
+
# paths:
|
| 9 |
+
# - "src/**"
|
| 10 |
+
# - "tests/**"
|
| 11 |
+
# - ".github/**"
|
| 12 |
+
# types: [opened, synchronize, reopened]
|
| 13 |
+
|
| 14 |
+
jobs:
|
| 15 |
+
run_tests_templates_like:
|
| 16 |
+
name: "Add new model like template tests"
|
| 17 |
+
runs-on: ubuntu-22.04
|
| 18 |
+
steps:
|
| 19 |
+
- uses: actions/checkout@v3
|
| 20 |
+
|
| 21 |
+
- name: Install dependencies
|
| 22 |
+
run: |
|
| 23 |
+
sudo apt -y update && sudo apt install -y libsndfile1-dev
|
| 24 |
+
|
| 25 |
+
- name: Load cached virtual environment
|
| 26 |
+
uses: actions/cache@v2
|
| 27 |
+
id: cache
|
| 28 |
+
with:
|
| 29 |
+
path: ~/venv/
|
| 30 |
+
key: v4-tests_model_like-${{ hashFiles('setup.py') }}
|
| 31 |
+
|
| 32 |
+
- name: Create virtual environment on cache miss
|
| 33 |
+
if: steps.cache.outputs.cache-hit != 'true'
|
| 34 |
+
run: |
|
| 35 |
+
python -m venv ~/venv && . ~/venv/bin/activate
|
| 36 |
+
pip install --upgrade pip!=21.3
|
| 37 |
+
pip install -e .[dev]
|
| 38 |
+
|
| 39 |
+
- name: Check transformers location
|
| 40 |
+
# make `transformers` available as package (required since we use `-e` flag) and check it's indeed from the repo.
|
| 41 |
+
run: |
|
| 42 |
+
. ~/venv/bin/activate
|
| 43 |
+
python setup.py develop
|
| 44 |
+
transformers_install=$(pip list -e | grep transformers)
|
| 45 |
+
transformers_install_array=($transformers_install)
|
| 46 |
+
transformers_loc=${transformers_install_array[-1]}
|
| 47 |
+
transformers_repo_loc=$(pwd .)
|
| 48 |
+
if [ "$transformers_loc" != "$transformers_repo_loc" ]; then
|
| 49 |
+
echo "transformers is from $transformers_loc but it shoud be from $transformers_repo_loc/src."
|
| 50 |
+
echo "A fix is required. Stop testing."
|
| 51 |
+
exit 1
|
| 52 |
+
fi
|
| 53 |
+
|
| 54 |
+
- name: Create model files
|
| 55 |
+
run: |
|
| 56 |
+
. ~/venv/bin/activate
|
| 57 |
+
transformers-cli add-new-model-like --config_file tests/fixtures/add_distilbert_like_config.json --path_to_repo .
|
| 58 |
+
make style
|
| 59 |
+
make fix-copies
|
| 60 |
+
|
| 61 |
+
- name: Run all PyTorch modeling test
|
| 62 |
+
run: |
|
| 63 |
+
. ~/venv/bin/activate
|
| 64 |
+
python -m pytest -n 2 --dist=loadfile -s --make-reports=tests_new_models tests/bert_new/test_modeling_bert_new.py
|
| 65 |
+
|
| 66 |
+
- name: Run style changes
|
| 67 |
+
run: |
|
| 68 |
+
. ~/venv/bin/activate
|
| 69 |
+
make style && make quality && make repo-consistency
|
| 70 |
+
|
| 71 |
+
- name: Failure short reports
|
| 72 |
+
if: ${{ always() }}
|
| 73 |
+
run: cat reports/tests_new_models/failures_short.txt
|
| 74 |
+
|
| 75 |
+
- name: Test suite reports artifacts
|
| 76 |
+
if: ${{ always() }}
|
| 77 |
+
uses: actions/upload-artifact@v3
|
| 78 |
+
with:
|
| 79 |
+
name: run_all_tests_new_models_test_reports
|
| 80 |
+
path: reports/tests_new_models
|
transformers/.github/workflows/build-docker-images.yml
ADDED
|
@@ -0,0 +1,333 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Build docker images (scheduled)
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches:
|
| 6 |
+
- build_ci_docker_image*
|
| 7 |
+
repository_dispatch:
|
| 8 |
+
workflow_call:
|
| 9 |
+
inputs:
|
| 10 |
+
image_postfix:
|
| 11 |
+
required: true
|
| 12 |
+
type: string
|
| 13 |
+
schedule:
|
| 14 |
+
- cron: "17 0 * * *"
|
| 15 |
+
|
| 16 |
+
concurrency:
|
| 17 |
+
group: docker-images-builds
|
| 18 |
+
cancel-in-progress: false
|
| 19 |
+
|
| 20 |
+
jobs:
|
| 21 |
+
latest-docker:
|
| 22 |
+
name: "Latest PyTorch + TensorFlow [dev]"
|
| 23 |
+
runs-on: [intel-cpu, 8-cpu, ci]
|
| 24 |
+
steps:
|
| 25 |
+
-
|
| 26 |
+
name: Set up Docker Buildx
|
| 27 |
+
uses: docker/setup-buildx-action@v3
|
| 28 |
+
-
|
| 29 |
+
name: Check out code
|
| 30 |
+
uses: actions/checkout@v3
|
| 31 |
+
-
|
| 32 |
+
name: Login to DockerHub
|
| 33 |
+
uses: docker/login-action@v3
|
| 34 |
+
with:
|
| 35 |
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
| 36 |
+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
| 37 |
+
-
|
| 38 |
+
name: Build and push
|
| 39 |
+
uses: docker/build-push-action@v5
|
| 40 |
+
with:
|
| 41 |
+
context: ./docker/transformers-all-latest-gpu
|
| 42 |
+
build-args: |
|
| 43 |
+
REF=main
|
| 44 |
+
push: true
|
| 45 |
+
tags: huggingface/transformers-all-latest-gpu${{ inputs.image_postfix }}
|
| 46 |
+
# Push CI images still need to be re-built daily
|
| 47 |
+
-
|
| 48 |
+
name: Build and push (for Push CI) in a daily basis
|
| 49 |
+
# This condition allows `schedule` events, or `push` events that trigger this workflow NOT via `workflow_call`.
|
| 50 |
+
# The later case is useful for manual image building for debugging purpose. Use another tag in this case!
|
| 51 |
+
if: inputs.image_postfix != '-push-ci'
|
| 52 |
+
uses: docker/build-push-action@v5
|
| 53 |
+
with:
|
| 54 |
+
context: ./docker/transformers-all-latest-gpu
|
| 55 |
+
build-args: |
|
| 56 |
+
REF=main
|
| 57 |
+
push: true
|
| 58 |
+
tags: huggingface/transformers-all-latest-gpu-push-ci
|
| 59 |
+
|
| 60 |
+
latest-torch-deepspeed-docker:
|
| 61 |
+
name: "Latest PyTorch + DeepSpeed"
|
| 62 |
+
runs-on: [intel-cpu, 8-cpu, ci]
|
| 63 |
+
steps:
|
| 64 |
+
- name: Cleanup disk
|
| 65 |
+
run: |
|
| 66 |
+
sudo ls -l /usr/local/lib/
|
| 67 |
+
sudo ls -l /usr/share/
|
| 68 |
+
sudo du -sh /usr/local/lib/
|
| 69 |
+
sudo du -sh /usr/share/
|
| 70 |
+
sudo rm -rf /usr/local/lib/android
|
| 71 |
+
sudo rm -rf /usr/share/dotnet
|
| 72 |
+
sudo du -sh /usr/local/lib/
|
| 73 |
+
sudo du -sh /usr/share/
|
| 74 |
+
-
|
| 75 |
+
name: Set up Docker Buildx
|
| 76 |
+
uses: docker/setup-buildx-action@v3
|
| 77 |
+
-
|
| 78 |
+
name: Check out code
|
| 79 |
+
uses: actions/checkout@v3
|
| 80 |
+
-
|
| 81 |
+
name: Login to DockerHub
|
| 82 |
+
uses: docker/login-action@v3
|
| 83 |
+
with:
|
| 84 |
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
| 85 |
+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
| 86 |
+
-
|
| 87 |
+
name: Build and push
|
| 88 |
+
uses: docker/build-push-action@v5
|
| 89 |
+
with:
|
| 90 |
+
context: ./docker/transformers-pytorch-deepspeed-latest-gpu
|
| 91 |
+
build-args: |
|
| 92 |
+
REF=main
|
| 93 |
+
push: true
|
| 94 |
+
tags: huggingface/transformers-pytorch-deepspeed-latest-gpu${{ inputs.image_postfix }}
|
| 95 |
+
|
| 96 |
+
# Can't build 2 images in a single job `latest-torch-deepspeed-docker` (for `nvcr.io/nvidia`)
|
| 97 |
+
latest-torch-deepspeed-docker-for-push-ci-daily-build:
|
| 98 |
+
name: "Latest PyTorch + DeepSpeed (Push CI - Daily Build)"
|
| 99 |
+
runs-on: [intel-cpu, 8-cpu, ci]
|
| 100 |
+
steps:
|
| 101 |
+
- name: Cleanup disk
|
| 102 |
+
run: |
|
| 103 |
+
sudo ls -l /usr/local/lib/
|
| 104 |
+
sudo ls -l /usr/share/
|
| 105 |
+
sudo du -sh /usr/local/lib/
|
| 106 |
+
sudo du -sh /usr/share/
|
| 107 |
+
sudo rm -rf /usr/local/lib/android
|
| 108 |
+
sudo rm -rf /usr/share/dotnet
|
| 109 |
+
sudo du -sh /usr/local/lib/
|
| 110 |
+
sudo du -sh /usr/share/
|
| 111 |
+
-
|
| 112 |
+
name: Set up Docker Buildx
|
| 113 |
+
uses: docker/setup-buildx-action@v3
|
| 114 |
+
-
|
| 115 |
+
name: Check out code
|
| 116 |
+
uses: actions/checkout@v3
|
| 117 |
+
-
|
| 118 |
+
name: Login to DockerHub
|
| 119 |
+
uses: docker/login-action@v3
|
| 120 |
+
with:
|
| 121 |
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
| 122 |
+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
| 123 |
+
# Push CI images still need to be re-built daily
|
| 124 |
+
-
|
| 125 |
+
name: Build and push (for Push CI) in a daily basis
|
| 126 |
+
# This condition allows `schedule` events, or `push` events that trigger this workflow NOT via `workflow_call`.
|
| 127 |
+
# The later case is useful for manual image building for debugging purpose. Use another tag in this case!
|
| 128 |
+
if: inputs.image_postfix != '-push-ci'
|
| 129 |
+
uses: docker/build-push-action@v5
|
| 130 |
+
with:
|
| 131 |
+
context: ./docker/transformers-pytorch-deepspeed-latest-gpu
|
| 132 |
+
build-args: |
|
| 133 |
+
REF=main
|
| 134 |
+
push: true
|
| 135 |
+
tags: huggingface/transformers-pytorch-deepspeed-latest-gpu-push-ci
|
| 136 |
+
|
| 137 |
+
doc-builder:
|
| 138 |
+
name: "Doc builder"
|
| 139 |
+
# Push CI doesn't need this image
|
| 140 |
+
if: inputs.image_postfix != '-push-ci'
|
| 141 |
+
runs-on: [intel-cpu, 8-cpu, ci]
|
| 142 |
+
steps:
|
| 143 |
+
-
|
| 144 |
+
name: Set up Docker Buildx
|
| 145 |
+
uses: docker/setup-buildx-action@v3
|
| 146 |
+
-
|
| 147 |
+
name: Check out code
|
| 148 |
+
uses: actions/checkout@v3
|
| 149 |
+
-
|
| 150 |
+
name: Login to DockerHub
|
| 151 |
+
uses: docker/login-action@v3
|
| 152 |
+
with:
|
| 153 |
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
| 154 |
+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
| 155 |
+
-
|
| 156 |
+
name: Build and push
|
| 157 |
+
uses: docker/build-push-action@v5
|
| 158 |
+
with:
|
| 159 |
+
context: ./docker/transformers-doc-builder
|
| 160 |
+
push: true
|
| 161 |
+
tags: huggingface/transformers-doc-builder
|
| 162 |
+
|
| 163 |
+
latest-pytorch:
|
| 164 |
+
name: "Latest PyTorch [dev]"
|
| 165 |
+
# Push CI doesn't need this image
|
| 166 |
+
if: inputs.image_postfix != '-push-ci'
|
| 167 |
+
runs-on: [intel-cpu, 8-cpu, ci]
|
| 168 |
+
steps:
|
| 169 |
+
- name: Cleanup disk
|
| 170 |
+
run: |
|
| 171 |
+
sudo ls -l /usr/local/lib/
|
| 172 |
+
sudo ls -l /usr/share/
|
| 173 |
+
sudo du -sh /usr/local/lib/
|
| 174 |
+
sudo du -sh /usr/share/
|
| 175 |
+
sudo rm -rf /usr/local/lib/android
|
| 176 |
+
sudo rm -rf /usr/share/dotnet
|
| 177 |
+
sudo du -sh /usr/local/lib/
|
| 178 |
+
sudo du -sh /usr/share/
|
| 179 |
+
-
|
| 180 |
+
name: Set up Docker Buildx
|
| 181 |
+
uses: docker/setup-buildx-action@v3
|
| 182 |
+
-
|
| 183 |
+
name: Check out code
|
| 184 |
+
uses: actions/checkout@v3
|
| 185 |
+
-
|
| 186 |
+
name: Login to DockerHub
|
| 187 |
+
uses: docker/login-action@v3
|
| 188 |
+
with:
|
| 189 |
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
| 190 |
+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
| 191 |
+
-
|
| 192 |
+
name: Build and push
|
| 193 |
+
uses: docker/build-push-action@v5
|
| 194 |
+
with:
|
| 195 |
+
context: ./docker/transformers-pytorch-gpu
|
| 196 |
+
build-args: |
|
| 197 |
+
REF=main
|
| 198 |
+
push: true
|
| 199 |
+
tags: huggingface/transformers-pytorch-gpu
|
| 200 |
+
|
| 201 |
+
latest-pytorch-amd:
|
| 202 |
+
name: "Latest PyTorch (AMD) [dev]"
|
| 203 |
+
runs-on: [intel-cpu, 8-cpu, ci]
|
| 204 |
+
steps:
|
| 205 |
+
-
|
| 206 |
+
name: Set up Docker Buildx
|
| 207 |
+
uses: docker/setup-buildx-action@v3
|
| 208 |
+
-
|
| 209 |
+
name: Check out code
|
| 210 |
+
uses: actions/checkout@v3
|
| 211 |
+
-
|
| 212 |
+
name: Login to DockerHub
|
| 213 |
+
uses: docker/login-action@v3
|
| 214 |
+
with:
|
| 215 |
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
| 216 |
+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
| 217 |
+
-
|
| 218 |
+
name: Build and push
|
| 219 |
+
uses: docker/build-push-action@v5
|
| 220 |
+
with:
|
| 221 |
+
context: ./docker/transformers-pytorch-amd-gpu
|
| 222 |
+
build-args: |
|
| 223 |
+
REF=main
|
| 224 |
+
push: true
|
| 225 |
+
tags: huggingface/transformers-pytorch-amd-gpu${{ inputs.image_postfix }}
|
| 226 |
+
# Push CI images still need to be re-built daily
|
| 227 |
+
-
|
| 228 |
+
name: Build and push (for Push CI) in a daily basis
|
| 229 |
+
# This condition allows `schedule` events, or `push` events that trigger this workflow NOT via `workflow_call`.
|
| 230 |
+
# The later case is useful for manual image building for debugging purpose. Use another tag in this case!
|
| 231 |
+
if: inputs.image_postfix != '-push-ci'
|
| 232 |
+
uses: docker/build-push-action@v5
|
| 233 |
+
with:
|
| 234 |
+
context: ./docker/transformers-pytorch-amd-gpu
|
| 235 |
+
build-args: |
|
| 236 |
+
REF=main
|
| 237 |
+
push: true
|
| 238 |
+
tags: huggingface/transformers-pytorch-amd-gpu-push-ci
|
| 239 |
+
|
| 240 |
+
latest-tensorflow:
|
| 241 |
+
name: "Latest TensorFlow [dev]"
|
| 242 |
+
# Push CI doesn't need this image
|
| 243 |
+
if: inputs.image_postfix != '-push-ci'
|
| 244 |
+
runs-on: [intel-cpu, 8-cpu, ci]
|
| 245 |
+
steps:
|
| 246 |
+
-
|
| 247 |
+
name: Set up Docker Buildx
|
| 248 |
+
uses: docker/setup-buildx-action@v3
|
| 249 |
+
-
|
| 250 |
+
name: Check out code
|
| 251 |
+
uses: actions/checkout@v3
|
| 252 |
+
-
|
| 253 |
+
name: Login to DockerHub
|
| 254 |
+
uses: docker/login-action@v3
|
| 255 |
+
with:
|
| 256 |
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
| 257 |
+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
| 258 |
+
-
|
| 259 |
+
name: Build and push
|
| 260 |
+
uses: docker/build-push-action@v5
|
| 261 |
+
with:
|
| 262 |
+
context: ./docker/transformers-tensorflow-gpu
|
| 263 |
+
build-args: |
|
| 264 |
+
REF=main
|
| 265 |
+
push: true
|
| 266 |
+
tags: huggingface/transformers-tensorflow-gpu
|
| 267 |
+
|
| 268 |
+
latest-pytorch-deepspeed-amd:
|
| 269 |
+
name: "PyTorch + DeepSpeed (AMD) [dev]"
|
| 270 |
+
runs-on: [intel-cpu, 8-cpu, ci]
|
| 271 |
+
steps:
|
| 272 |
+
-
|
| 273 |
+
name: Set up Docker Buildx
|
| 274 |
+
uses: docker/setup-buildx-action@v3
|
| 275 |
+
-
|
| 276 |
+
name: Check out code
|
| 277 |
+
uses: actions/checkout@v3
|
| 278 |
+
-
|
| 279 |
+
name: Login to DockerHub
|
| 280 |
+
uses: docker/login-action@v3
|
| 281 |
+
with:
|
| 282 |
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
| 283 |
+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
| 284 |
+
-
|
| 285 |
+
name: Build and push
|
| 286 |
+
uses: docker/build-push-action@v5
|
| 287 |
+
with:
|
| 288 |
+
context: ./docker/transformers-pytorch-deepspeed-amd-gpu
|
| 289 |
+
build-args: |
|
| 290 |
+
REF=main
|
| 291 |
+
push: true
|
| 292 |
+
tags: huggingface/transformers-pytorch-deepspeed-amd-gpu${{ inputs.image_postfix }}
|
| 293 |
+
# Push CI images still need to be re-built daily
|
| 294 |
+
-
|
| 295 |
+
name: Build and push (for Push CI) in a daily basis
|
| 296 |
+
# This condition allows `schedule` events, or `push` events that trigger this workflow NOT via `workflow_call`.
|
| 297 |
+
# The later case is useful for manual image building for debugging purpose. Use another tag in this case!
|
| 298 |
+
if: inputs.image_postfix != '-push-ci'
|
| 299 |
+
uses: docker/build-push-action@v5
|
| 300 |
+
with:
|
| 301 |
+
context: ./docker/transformers-pytorch-deepspeed-amd-gpu
|
| 302 |
+
build-args: |
|
| 303 |
+
REF=main
|
| 304 |
+
push: true
|
| 305 |
+
tags: huggingface/transformers-pytorch-deepspeed-amd-gpu-push-ci
|
| 306 |
+
|
| 307 |
+
latest-quantization-torch-docker:
|
| 308 |
+
name: "Latest Pytorch + Quantization [dev]"
|
| 309 |
+
# Push CI doesn't need this image
|
| 310 |
+
if: inputs.image_postfix != '-push-ci'
|
| 311 |
+
runs-on: [intel-cpu, 8-cpu, ci]
|
| 312 |
+
steps:
|
| 313 |
+
-
|
| 314 |
+
name: Set up Docker Buildx
|
| 315 |
+
uses: docker/setup-buildx-action@v3
|
| 316 |
+
-
|
| 317 |
+
name: Check out code
|
| 318 |
+
uses: actions/checkout@v3
|
| 319 |
+
-
|
| 320 |
+
name: Login to DockerHub
|
| 321 |
+
uses: docker/login-action@v3
|
| 322 |
+
with:
|
| 323 |
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
| 324 |
+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
| 325 |
+
-
|
| 326 |
+
name: Build and push
|
| 327 |
+
uses: docker/build-push-action@v5
|
| 328 |
+
with:
|
| 329 |
+
context: ./docker/transformers-quantization-latest-gpu
|
| 330 |
+
build-args: |
|
| 331 |
+
REF=main
|
| 332 |
+
push: true
|
| 333 |
+
tags: huggingface/transformers-quantization-latest-gpu${{ inputs.image_postfix }}
|
transformers/.github/workflows/build-nightly-ci-docker-images.yml
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Build docker images (Nightly CI)
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
workflow_call:
|
| 5 |
+
push:
|
| 6 |
+
branches:
|
| 7 |
+
- build_nightly_ci_docker_image*
|
| 8 |
+
|
| 9 |
+
concurrency:
|
| 10 |
+
group: docker-images-builds
|
| 11 |
+
cancel-in-progress: false
|
| 12 |
+
|
| 13 |
+
jobs:
|
| 14 |
+
latest-with-torch-nightly-docker:
|
| 15 |
+
name: "Nightly PyTorch + Stable TensorFlow"
|
| 16 |
+
runs-on: ubuntu-22.04
|
| 17 |
+
steps:
|
| 18 |
+
- name: Cleanup disk
|
| 19 |
+
run: |
|
| 20 |
+
sudo ls -l /usr/local/lib/
|
| 21 |
+
sudo ls -l /usr/share/
|
| 22 |
+
sudo du -sh /usr/local/lib/
|
| 23 |
+
sudo du -sh /usr/share/
|
| 24 |
+
sudo rm -rf /usr/local/lib/android
|
| 25 |
+
sudo rm -rf /usr/share/dotnet
|
| 26 |
+
sudo du -sh /usr/local/lib/
|
| 27 |
+
sudo du -sh /usr/share/
|
| 28 |
+
-
|
| 29 |
+
name: Set up Docker Buildx
|
| 30 |
+
uses: docker/setup-buildx-action@v2
|
| 31 |
+
-
|
| 32 |
+
name: Check out code
|
| 33 |
+
uses: actions/checkout@v3
|
| 34 |
+
-
|
| 35 |
+
name: Login to DockerHub
|
| 36 |
+
uses: docker/login-action@v2
|
| 37 |
+
with:
|
| 38 |
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
| 39 |
+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
| 40 |
+
-
|
| 41 |
+
name: Build and push
|
| 42 |
+
uses: docker/build-push-action@v3
|
| 43 |
+
with:
|
| 44 |
+
context: ./docker/transformers-all-latest-gpu
|
| 45 |
+
build-args: |
|
| 46 |
+
REF=main
|
| 47 |
+
PYTORCH=pre
|
| 48 |
+
push: true
|
| 49 |
+
tags: huggingface/transformers-all-latest-torch-nightly-gpu
|
| 50 |
+
|
| 51 |
+
nightly-torch-deepspeed-docker:
|
| 52 |
+
name: "Nightly PyTorch + DeepSpeed"
|
| 53 |
+
runs-on: ubuntu-22.04
|
| 54 |
+
steps:
|
| 55 |
+
- name: Cleanup disk
|
| 56 |
+
run: |
|
| 57 |
+
sudo ls -l /usr/local/lib/
|
| 58 |
+
sudo ls -l /usr/share/
|
| 59 |
+
sudo du -sh /usr/local/lib/
|
| 60 |
+
sudo du -sh /usr/share/
|
| 61 |
+
sudo rm -rf /usr/local/lib/android
|
| 62 |
+
sudo rm -rf /usr/share/dotnet
|
| 63 |
+
sudo du -sh /usr/local/lib/
|
| 64 |
+
sudo du -sh /usr/share/
|
| 65 |
+
-
|
| 66 |
+
name: Set up Docker Buildx
|
| 67 |
+
uses: docker/setup-buildx-action@v2
|
| 68 |
+
-
|
| 69 |
+
name: Check out code
|
| 70 |
+
uses: actions/checkout@v3
|
| 71 |
+
-
|
| 72 |
+
name: Login to DockerHub
|
| 73 |
+
uses: docker/login-action@v2
|
| 74 |
+
with:
|
| 75 |
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
| 76 |
+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
| 77 |
+
-
|
| 78 |
+
name: Build and push
|
| 79 |
+
uses: docker/build-push-action@v3
|
| 80 |
+
with:
|
| 81 |
+
context: ./docker/transformers-pytorch-deepspeed-nightly-gpu
|
| 82 |
+
build-args: |
|
| 83 |
+
REF=main
|
| 84 |
+
push: true
|
| 85 |
+
tags: huggingface/transformers-pytorch-deepspeed-nightly-gpu
|
transformers/.github/workflows/build-past-ci-docker-images.yml
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Build docker images (Past CI)
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches:
|
| 6 |
+
- build_past_ci_docker_image*
|
| 7 |
+
|
| 8 |
+
concurrency:
|
| 9 |
+
group: docker-images-builds
|
| 10 |
+
cancel-in-progress: false
|
| 11 |
+
|
| 12 |
+
jobs:
|
| 13 |
+
past-pytorch-docker:
|
| 14 |
+
name: "Past PyTorch Docker"
|
| 15 |
+
strategy:
|
| 16 |
+
fail-fast: false
|
| 17 |
+
matrix:
|
| 18 |
+
version: ["1.13", "1.12", "1.11"]
|
| 19 |
+
runs-on: ubuntu-22.04
|
| 20 |
+
steps:
|
| 21 |
+
-
|
| 22 |
+
name: Set up Docker Buildx
|
| 23 |
+
uses: docker/setup-buildx-action@v2
|
| 24 |
+
-
|
| 25 |
+
name: Check out code
|
| 26 |
+
uses: actions/checkout@v3
|
| 27 |
+
-
|
| 28 |
+
id: get-base-image
|
| 29 |
+
name: Get Base Image
|
| 30 |
+
env:
|
| 31 |
+
framework_version: ${{ matrix.version }}
|
| 32 |
+
run: |
|
| 33 |
+
echo "base_image=$(python3 -c 'import os; from utils.past_ci_versions import past_versions_testing; base_image = past_versions_testing["pytorch"][os.environ["framework_version"]]["base_image"]; print(base_image)')" >> $GITHUB_OUTPUT
|
| 34 |
+
-
|
| 35 |
+
name: Print Base Image
|
| 36 |
+
run: |
|
| 37 |
+
echo ${{ steps.get-base-image.outputs.base_image }}
|
| 38 |
+
-
|
| 39 |
+
name: Login to DockerHub
|
| 40 |
+
uses: docker/login-action@v2
|
| 41 |
+
with:
|
| 42 |
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
| 43 |
+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
| 44 |
+
-
|
| 45 |
+
name: Build and push
|
| 46 |
+
uses: docker/build-push-action@v3
|
| 47 |
+
with:
|
| 48 |
+
context: ./docker/transformers-past-gpu
|
| 49 |
+
build-args: |
|
| 50 |
+
REF=main
|
| 51 |
+
BASE_DOCKER_IMAGE=${{ steps.get-base-image.outputs.base_image }}
|
| 52 |
+
FRAMEWORK=pytorch
|
| 53 |
+
VERSION=${{ matrix.version }}
|
| 54 |
+
push: true
|
| 55 |
+
tags: huggingface/transformers-pytorch-past-${{ matrix.version }}-gpu
|
| 56 |
+
|
| 57 |
+
past-tensorflow-docker:
|
| 58 |
+
name: "Past TensorFlow Docker"
|
| 59 |
+
strategy:
|
| 60 |
+
fail-fast: false
|
| 61 |
+
matrix:
|
| 62 |
+
version: ["2.11", "2.10", "2.9", "2.8", "2.7", "2.6", "2.5"]
|
| 63 |
+
runs-on: ubuntu-22.04
|
| 64 |
+
steps:
|
| 65 |
+
-
|
| 66 |
+
name: Set up Docker Buildx
|
| 67 |
+
uses: docker/setup-buildx-action@v2
|
| 68 |
+
-
|
| 69 |
+
name: Check out code
|
| 70 |
+
uses: actions/checkout@v3
|
| 71 |
+
-
|
| 72 |
+
id: get-base-image
|
| 73 |
+
name: Get Base Image
|
| 74 |
+
env:
|
| 75 |
+
framework_version: ${{ matrix.version }}
|
| 76 |
+
run: |
|
| 77 |
+
echo "base_image=$(python3 -c 'import os; from utils.past_ci_versions import past_versions_testing; base_image = past_versions_testing["tensorflow"][os.environ["framework_version"]]["base_image"]; print(base_image)')" >> $GITHUB_OUTPUT
|
| 78 |
+
-
|
| 79 |
+
name: Print Base Image
|
| 80 |
+
run: |
|
| 81 |
+
echo ${{ steps.get-base-image.outputs.base_image }}
|
| 82 |
+
-
|
| 83 |
+
name: Login to DockerHub
|
| 84 |
+
uses: docker/login-action@v2
|
| 85 |
+
with:
|
| 86 |
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
| 87 |
+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
| 88 |
+
-
|
| 89 |
+
name: Build and push
|
| 90 |
+
uses: docker/build-push-action@v3
|
| 91 |
+
with:
|
| 92 |
+
context: ./docker/transformers-past-gpu
|
| 93 |
+
build-args: |
|
| 94 |
+
REF=main
|
| 95 |
+
BASE_DOCKER_IMAGE=${{ steps.get-base-image.outputs.base_image }}
|
| 96 |
+
FRAMEWORK=tensorflow
|
| 97 |
+
VERSION=${{ matrix.version }}
|
| 98 |
+
push: true
|
| 99 |
+
tags: huggingface/transformers-tensorflow-past-${{ matrix.version }}-gpu
|
transformers/.github/workflows/build_documentation.yml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Build documentation
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches:
|
| 6 |
+
- main
|
| 7 |
+
- doc-builder*
|
| 8 |
+
- v*-release
|
| 9 |
+
- use_templates
|
| 10 |
+
|
| 11 |
+
jobs:
|
| 12 |
+
build:
|
| 13 |
+
uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@main
|
| 14 |
+
with:
|
| 15 |
+
commit_sha: ${{ github.sha }}
|
| 16 |
+
package: transformers
|
| 17 |
+
notebook_folder: transformers_doc
|
| 18 |
+
languages: de en es fr hi it ko pt tr zh ja te
|
| 19 |
+
custom_container: huggingface/transformers-doc-builder
|
| 20 |
+
secrets:
|
| 21 |
+
token: ${{ secrets.HUGGINGFACE_PUSH }}
|
| 22 |
+
hf_token: ${{ secrets.HF_DOC_BUILD_PUSH }}
|
transformers/.github/workflows/build_pr_documentation.yml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Build PR Documentation
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
pull_request:
|
| 5 |
+
|
| 6 |
+
concurrency:
|
| 7 |
+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
| 8 |
+
cancel-in-progress: true
|
| 9 |
+
|
| 10 |
+
jobs:
|
| 11 |
+
build:
|
| 12 |
+
uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@main
|
| 13 |
+
with:
|
| 14 |
+
commit_sha: ${{ github.event.pull_request.head.sha }}
|
| 15 |
+
pr_number: ${{ github.event.number }}
|
| 16 |
+
package: transformers
|
| 17 |
+
languages: de en es fr hi it ko pt tr zh ja te
|
| 18 |
+
custom_container: huggingface/transformers-doc-builder
|
transformers/.github/workflows/check_tiny_models.yml
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Check Tiny Models
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches:
|
| 6 |
+
- check_tiny_models*
|
| 7 |
+
repository_dispatch:
|
| 8 |
+
schedule:
|
| 9 |
+
- cron: "0 2 * * *"
|
| 10 |
+
|
| 11 |
+
env:
|
| 12 |
+
TOKEN: ${{ secrets.TRANSFORMERS_HUB_BOT_HF_TOKEN }}
|
| 13 |
+
|
| 14 |
+
jobs:
|
| 15 |
+
check_tiny_models:
|
| 16 |
+
name: Check tiny models
|
| 17 |
+
runs-on: ubuntu-22.04
|
| 18 |
+
steps:
|
| 19 |
+
- name: Checkout transformers
|
| 20 |
+
uses: actions/checkout@v3
|
| 21 |
+
with:
|
| 22 |
+
fetch-depth: 2
|
| 23 |
+
|
| 24 |
+
- uses: actions/checkout@v3
|
| 25 |
+
- name: Set up Python 3.8
|
| 26 |
+
uses: actions/setup-python@v4
|
| 27 |
+
with:
|
| 28 |
+
# Semantic version range syntax or exact version of a Python version
|
| 29 |
+
python-version: '3.8'
|
| 30 |
+
# Optional - x64 or x86 architecture, defaults to x64
|
| 31 |
+
architecture: 'x64'
|
| 32 |
+
|
| 33 |
+
- name: Install
|
| 34 |
+
run: |
|
| 35 |
+
sudo apt-get -y update && sudo apt-get install -y libsndfile1-dev espeak-ng cmake
|
| 36 |
+
pip install --upgrade pip
|
| 37 |
+
python -m pip install -U .[sklearn,torch,testing,sentencepiece,torch-speech,vision,timm,video,tf-cpu]
|
| 38 |
+
pip install tensorflow_probability
|
| 39 |
+
python -m pip install -U 'natten<0.15.0'
|
| 40 |
+
|
| 41 |
+
- name: Create all tiny models (locally)
|
| 42 |
+
run: |
|
| 43 |
+
python utils/create_dummy_models.py tiny_local_models --all --num_workers 2
|
| 44 |
+
|
| 45 |
+
- name: Local tiny model reports artifacts
|
| 46 |
+
if: ${{ always() }}
|
| 47 |
+
uses: actions/upload-artifact@v3
|
| 48 |
+
with:
|
| 49 |
+
name: tiny_local_model_creation_reports
|
| 50 |
+
path: tiny_local_models/reports
|
| 51 |
+
|
| 52 |
+
# GitHub-hosted runners have 2-core CPUs
|
| 53 |
+
- name: Run pipeline tests against all new (local) tiny models
|
| 54 |
+
run: |
|
| 55 |
+
OMP_NUM_THREADS=1 TRANSFORMERS_TINY_MODEL_PATH=tiny_local_models python -m pytest --max-worker-restart=0 -n 2 --dist=loadfile -s -rA --make-reports=tests_pipelines tests/models -m is_pipeline_test -k "test_pipeline_" | tee tests_output.txt
|
| 56 |
+
|
| 57 |
+
- name: Test suite reports artifacts
|
| 58 |
+
if: ${{ always() }}
|
| 59 |
+
uses: actions/upload-artifact@v3
|
| 60 |
+
with:
|
| 61 |
+
name: tiny_local_model_creation_reports
|
| 62 |
+
path: reports/tests_pipelines
|
| 63 |
+
|
| 64 |
+
- name: Create + Upload tiny models for new model architecture(s)
|
| 65 |
+
run: |
|
| 66 |
+
python utils/update_tiny_models.py --num_workers 2
|
| 67 |
+
|
| 68 |
+
- name: Full report
|
| 69 |
+
run: cat tiny_models/reports/tiny_model_creation_report.json
|
| 70 |
+
|
| 71 |
+
- name: Failure report
|
| 72 |
+
run: cat tiny_models/reports/simple_failed_report.txt
|
| 73 |
+
|
| 74 |
+
- name: Summary report
|
| 75 |
+
run: cat tiny_models/reports/tiny_model_summary.json
|
| 76 |
+
|
| 77 |
+
- name: New tiny model creation reports artifacts
|
| 78 |
+
if: ${{ always() }}
|
| 79 |
+
uses: actions/upload-artifact@v3
|
| 80 |
+
with:
|
| 81 |
+
name: tiny_model_creation_reports
|
| 82 |
+
path: tiny_models/reports
|
transformers/.github/workflows/doctests.yml
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Doctests
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches:
|
| 6 |
+
- doctest*
|
| 7 |
+
repository_dispatch:
|
| 8 |
+
schedule:
|
| 9 |
+
- cron: "17 2 * * *"
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
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
|
| 20 |
+
|
| 21 |
+
jobs:
|
| 22 |
+
run_doctests:
|
| 23 |
+
runs-on: [single-gpu, nvidia-gpu, t4, ci]
|
| 24 |
+
container:
|
| 25 |
+
image: huggingface/transformers-all-latest-gpu
|
| 26 |
+
options: --gpus 0 --shm-size "16gb" --ipc host -v /mnt/cache/.cache/huggingface:/mnt/cache/
|
| 27 |
+
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
|
| 33 |
+
run: |
|
| 34 |
+
nvidia-smi
|
| 35 |
+
|
| 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
|
| 42 |
+
|
| 43 |
+
- name: Show installed libraries and their versions
|
| 44 |
+
run: pip freeze
|
| 45 |
+
|
| 46 |
+
- name: Get doctest files
|
| 47 |
+
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()')
|
| 49 |
+
|
| 50 |
+
- name: Run doctests
|
| 51 |
+
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
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
send_results:
|
| 68 |
+
name: Send results to webhook
|
| 69 |
+
runs-on: ubuntu-22.04
|
| 70 |
+
if: always()
|
| 71 |
+
needs: [run_doctests]
|
| 72 |
+
steps:
|
| 73 |
+
- uses: actions/checkout@v3
|
| 74 |
+
- uses: actions/download-artifact@v3
|
| 75 |
+
- name: Send message to Slack
|
| 76 |
+
env:
|
| 77 |
+
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 }}
|
| 81 |
+
run: |
|
| 82 |
+
pip install slack_sdk
|
| 83 |
+
python utils/notification_service_doc_tests.py
|
transformers/.github/workflows/model-templates.yml
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Model templates runner
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
repository_dispatch:
|
| 5 |
+
schedule:
|
| 6 |
+
- cron: "0 2 * * *"
|
| 7 |
+
|
| 8 |
+
jobs:
|
| 9 |
+
run_tests_templates:
|
| 10 |
+
runs-on: ubuntu-22.04
|
| 11 |
+
steps:
|
| 12 |
+
- name: Checkout repository
|
| 13 |
+
uses: actions/checkout@v3
|
| 14 |
+
|
| 15 |
+
- name: Install dependencies
|
| 16 |
+
run: |
|
| 17 |
+
sudo apt -y update && sudo apt install -y libsndfile1-dev
|
| 18 |
+
|
| 19 |
+
- name: Load cached virtual environment
|
| 20 |
+
uses: actions/cache@v2
|
| 21 |
+
id: cache
|
| 22 |
+
with:
|
| 23 |
+
path: ~/venv/
|
| 24 |
+
key: v4-tests_templates-${{ hashFiles('setup.py') }}
|
| 25 |
+
|
| 26 |
+
- name: Create virtual environment on cache miss
|
| 27 |
+
if: steps.cache.outputs.cache-hit != 'true'
|
| 28 |
+
run: |
|
| 29 |
+
python -m venv ~/venv && . ~/venv/bin/activate
|
| 30 |
+
pip install --upgrade pip!=21.3
|
| 31 |
+
pip install -e .[dev]
|
| 32 |
+
|
| 33 |
+
- name: Check transformers location
|
| 34 |
+
# make `transformers` available as package (required since we use `-e` flag) and check it's indeed from the repo.
|
| 35 |
+
run: |
|
| 36 |
+
. ~/venv/bin/activate
|
| 37 |
+
python setup.py develop
|
| 38 |
+
transformer_loc=$(pip show transformers | grep "Location: " | cut -c11-)
|
| 39 |
+
transformer_repo_loc=$(pwd .)
|
| 40 |
+
if [ "$transformer_loc" != "$transformer_repo_loc/src" ]; then
|
| 41 |
+
echo "transformers is from $transformer_loc but it shoud be from $transformer_repo_loc/src."
|
| 42 |
+
echo "A fix is required. Stop testing."
|
| 43 |
+
exit 1
|
| 44 |
+
fi
|
| 45 |
+
|
| 46 |
+
- name: Create model files
|
| 47 |
+
run: |
|
| 48 |
+
. ~/venv/bin/activate
|
| 49 |
+
transformers-cli add-new-model --testing --testing_file=templates/adding_a_new_model/tests/encoder-bert-tokenizer.json --path=templates/adding_a_new_model
|
| 50 |
+
transformers-cli add-new-model --testing --testing_file=templates/adding_a_new_model/tests/pt-encoder-bert-tokenizer.json --path=templates/adding_a_new_model
|
| 51 |
+
transformers-cli add-new-model --testing --testing_file=templates/adding_a_new_model/tests/standalone.json --path=templates/adding_a_new_model
|
| 52 |
+
transformers-cli add-new-model --testing --testing_file=templates/adding_a_new_model/tests/tf-encoder-bert-tokenizer.json --path=templates/adding_a_new_model
|
| 53 |
+
transformers-cli add-new-model --testing --testing_file=templates/adding_a_new_model/tests/tf-seq-2-seq-bart-tokenizer.json --path=templates/adding_a_new_model
|
| 54 |
+
transformers-cli add-new-model --testing --testing_file=templates/adding_a_new_model/tests/pt-seq-2-seq-bart-tokenizer.json --path=templates/adding_a_new_model
|
| 55 |
+
transformers-cli add-new-model --testing --testing_file=templates/adding_a_new_model/tests/flax-encoder-bert-tokenizer.json --path=templates/adding_a_new_model
|
| 56 |
+
transformers-cli add-new-model --testing --testing_file=templates/adding_a_new_model/tests/flax-seq-2-seq-bart-tokenizer.json --path=templates/adding_a_new_model
|
| 57 |
+
make style
|
| 58 |
+
python utils/check_table.py --fix_and_overwrite
|
| 59 |
+
python utils/check_dummies.py --fix_and_overwrite
|
| 60 |
+
python utils/check_copies.py --fix_and_overwrite
|
| 61 |
+
|
| 62 |
+
- name: Run all non-slow tests
|
| 63 |
+
run: |
|
| 64 |
+
. ~/venv/bin/activate
|
| 65 |
+
python -m pytest -n 2 --dist=loadfile -s --make-reports=tests_templates tests/*template*
|
| 66 |
+
|
| 67 |
+
- name: Run style changes
|
| 68 |
+
run: |
|
| 69 |
+
. ~/venv/bin/activate
|
| 70 |
+
make style && make quality && make repo-consistency
|
| 71 |
+
|
| 72 |
+
- name: Failure short reports
|
| 73 |
+
if: ${{ always() }}
|
| 74 |
+
run: cat reports/tests_templates/failures_short.txt
|
| 75 |
+
|
| 76 |
+
- name: Test suite reports artifacts
|
| 77 |
+
if: ${{ always() }}
|
| 78 |
+
uses: actions/upload-artifact@v3
|
| 79 |
+
with:
|
| 80 |
+
name: run_all_tests_templates_test_reports
|
| 81 |
+
path: reports/tests_templates
|
transformers/.github/workflows/model_jobs.yml
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: model jobs
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
workflow_call:
|
| 5 |
+
inputs:
|
| 6 |
+
folder_slices:
|
| 7 |
+
required: true
|
| 8 |
+
type: string
|
| 9 |
+
machine_type:
|
| 10 |
+
required: true
|
| 11 |
+
type: string
|
| 12 |
+
slice_id:
|
| 13 |
+
required: true
|
| 14 |
+
type: number
|
| 15 |
+
|
| 16 |
+
env:
|
| 17 |
+
HF_HOME: /mnt/cache
|
| 18 |
+
TRANSFORMERS_IS_CI: yes
|
| 19 |
+
OMP_NUM_THREADS: 8
|
| 20 |
+
MKL_NUM_THREADS: 8
|
| 21 |
+
RUN_SLOW: yes
|
| 22 |
+
# For gated repositories, we still need to agree to share information on the Hub repo. page in order to get access.
|
| 23 |
+
# This token is created under the bot `hf-transformers-bot`.
|
| 24 |
+
HF_HUB_READ_TOKEN: ${{ secrets.HF_HUB_READ_TOKEN }}
|
| 25 |
+
SIGOPT_API_TOKEN: ${{ secrets.SIGOPT_API_TOKEN }}
|
| 26 |
+
TF_FORCE_GPU_ALLOW_GROWTH: true
|
| 27 |
+
RUN_PT_TF_CROSS_TESTS: 1
|
| 28 |
+
CUDA_VISIBLE_DEVICES: 0,1
|
| 29 |
+
|
| 30 |
+
jobs:
|
| 31 |
+
model_job:
|
| 32 |
+
name: " "
|
| 33 |
+
strategy:
|
| 34 |
+
fail-fast: false
|
| 35 |
+
matrix:
|
| 36 |
+
folders: ${{ fromJson(inputs.folder_slices)[inputs.slice_id] }}
|
| 37 |
+
runs-on: ['${{ inputs.machine_type }}', nvidia-gpu, t4, daily-ci]
|
| 38 |
+
container:
|
| 39 |
+
image: huggingface/transformers-all-latest-gpu
|
| 40 |
+
options: --gpus all --shm-size "16gb" --ipc host -v /mnt/cache/.cache/huggingface:/mnt/cache/
|
| 41 |
+
steps:
|
| 42 |
+
- name: Echo input and matrix info
|
| 43 |
+
shell: bash
|
| 44 |
+
run: |
|
| 45 |
+
echo "${{ inputs.folder_slices }}"
|
| 46 |
+
echo "${{ matrix.folders }}"
|
| 47 |
+
echo "${{ toJson(fromJson(inputs.folder_slices)[inputs.slice_id]) }}"
|
| 48 |
+
|
| 49 |
+
- name: Echo folder ${{ matrix.folders }}
|
| 50 |
+
shell: bash
|
| 51 |
+
# For folders like `models/bert`, set an env. var. (`matrix_folders`) to `models_bert`, which will be used to
|
| 52 |
+
# set the artifact folder names (because the character `/` is not allowed).
|
| 53 |
+
run: |
|
| 54 |
+
echo "${{ matrix.folders }}"
|
| 55 |
+
matrix_folders=${{ matrix.folders }}
|
| 56 |
+
matrix_folders=${matrix_folders/'models/'/'models_'}
|
| 57 |
+
echo "$matrix_folders"
|
| 58 |
+
echo "matrix_folders=$matrix_folders" >> $GITHUB_ENV
|
| 59 |
+
|
| 60 |
+
- name: Update clone
|
| 61 |
+
working-directory: /transformers
|
| 62 |
+
run: git fetch && git checkout ${{ github.sha }}
|
| 63 |
+
|
| 64 |
+
- name: Reinstall transformers in edit mode (remove the one installed during docker image build)
|
| 65 |
+
working-directory: /transformers
|
| 66 |
+
run: python3 -m pip uninstall -y transformers && python3 -m pip install -e .
|
| 67 |
+
|
| 68 |
+
- name: NVIDIA-SMI
|
| 69 |
+
run: |
|
| 70 |
+
nvidia-smi
|
| 71 |
+
|
| 72 |
+
- name: Environment
|
| 73 |
+
working-directory: /transformers
|
| 74 |
+
run: |
|
| 75 |
+
python3 utils/print_env.py
|
| 76 |
+
|
| 77 |
+
- name: Show installed libraries and their versions
|
| 78 |
+
working-directory: /transformers
|
| 79 |
+
run: pip freeze
|
| 80 |
+
|
| 81 |
+
- name: Run all tests on GPU
|
| 82 |
+
working-directory: /transformers
|
| 83 |
+
run: python3 -m pytest -v --make-reports=${{ inputs.machine_type }}_tests_gpu_${{ matrix.folders }} tests/${{ matrix.folders }}
|
| 84 |
+
|
| 85 |
+
- name: Failure short reports
|
| 86 |
+
if: ${{ failure() }}
|
| 87 |
+
continue-on-error: true
|
| 88 |
+
run: cat /transformers/reports/${{ inputs.machine_type }}_tests_gpu_${{ matrix.folders }}/failures_short.txt
|
| 89 |
+
|
| 90 |
+
- name: Run test
|
| 91 |
+
shell: bash
|
| 92 |
+
run: |
|
| 93 |
+
mkdir -p /transformers/reports/${{ inputs.machine_type }}_tests_gpu_${{ matrix.folders }}
|
| 94 |
+
echo "hello" > /transformers/reports/${{ inputs.machine_type }}_tests_gpu_${{ matrix.folders }}/hello.txt
|
| 95 |
+
echo "${{ inputs.machine_type }}_tests_gpu_${{ matrix.folders }}"
|
| 96 |
+
|
| 97 |
+
- name: "Test suite reports artifacts: ${{ inputs.machine_type }}_run_all_tests_gpu_${{ env.matrix_folders }}_test_reports"
|
| 98 |
+
if: ${{ always() }}
|
| 99 |
+
uses: actions/upload-artifact@v3
|
| 100 |
+
with:
|
| 101 |
+
name: ${{ inputs.machine_type }}_run_all_tests_gpu_${{ env.matrix_folders }}_test_reports
|
| 102 |
+
path: /transformers/reports/${{ inputs.machine_type }}_tests_gpu_${{ matrix.folders }}
|
transformers/.github/workflows/release-conda.yml
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Release - Conda
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
tags:
|
| 6 |
+
- v*
|
| 7 |
+
branches:
|
| 8 |
+
- conda_*
|
| 9 |
+
|
| 10 |
+
env:
|
| 11 |
+
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}
|
| 12 |
+
|
| 13 |
+
jobs:
|
| 14 |
+
build_and_package:
|
| 15 |
+
runs-on: ubuntu-22.04
|
| 16 |
+
defaults:
|
| 17 |
+
run:
|
| 18 |
+
shell: bash -l {0}
|
| 19 |
+
|
| 20 |
+
steps:
|
| 21 |
+
- name: Checkout repository
|
| 22 |
+
uses: actions/checkout@v1
|
| 23 |
+
|
| 24 |
+
- name: Install miniconda
|
| 25 |
+
uses: conda-incubator/setup-miniconda@v2
|
| 26 |
+
with:
|
| 27 |
+
auto-update-conda: true
|
| 28 |
+
auto-activate-base: false
|
| 29 |
+
python-version: 3.8
|
| 30 |
+
activate-environment: "build-transformers"
|
| 31 |
+
channels: huggingface
|
| 32 |
+
|
| 33 |
+
- name: Setup conda env
|
| 34 |
+
run: |
|
| 35 |
+
conda install -c defaults anaconda-client conda-build
|
| 36 |
+
|
| 37 |
+
- name: Extract version
|
| 38 |
+
run: echo "TRANSFORMERS_VERSION=`python setup.py --version`" >> $GITHUB_ENV
|
| 39 |
+
|
| 40 |
+
- name: Build conda packages
|
| 41 |
+
run: |
|
| 42 |
+
conda info
|
| 43 |
+
conda list
|
| 44 |
+
conda-build .github/conda
|
| 45 |
+
|
| 46 |
+
- name: Upload to Anaconda
|
| 47 |
+
run: anaconda upload `conda-build .github/conda --output` --force
|
transformers/.github/workflows/self-nightly-past-ci-caller.yml
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Self-hosted runner (nightly-past-ci-caller)
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
schedule:
|
| 5 |
+
# 2:17 am on each Sunday and Thursday
|
| 6 |
+
|
| 7 |
+
- cron: "17 2 * * 0,4"
|
| 8 |
+
push:
|
| 9 |
+
branches:
|
| 10 |
+
- run_nightly_ci*
|
| 11 |
+
- run_past_ci*
|
| 12 |
+
|
| 13 |
+
jobs:
|
| 14 |
+
build_nightly_ci_images:
|
| 15 |
+
name: Build Nightly CI Docker Images
|
| 16 |
+
if: (github.event_name == 'schedule') || ((github.event_name == 'push') && startsWith(github.ref_name, 'run_nightly_ci'))
|
| 17 |
+
uses: ./.github/workflows/build-nightly-ci-docker-images.yml
|
| 18 |
+
secrets: inherit
|
| 19 |
+
|
| 20 |
+
run_nightly_ci:
|
| 21 |
+
name: Nightly CI
|
| 22 |
+
needs: [build_nightly_ci_images]
|
| 23 |
+
uses: ./.github/workflows/self-nightly-scheduled.yml
|
| 24 |
+
secrets: inherit
|
| 25 |
+
|
| 26 |
+
run_past_ci_pytorch_1-13:
|
| 27 |
+
name: PyTorch 1.13
|
| 28 |
+
if: (cancelled() != true) && ((github.event_name == 'schedule') || ((github.event_name == 'push') && startsWith(github.ref_name, 'run_past_ci')))
|
| 29 |
+
needs: [run_nightly_ci]
|
| 30 |
+
uses: ./.github/workflows/self-past.yml
|
| 31 |
+
with:
|
| 32 |
+
framework: pytorch
|
| 33 |
+
version: "1.13"
|
| 34 |
+
sha: ${{ github.sha }}
|
| 35 |
+
secrets: inherit
|
| 36 |
+
|
| 37 |
+
run_past_ci_pytorch_1-12:
|
| 38 |
+
name: PyTorch 1.12
|
| 39 |
+
if: (cancelled() != true) && ((github.event_name == 'schedule') || ((github.event_name == 'push') && startsWith(github.ref_name, 'run_past_ci')))
|
| 40 |
+
needs: [run_past_ci_pytorch_1-13]
|
| 41 |
+
uses: ./.github/workflows/self-past.yml
|
| 42 |
+
with:
|
| 43 |
+
framework: pytorch
|
| 44 |
+
version: "1.12"
|
| 45 |
+
sha: ${{ github.sha }}
|
| 46 |
+
secrets: inherit
|
| 47 |
+
|
| 48 |
+
run_past_ci_pytorch_1-11:
|
| 49 |
+
name: PyTorch 1.11
|
| 50 |
+
if: (cancelled() != true) && ((github.event_name == 'schedule') || ((github.event_name == 'push') && startsWith(github.ref_name, 'run_past_ci')))
|
| 51 |
+
needs: [run_past_ci_pytorch_1-12]
|
| 52 |
+
uses: ./.github/workflows/self-past.yml
|
| 53 |
+
with:
|
| 54 |
+
framework: pytorch
|
| 55 |
+
version: "1.11"
|
| 56 |
+
sha: ${{ github.sha }}
|
| 57 |
+
secrets: inherit
|
| 58 |
+
|
| 59 |
+
run_past_ci_tensorflow_2-11:
|
| 60 |
+
name: TensorFlow 2.11
|
| 61 |
+
if: (cancelled() != true) && ((github.event_name == 'push') && startsWith(github.ref_name, 'run_past_ci'))
|
| 62 |
+
needs: [run_past_ci_pytorch_1-11]
|
| 63 |
+
uses: ./.github/workflows/self-past.yml
|
| 64 |
+
with:
|
| 65 |
+
framework: tensorflow
|
| 66 |
+
version: "2.11"
|
| 67 |
+
sha: ${{ github.sha }}
|
| 68 |
+
secrets: inherit
|
| 69 |
+
|
| 70 |
+
run_past_ci_tensorflow_2-10:
|
| 71 |
+
name: TensorFlow 2.10
|
| 72 |
+
if: (cancelled() != true) && ((github.event_name == 'push') && startsWith(github.ref_name, 'run_past_ci'))
|
| 73 |
+
needs: [run_past_ci_tensorflow_2-11]
|
| 74 |
+
uses: ./.github/workflows/self-past.yml
|
| 75 |
+
with:
|
| 76 |
+
framework: tensorflow
|
| 77 |
+
version: "2.10"
|
| 78 |
+
sha: ${{ github.sha }}
|
| 79 |
+
secrets: inherit
|
| 80 |
+
|
| 81 |
+
run_past_ci_tensorflow_2-9:
|
| 82 |
+
name: TensorFlow 2.9
|
| 83 |
+
if: (cancelled() != true) && ((github.event_name == 'push') && startsWith(github.ref_name, 'run_past_ci'))
|
| 84 |
+
needs: [run_past_ci_tensorflow_2-10]
|
| 85 |
+
uses: ./.github/workflows/self-past.yml
|
| 86 |
+
with:
|
| 87 |
+
framework: tensorflow
|
| 88 |
+
version: "2.9"
|
| 89 |
+
sha: ${{ github.sha }}
|
| 90 |
+
secrets: inherit
|
| 91 |
+
|
| 92 |
+
run_past_ci_tensorflow_2-8:
|
| 93 |
+
name: TensorFlow 2.8
|
| 94 |
+
if: (cancelled() != true) && ((github.event_name == 'push') && startsWith(github.ref_name, 'run_past_ci'))
|
| 95 |
+
needs: [run_past_ci_tensorflow_2-9]
|
| 96 |
+
uses: ./.github/workflows/self-past.yml
|
| 97 |
+
with:
|
| 98 |
+
framework: tensorflow
|
| 99 |
+
version: "2.8"
|
| 100 |
+
sha: ${{ github.sha }}
|
| 101 |
+
secrets: inherit
|
| 102 |
+
|
| 103 |
+
run_past_ci_tensorflow_2-7:
|
| 104 |
+
name: TensorFlow 2.7
|
| 105 |
+
if: (cancelled() != true) && ((github.event_name == 'push') && startsWith(github.ref_name, 'run_past_ci'))
|
| 106 |
+
needs: [run_past_ci_tensorflow_2-8]
|
| 107 |
+
uses: ./.github/workflows/self-past.yml
|
| 108 |
+
with:
|
| 109 |
+
framework: tensorflow
|
| 110 |
+
version: "2.7"
|
| 111 |
+
sha: ${{ github.sha }}
|
| 112 |
+
secrets: inherit
|
| 113 |
+
|
| 114 |
+
run_past_ci_tensorflow_2-6:
|
| 115 |
+
name: TensorFlow 2.6
|
| 116 |
+
if: (cancelled() != true) && ((github.event_name == 'push') && startsWith(github.ref_name, 'run_past_ci'))
|
| 117 |
+
needs: [run_past_ci_tensorflow_2-7]
|
| 118 |
+
uses: ./.github/workflows/self-past.yml
|
| 119 |
+
with:
|
| 120 |
+
framework: tensorflow
|
| 121 |
+
version: "2.6"
|
| 122 |
+
sha: ${{ github.sha }}
|
| 123 |
+
secrets: inherit
|
| 124 |
+
|
| 125 |
+
run_past_ci_tensorflow_2-5:
|
| 126 |
+
name: TensorFlow 2.5
|
| 127 |
+
if: (cancelled() != true) && ((github.event_name == 'push') && startsWith(github.ref_name, 'run_past_ci'))
|
| 128 |
+
needs: [run_past_ci_tensorflow_2-6]
|
| 129 |
+
uses: ./.github/workflows/self-past.yml
|
| 130 |
+
with:
|
| 131 |
+
framework: tensorflow
|
| 132 |
+
version: "2.5"
|
| 133 |
+
sha: ${{ github.sha }}
|
| 134 |
+
secrets: inherit
|
transformers/.github/workflows/self-nightly-scheduled.yml
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Self-hosted runner (nightly-ci)
|
| 2 |
+
|
| 3 |
+
# Note that each job's dependencies go into a corresponding docker file.
|
| 4 |
+
#
|
| 5 |
+
# For example for `run_all_tests_torch_cuda_extensions_gpu` the docker image is
|
| 6 |
+
# `huggingface/transformers-pytorch-deepspeed-latest-gpu`, which can be found at
|
| 7 |
+
# `docker/transformers-pytorch-deepspeed-latest-gpu/Dockerfile`
|
| 8 |
+
|
| 9 |
+
on:
|
| 10 |
+
repository_dispatch:
|
| 11 |
+
workflow_call:
|
| 12 |
+
|
| 13 |
+
env:
|
| 14 |
+
HF_HOME: /mnt/cache
|
| 15 |
+
TRANSFORMERS_IS_CI: yes
|
| 16 |
+
OMP_NUM_THREADS: 8
|
| 17 |
+
MKL_NUM_THREADS: 8
|
| 18 |
+
RUN_SLOW: yes
|
| 19 |
+
HF_HUB_READ_TOKEN: ${{ secrets.HF_HUB_READ_TOKEN }}
|
| 20 |
+
SIGOPT_API_TOKEN: ${{ secrets.SIGOPT_API_TOKEN }}
|
| 21 |
+
TF_FORCE_GPU_ALLOW_GROWTH: true
|
| 22 |
+
RUN_PT_TF_CROSS_TESTS: 1
|
| 23 |
+
CUDA_VISIBLE_DEVICES: 0,1
|
| 24 |
+
|
| 25 |
+
jobs:
|
| 26 |
+
setup:
|
| 27 |
+
name: Setup
|
| 28 |
+
strategy:
|
| 29 |
+
matrix:
|
| 30 |
+
machine_type: [single-gpu, multi-gpu]
|
| 31 |
+
runs-on: ['${{ matrix.machine_type }}', nvidia-gpu, t4, past-ci]
|
| 32 |
+
container:
|
| 33 |
+
image: huggingface/transformers-all-latest-torch-nightly-gpu
|
| 34 |
+
options: --gpus 0 --shm-size "16gb" --ipc host -v /mnt/cache/.cache/huggingface:/mnt/cache/
|
| 35 |
+
outputs:
|
| 36 |
+
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
| 37 |
+
steps:
|
| 38 |
+
- name: Update clone
|
| 39 |
+
working-directory: /transformers
|
| 40 |
+
run: |
|
| 41 |
+
git fetch && git checkout ${{ github.sha }}
|
| 42 |
+
|
| 43 |
+
- name: Cleanup
|
| 44 |
+
working-directory: /transformers
|
| 45 |
+
run: |
|
| 46 |
+
rm -rf tests/__pycache__
|
| 47 |
+
rm -rf tests/models/__pycache__
|
| 48 |
+
rm -rf reports
|
| 49 |
+
|
| 50 |
+
- name: Show installed libraries and their versions
|
| 51 |
+
working-directory: /transformers
|
| 52 |
+
run: pip freeze
|
| 53 |
+
|
| 54 |
+
- id: set-matrix
|
| 55 |
+
name: Identify models to test
|
| 56 |
+
working-directory: /transformers/tests
|
| 57 |
+
run: |
|
| 58 |
+
echo "matrix=$(python3 -c 'import os; tests = os.getcwd(); 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, [f"models/{x}" for x in model_tests]))); d1.remove("models"); d = d2 + d1; print(d)')" >> $GITHUB_OUTPUT
|
| 59 |
+
|
| 60 |
+
- name: NVIDIA-SMI
|
| 61 |
+
run: |
|
| 62 |
+
nvidia-smi
|
| 63 |
+
|
| 64 |
+
run_tests_single_gpu:
|
| 65 |
+
name: Model tests
|
| 66 |
+
strategy:
|
| 67 |
+
fail-fast: false
|
| 68 |
+
matrix:
|
| 69 |
+
folders: ${{ fromJson(needs.setup.outputs.matrix) }}
|
| 70 |
+
machine_type: [single-gpu]
|
| 71 |
+
runs-on: ['${{ matrix.machine_type }}', nvidia-gpu, t4, past-ci]
|
| 72 |
+
container:
|
| 73 |
+
image: huggingface/transformers-all-latest-torch-nightly-gpu
|
| 74 |
+
options: --gpus 0 --shm-size "16gb" --ipc host -v /mnt/cache/.cache/huggingface:/mnt/cache/
|
| 75 |
+
needs: setup
|
| 76 |
+
steps:
|
| 77 |
+
- name: Echo folder ${{ matrix.folders }}
|
| 78 |
+
shell: bash
|
| 79 |
+
# For folders like `models/bert`, set an env. var. (`matrix_folders`) to `models_bert`, which will be used to
|
| 80 |
+
# set the artifact folder names (because the character `/` is not allowed).
|
| 81 |
+
run: |
|
| 82 |
+
echo "${{ matrix.folders }}"
|
| 83 |
+
matrix_folders=${{ matrix.folders }}
|
| 84 |
+
matrix_folders=${matrix_folders/'models/'/'models_'}
|
| 85 |
+
echo "$matrix_folders"
|
| 86 |
+
echo "matrix_folders=$matrix_folders" >> $GITHUB_ENV
|
| 87 |
+
|
| 88 |
+
- name: Update clone
|
| 89 |
+
working-directory: /transformers
|
| 90 |
+
run: git fetch && git checkout ${{ github.sha }}
|
| 91 |
+
|
| 92 |
+
- name: Reinstall transformers in edit mode (remove the one installed during docker image build)
|
| 93 |
+
working-directory: /transformers
|
| 94 |
+
run: python3 -m pip uninstall -y transformers && python3 -m pip install -e .
|
| 95 |
+
|
| 96 |
+
- name: NVIDIA-SMI
|
| 97 |
+
run: |
|
| 98 |
+
nvidia-smi
|
| 99 |
+
|
| 100 |
+
- name: Environment
|
| 101 |
+
working-directory: /transformers
|
| 102 |
+
run: |
|
| 103 |
+
python3 utils/print_env.py
|
| 104 |
+
|
| 105 |
+
- name: Show installed libraries and their versions
|
| 106 |
+
working-directory: /transformers
|
| 107 |
+
run: pip freeze
|
| 108 |
+
|
| 109 |
+
- name: Run all tests on GPU
|
| 110 |
+
working-directory: /transformers
|
| 111 |
+
run: python3 -m pytest -v --make-reports=${{ matrix.machine_type }}_tests_gpu_${{ matrix.folders }} tests/${{ matrix.folders }}
|
| 112 |
+
|
| 113 |
+
- name: Failure short reports
|
| 114 |
+
if: ${{ failure() }}
|
| 115 |
+
continue-on-error: true
|
| 116 |
+
run: cat /transformers/reports/${{ matrix.machine_type }}_tests_gpu_${{ matrix.folders }}/failures_short.txt
|
| 117 |
+
|
| 118 |
+
- name: "Test suite reports artifacts: ${{ matrix.machine_type }}_run_all_tests_gpu_${{ env.matrix_folders }}_test_reports_postfix_nightly"
|
| 119 |
+
if: ${{ always() }}
|
| 120 |
+
uses: actions/upload-artifact@v3
|
| 121 |
+
with:
|
| 122 |
+
name: ${{ matrix.machine_type }}_run_all_tests_gpu_${{ env.matrix_folders }}_test_reports_postfix_nightly
|
| 123 |
+
path: /transformers/reports/${{ matrix.machine_type }}_tests_gpu_${{ matrix.folders }}
|
| 124 |
+
|
| 125 |
+
run_tests_multi_gpu:
|
| 126 |
+
name: Model tests
|
| 127 |
+
strategy:
|
| 128 |
+
fail-fast: false
|
| 129 |
+
matrix:
|
| 130 |
+
folders: ${{ fromJson(needs.setup.outputs.matrix) }}
|
| 131 |
+
machine_type: [multi-gpu]
|
| 132 |
+
runs-on: ['${{ matrix.machine_type }}', nvidia-gpu, t4, past-ci]
|
| 133 |
+
container:
|
| 134 |
+
image: huggingface/transformers-all-latest-torch-nightly-gpu
|
| 135 |
+
options: --gpus all --shm-size "16gb" --ipc host -v /mnt/cache/.cache/huggingface:/mnt/cache/
|
| 136 |
+
needs: setup
|
| 137 |
+
steps:
|
| 138 |
+
- name: Echo folder ${{ matrix.folders }}
|
| 139 |
+
shell: bash
|
| 140 |
+
# For folders like `models/bert`, set an env. var. (`matrix_folders`) to `models_bert`, which will be used to
|
| 141 |
+
# set the artifact folder names (because the character `/` is not allowed).
|
| 142 |
+
run: |
|
| 143 |
+
echo "${{ matrix.folders }}"
|
| 144 |
+
matrix_folders=${{ matrix.folders }}
|
| 145 |
+
matrix_folders=${matrix_folders/'models/'/'models_'}
|
| 146 |
+
echo "$matrix_folders"
|
| 147 |
+
echo "matrix_folders=$matrix_folders" >> $GITHUB_ENV
|
| 148 |
+
|
| 149 |
+
- name: Update clone
|
| 150 |
+
working-directory: /transformers
|
| 151 |
+
run: git fetch && git checkout ${{ github.sha }}
|
| 152 |
+
|
| 153 |
+
- name: Reinstall transformers in edit mode (remove the one installed during docker image build)
|
| 154 |
+
working-directory: /transformers
|
| 155 |
+
run: python3 -m pip uninstall -y transformers && python3 -m pip install -e .
|
| 156 |
+
|
| 157 |
+
- name: NVIDIA-SMI
|
| 158 |
+
run: |
|
| 159 |
+
nvidia-smi
|
| 160 |
+
|
| 161 |
+
- name: Environment
|
| 162 |
+
working-directory: /transformers
|
| 163 |
+
run: |
|
| 164 |
+
python3 utils/print_env.py
|
| 165 |
+
|
| 166 |
+
- name: Show installed libraries and their versions
|
| 167 |
+
working-directory: /transformers
|
| 168 |
+
run: pip freeze
|
| 169 |
+
|
| 170 |
+
- name: Run all tests on GPU
|
| 171 |
+
working-directory: /transformers
|
| 172 |
+
run: python3 -m pytest -v --make-reports=${{ matrix.machine_type }}_tests_gpu_${{ matrix.folders }} tests/${{ matrix.folders }}
|
| 173 |
+
|
| 174 |
+
- name: Failure short reports
|
| 175 |
+
if: ${{ failure() }}
|
| 176 |
+
continue-on-error: true
|
| 177 |
+
run: cat /transformers/reports/${{ matrix.machine_type }}_tests_gpu_${{ matrix.folders }}/failures_short.txt
|
| 178 |
+
|
| 179 |
+
- name: "Test suite reports artifacts: ${{ matrix.machine_type }}_run_all_tests_gpu_${{ env.matrix_folders }}_test_reports_postfix_nightly"
|
| 180 |
+
if: ${{ always() }}
|
| 181 |
+
uses: actions/upload-artifact@v3
|
| 182 |
+
with:
|
| 183 |
+
name: ${{ matrix.machine_type }}_run_all_tests_gpu_${{ env.matrix_folders }}_test_reports_postfix_nightly
|
| 184 |
+
path: /transformers/reports/${{ matrix.machine_type }}_tests_gpu_${{ matrix.folders }}
|
| 185 |
+
|
| 186 |
+
run_all_tests_torch_cuda_extensions_gpu:
|
| 187 |
+
name: Torch CUDA extension tests
|
| 188 |
+
strategy:
|
| 189 |
+
fail-fast: false
|
| 190 |
+
matrix:
|
| 191 |
+
machine_type: [single-gpu, multi-gpu]
|
| 192 |
+
runs-on: ['${{ matrix.machine_type }}', nvidia-gpu, t4, past-ci]
|
| 193 |
+
needs: setup
|
| 194 |
+
container:
|
| 195 |
+
image: huggingface/transformers-pytorch-deepspeed-nightly-gpu
|
| 196 |
+
options: --gpus all --shm-size "16gb" --ipc host -v /mnt/cache/.cache/huggingface:/mnt/cache/
|
| 197 |
+
steps:
|
| 198 |
+
- name: Update clone
|
| 199 |
+
working-directory: /workspace/transformers
|
| 200 |
+
run: git fetch && git checkout ${{ github.sha }}
|
| 201 |
+
|
| 202 |
+
- name: Reinstall transformers in edit mode (remove the one installed during docker image build)
|
| 203 |
+
working-directory: /workspace/transformers
|
| 204 |
+
run: python3 -m pip uninstall -y transformers && python3 -m pip install -e .
|
| 205 |
+
|
| 206 |
+
- name: Remove cached torch extensions
|
| 207 |
+
run: rm -rf /github/home/.cache/torch_extensions/
|
| 208 |
+
|
| 209 |
+
# To avoid unknown test failures
|
| 210 |
+
- name: Pre build DeepSpeed *again*
|
| 211 |
+
working-directory: /workspace
|
| 212 |
+
run: |
|
| 213 |
+
python3 -m pip uninstall -y deepspeed
|
| 214 |
+
rm -rf DeepSpeed
|
| 215 |
+
git clone https://github.com/microsoft/DeepSpeed && cd DeepSpeed && rm -rf build
|
| 216 |
+
DS_BUILD_CPU_ADAM=1 DS_BUILD_FUSED_ADAM=1 python3 -m pip install . --global-option="build_ext" --global-option="-j8" --no-cache -v --disable-pip-version-check
|
| 217 |
+
|
| 218 |
+
- name: NVIDIA-SMI
|
| 219 |
+
run: |
|
| 220 |
+
nvidia-smi
|
| 221 |
+
|
| 222 |
+
- name: Environment
|
| 223 |
+
working-directory: /workspace/transformers
|
| 224 |
+
run: |
|
| 225 |
+
python utils/print_env.py
|
| 226 |
+
|
| 227 |
+
- name: Show installed libraries and their versions
|
| 228 |
+
working-directory: /workspace/transformers
|
| 229 |
+
run: pip freeze
|
| 230 |
+
|
| 231 |
+
- name: Run all tests on GPU
|
| 232 |
+
working-directory: /workspace/transformers
|
| 233 |
+
run: |
|
| 234 |
+
python -m pytest -v --make-reports=${{ matrix.machine_type }}_tests_torch_cuda_extensions_gpu tests/deepspeed tests/extended
|
| 235 |
+
|
| 236 |
+
- name: Failure short reports
|
| 237 |
+
if: ${{ failure() }}
|
| 238 |
+
continue-on-error: true
|
| 239 |
+
run: cat /workspace/transformers/reports/${{ matrix.machine_type }}_tests_torch_cuda_extensions_gpu/failures_short.txt
|
| 240 |
+
|
| 241 |
+
- name: "Test suite reports artifacts: ${{ matrix.machine_type }}_run_tests_torch_cuda_extensions_gpu_test_reports_postfix_nightly"
|
| 242 |
+
if: ${{ always() }}
|
| 243 |
+
uses: actions/upload-artifact@v3
|
| 244 |
+
with:
|
| 245 |
+
name: ${{ matrix.machine_type }}_run_tests_torch_cuda_extensions_gpu_test_reports_postfix_nightly
|
| 246 |
+
path: /workspace/transformers/reports/${{ matrix.machine_type }}_tests_torch_cuda_extensions_gpu
|
| 247 |
+
|
| 248 |
+
send_results:
|
| 249 |
+
name: Send results to webhook
|
| 250 |
+
runs-on: ubuntu-22.04
|
| 251 |
+
if: always()
|
| 252 |
+
needs: [
|
| 253 |
+
setup,
|
| 254 |
+
run_tests_single_gpu,
|
| 255 |
+
run_tests_multi_gpu,
|
| 256 |
+
run_all_tests_torch_cuda_extensions_gpu
|
| 257 |
+
]
|
| 258 |
+
steps:
|
| 259 |
+
- name: Preliminary job status
|
| 260 |
+
shell: bash
|
| 261 |
+
# For the meaning of these environment variables, see the job `Setup`
|
| 262 |
+
run: |
|
| 263 |
+
echo "Setup status: ${{ needs.setup.result }}"
|
| 264 |
+
|
| 265 |
+
- uses: actions/checkout@v3
|
| 266 |
+
- uses: actions/download-artifact@v3
|
| 267 |
+
- name: Send message to Slack
|
| 268 |
+
env:
|
| 269 |
+
CI_SLACK_BOT_TOKEN: ${{ secrets.CI_SLACK_BOT_TOKEN }}
|
| 270 |
+
CI_SLACK_CHANNEL_ID: ${{ secrets.CI_SLACK_CHANNEL_ID }}
|
| 271 |
+
CI_SLACK_CHANNEL_ID_DAILY: ${{ secrets.CI_SLACK_CHANNEL_ID_DAILY }}
|
| 272 |
+
CI_SLACK_CHANNEL_DUMMY_TESTS: ${{ secrets.CI_SLACK_CHANNEL_DUMMY_TESTS }}
|
| 273 |
+
CI_SLACK_REPORT_CHANNEL_ID: ${{ secrets.CI_SLACK_CHANNEL_ID_PAST_FUTURE }}
|
| 274 |
+
ACCESS_REPO_INFO_TOKEN: ${{ secrets.ACCESS_REPO_INFO_TOKEN }}
|
| 275 |
+
CI_EVENT: Nightly CI
|
| 276 |
+
SETUP_STATUS: ${{ needs.setup.result }}
|
| 277 |
+
# We pass `needs.setup.outputs.matrix` as the argument. A processing in `notification_service.py` to change
|
| 278 |
+
# `models/bert` to `models_bert` is required, as the artifact names use `_` instead of `/`.
|
| 279 |
+
run: |
|
| 280 |
+
pip install slack_sdk
|
| 281 |
+
pip show slack_sdk
|
| 282 |
+
python utils/notification_service.py "${{ needs.setup.outputs.matrix }}"
|
| 283 |
+
|
| 284 |
+
|
| 285 |
+
# delete-artifact
|
| 286 |
+
- uses: geekyeggo/delete-artifact@v2
|
| 287 |
+
with:
|
| 288 |
+
name: |
|
| 289 |
+
single-*
|
| 290 |
+
multi-*
|
transformers/.github/workflows/self-past.yml
ADDED
|
@@ -0,0 +1,357 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Self-hosted runner (past-ci)
|
| 2 |
+
|
| 3 |
+
# Note that each job's dependencies go into a corresponding docker file.
|
| 4 |
+
#
|
| 5 |
+
# For example for `run_all_tests_torch_cuda_extensions_gpu` the docker image is
|
| 6 |
+
# `huggingface/transformers-pytorch-deepspeed-latest-gpu`, which can be found at
|
| 7 |
+
# `docker/transformers-pytorch-deepspeed-latest-gpu/Dockerfile`
|
| 8 |
+
|
| 9 |
+
on:
|
| 10 |
+
workflow_call:
|
| 11 |
+
inputs:
|
| 12 |
+
framework:
|
| 13 |
+
required: true
|
| 14 |
+
type: string
|
| 15 |
+
version:
|
| 16 |
+
required: true
|
| 17 |
+
type: string
|
| 18 |
+
# Use this to control the commit to test against
|
| 19 |
+
sha:
|
| 20 |
+
default: 'main'
|
| 21 |
+
required: false
|
| 22 |
+
type: string
|
| 23 |
+
|
| 24 |
+
env:
|
| 25 |
+
HF_HOME: /mnt/cache
|
| 26 |
+
TRANSFORMERS_IS_CI: yes
|
| 27 |
+
OMP_NUM_THREADS: 8
|
| 28 |
+
MKL_NUM_THREADS: 8
|
| 29 |
+
RUN_SLOW: yes
|
| 30 |
+
HF_HUB_READ_TOKEN: ${{ secrets.HF_HUB_READ_TOKEN }}
|
| 31 |
+
SIGOPT_API_TOKEN: ${{ secrets.SIGOPT_API_TOKEN }}
|
| 32 |
+
TF_FORCE_GPU_ALLOW_GROWTH: true
|
| 33 |
+
RUN_PT_TF_CROSS_TESTS: 1
|
| 34 |
+
CUDA_VISIBLE_DEVICES: 0,1
|
| 35 |
+
|
| 36 |
+
jobs:
|
| 37 |
+
setup:
|
| 38 |
+
name: Setup
|
| 39 |
+
strategy:
|
| 40 |
+
matrix:
|
| 41 |
+
machine_type: [single-gpu, multi-gpu]
|
| 42 |
+
runs-on: ['${{ matrix.machine_type }}', nvidia-gpu, t4, past-ci]
|
| 43 |
+
container:
|
| 44 |
+
image: huggingface/transformers-${{ inputs.framework }}-past-${{ inputs.version }}-gpu
|
| 45 |
+
options: --gpus 0 --shm-size "16gb" --ipc host -v /mnt/cache/.cache/huggingface:/mnt/cache/
|
| 46 |
+
outputs:
|
| 47 |
+
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
| 48 |
+
steps:
|
| 49 |
+
- name: Update clone
|
| 50 |
+
working-directory: /transformers
|
| 51 |
+
run: git fetch && git checkout ${{ inputs.sha }}
|
| 52 |
+
|
| 53 |
+
- name: Cleanup
|
| 54 |
+
working-directory: /transformers
|
| 55 |
+
run: |
|
| 56 |
+
rm -rf tests/__pycache__
|
| 57 |
+
rm -rf tests/models/__pycache__
|
| 58 |
+
rm -rf reports
|
| 59 |
+
|
| 60 |
+
- name: Show installed libraries and their versions
|
| 61 |
+
working-directory: /transformers
|
| 62 |
+
run: pip freeze
|
| 63 |
+
|
| 64 |
+
- id: set-matrix
|
| 65 |
+
working-directory: /transformers
|
| 66 |
+
name: Identify models to test
|
| 67 |
+
run: |
|
| 68 |
+
cd tests
|
| 69 |
+
echo "matrix=$(python3 -c 'import os; tests = os.getcwd(); 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, [f"models/{x}" for x in model_tests]))); d1.remove("models"); d = d2 + d1; print(d)')" >> $GITHUB_OUTPUT
|
| 70 |
+
|
| 71 |
+
run_tests_single_gpu:
|
| 72 |
+
name: Model tests
|
| 73 |
+
strategy:
|
| 74 |
+
fail-fast: false
|
| 75 |
+
matrix:
|
| 76 |
+
folders: ${{ fromJson(needs.setup.outputs.matrix) }}
|
| 77 |
+
machine_type: [single-gpu]
|
| 78 |
+
runs-on: ['${{ matrix.machine_type }}', nvidia-gpu, t4, past-ci]
|
| 79 |
+
container:
|
| 80 |
+
image: huggingface/transformers-${{ inputs.framework }}-past-${{ inputs.version }}-gpu
|
| 81 |
+
options: --gpus 0 --shm-size "16gb" --ipc host -v /mnt/cache/.cache/huggingface:/mnt/cache/
|
| 82 |
+
needs: setup
|
| 83 |
+
steps:
|
| 84 |
+
- name: Update clone
|
| 85 |
+
working-directory: /transformers
|
| 86 |
+
run: git fetch && git checkout ${{ inputs.sha }}
|
| 87 |
+
|
| 88 |
+
- name: Reinstall transformers in edit mode (remove the one installed during docker image build)
|
| 89 |
+
working-directory: /transformers
|
| 90 |
+
run: python3 -m pip uninstall -y transformers && python3 -m pip install -e .
|
| 91 |
+
|
| 92 |
+
- name: Update some packages
|
| 93 |
+
working-directory: /transformers
|
| 94 |
+
run: python3 -m pip install -U datasets
|
| 95 |
+
|
| 96 |
+
- name: Echo folder ${{ matrix.folders }}
|
| 97 |
+
shell: bash
|
| 98 |
+
# For folders like `models/bert`, set an env. var. (`matrix_folders`) to `models_bert`, which will be used to
|
| 99 |
+
# set the artifact folder names (because the character `/` is not allowed).
|
| 100 |
+
run: |
|
| 101 |
+
echo "${{ matrix.folders }}"
|
| 102 |
+
matrix_folders=${{ matrix.folders }}
|
| 103 |
+
matrix_folders=${matrix_folders/'models/'/'models_'}
|
| 104 |
+
echo "$matrix_folders"
|
| 105 |
+
echo "matrix_folders=$matrix_folders" >> $GITHUB_ENV
|
| 106 |
+
|
| 107 |
+
- name: NVIDIA-SMI
|
| 108 |
+
run: |
|
| 109 |
+
nvidia-smi
|
| 110 |
+
|
| 111 |
+
- name: Install
|
| 112 |
+
if: inputs.framework == 'pytorch'
|
| 113 |
+
working-directory: /transformers
|
| 114 |
+
run: |
|
| 115 |
+
python3 -m pip install --no-cache-dir git+https://github.com/huggingface/accelerate@main#egg=accelerate
|
| 116 |
+
|
| 117 |
+
- name: Environment
|
| 118 |
+
working-directory: /transformers
|
| 119 |
+
run: |
|
| 120 |
+
python3 utils/print_env.py
|
| 121 |
+
|
| 122 |
+
- name: Show installed libraries and their versions
|
| 123 |
+
working-directory: /transformers
|
| 124 |
+
run: pip freeze
|
| 125 |
+
|
| 126 |
+
- name: Run all tests on GPU
|
| 127 |
+
working-directory: /transformers
|
| 128 |
+
run: python3 -m pytest -v --make-reports=${{ matrix.machine_type }}_tests_gpu_${{ matrix.folders }} tests/${{ matrix.folders }}
|
| 129 |
+
|
| 130 |
+
- name: Failure short reports
|
| 131 |
+
if: ${{ failure() }}
|
| 132 |
+
continue-on-error: true
|
| 133 |
+
run: cat /transformers/reports/${{ matrix.machine_type }}_tests_gpu_${{ matrix.folders }}/failures_short.txt
|
| 134 |
+
|
| 135 |
+
- name: Save job name
|
| 136 |
+
if: ${{ always() }}
|
| 137 |
+
shell: bash
|
| 138 |
+
run: |
|
| 139 |
+
matrix_folders=${matrix_folders/'models_'/'models/'}
|
| 140 |
+
job_name="Model tests ($matrix_folders, ${{ matrix.machine_type }})"
|
| 141 |
+
echo "$job_name"
|
| 142 |
+
echo "$job_name" > /transformers/reports/${{ matrix.machine_type }}_tests_gpu_${{ matrix.folders }}/job_name.txt
|
| 143 |
+
|
| 144 |
+
- name: "Test suite reports artifacts: ${{ matrix.machine_type }}_run_all_tests_gpu_${{ env.matrix_folders }}_test_reports_postfix_${{ inputs.framework }}-${{ inputs.version }}"
|
| 145 |
+
if: ${{ always() }}
|
| 146 |
+
uses: actions/upload-artifact@v3
|
| 147 |
+
with:
|
| 148 |
+
name: ${{ matrix.machine_type }}_run_all_tests_gpu_${{ env.matrix_folders }}_test_reports_postfix_${{ inputs.framework }}-${{ inputs.version }}
|
| 149 |
+
path: /transformers/reports/${{ matrix.machine_type }}_tests_gpu_${{ matrix.folders }}
|
| 150 |
+
|
| 151 |
+
run_tests_multi_gpu:
|
| 152 |
+
name: Model tests
|
| 153 |
+
strategy:
|
| 154 |
+
fail-fast: false
|
| 155 |
+
matrix:
|
| 156 |
+
folders: ${{ fromJson(needs.setup.outputs.matrix) }}
|
| 157 |
+
machine_type: [multi-gpu]
|
| 158 |
+
runs-on: ['${{ matrix.machine_type }}', nvidia-gpu, t4, past-ci]
|
| 159 |
+
container:
|
| 160 |
+
image: huggingface/transformers-${{ inputs.framework }}-past-${{ inputs.version }}-gpu
|
| 161 |
+
options: --gpus all --shm-size "16gb" --ipc host -v /mnt/cache/.cache/huggingface:/mnt/cache/
|
| 162 |
+
needs: setup
|
| 163 |
+
steps:
|
| 164 |
+
- name: Update clone
|
| 165 |
+
working-directory: /transformers
|
| 166 |
+
run: git fetch && git checkout ${{ inputs.sha }}
|
| 167 |
+
|
| 168 |
+
- name: Reinstall transformers in edit mode (remove the one installed during docker image build)
|
| 169 |
+
working-directory: /transformers
|
| 170 |
+
run: python3 -m pip uninstall -y transformers && python3 -m pip install -e .
|
| 171 |
+
|
| 172 |
+
- name: Update some packages
|
| 173 |
+
working-directory: /transformers
|
| 174 |
+
run: python3 -m pip install -U datasets
|
| 175 |
+
|
| 176 |
+
- name: Echo folder ${{ matrix.folders }}
|
| 177 |
+
shell: bash
|
| 178 |
+
# For folders like `models/bert`, set an env. var. (`matrix_folders`) to `models_bert`, which will be used to
|
| 179 |
+
# set the artifact folder names (because the character `/` is not allowed).
|
| 180 |
+
run: |
|
| 181 |
+
echo "${{ matrix.folders }}"
|
| 182 |
+
matrix_folders=${{ matrix.folders }}
|
| 183 |
+
matrix_folders=${matrix_folders/'models/'/'models_'}
|
| 184 |
+
echo "$matrix_folders"
|
| 185 |
+
echo "matrix_folders=$matrix_folders" >> $GITHUB_ENV
|
| 186 |
+
|
| 187 |
+
- name: NVIDIA-SMI
|
| 188 |
+
run: |
|
| 189 |
+
nvidia-smi
|
| 190 |
+
|
| 191 |
+
- name: Install
|
| 192 |
+
if: inputs.framework == 'pytorch'
|
| 193 |
+
working-directory: /transformers
|
| 194 |
+
run: |
|
| 195 |
+
python3 -m pip install --no-cache-dir git+https://github.com/huggingface/accelerate@main#egg=accelerate
|
| 196 |
+
|
| 197 |
+
- name: Environment
|
| 198 |
+
working-directory: /transformers
|
| 199 |
+
run: |
|
| 200 |
+
python3 utils/print_env.py
|
| 201 |
+
|
| 202 |
+
- name: Show installed libraries and their versions
|
| 203 |
+
working-directory: /transformers
|
| 204 |
+
run: pip freeze
|
| 205 |
+
|
| 206 |
+
- name: Run all tests on GPU
|
| 207 |
+
working-directory: /transformers
|
| 208 |
+
run: python3 -m pytest -v --make-reports=${{ matrix.machine_type }}_tests_gpu_${{ matrix.folders }} tests/${{ matrix.folders }}
|
| 209 |
+
|
| 210 |
+
- name: Failure short reports
|
| 211 |
+
if: ${{ failure() }}
|
| 212 |
+
continue-on-error: true
|
| 213 |
+
run: cat /transformers/reports/${{ matrix.machine_type }}_tests_gpu_${{ matrix.folders }}/failures_short.txt
|
| 214 |
+
|
| 215 |
+
- name: Save job name
|
| 216 |
+
if: ${{ always() }}
|
| 217 |
+
shell: bash
|
| 218 |
+
run: |
|
| 219 |
+
matrix_folders=${matrix_folders/'models_'/'models/'}
|
| 220 |
+
job_name="Model tests ($matrix_folders, ${{ matrix.machine_type }})"
|
| 221 |
+
echo "$job_name"
|
| 222 |
+
echo "$job_name" > /transformers/reports/${{ matrix.machine_type }}_tests_gpu_${{ matrix.folders }}/job_name.txt
|
| 223 |
+
|
| 224 |
+
- name: "Test suite reports artifacts: ${{ matrix.machine_type }}_run_all_tests_gpu_${{ env.matrix_folders }}_test_reports_postfix_${{ inputs.framework }}-${{ inputs.version }}"
|
| 225 |
+
if: ${{ always() }}
|
| 226 |
+
uses: actions/upload-artifact@v3
|
| 227 |
+
with:
|
| 228 |
+
name: ${{ matrix.machine_type }}_run_all_tests_gpu_${{ env.matrix_folders }}_test_reports_postfix_${{ inputs.framework }}-${{ inputs.version }}
|
| 229 |
+
path: /transformers/reports/${{ matrix.machine_type }}_tests_gpu_${{ matrix.folders }}
|
| 230 |
+
|
| 231 |
+
run_all_tests_torch_cuda_extensions_gpu:
|
| 232 |
+
name: Torch CUDA extension tests
|
| 233 |
+
if: inputs.framework == 'pytorch'
|
| 234 |
+
strategy:
|
| 235 |
+
fail-fast: false
|
| 236 |
+
matrix:
|
| 237 |
+
machine_type: [single-gpu, multi-gpu]
|
| 238 |
+
runs-on: ['${{ matrix.machine_type }}', nvidia-gpu, t4, past-ci]
|
| 239 |
+
needs: setup
|
| 240 |
+
container:
|
| 241 |
+
image: huggingface/transformers-${{ inputs.framework }}-past-${{ inputs.version }}-gpu
|
| 242 |
+
options: --gpus all --shm-size "16gb" --ipc host -v /mnt/cache/.cache/huggingface:/mnt/cache/
|
| 243 |
+
steps:
|
| 244 |
+
- name: Update clone
|
| 245 |
+
working-directory: /transformers
|
| 246 |
+
run: git fetch && git checkout ${{ github.sha }}
|
| 247 |
+
|
| 248 |
+
- name: Reinstall transformers in edit mode (remove the one installed during docker image build)
|
| 249 |
+
working-directory: /transformers
|
| 250 |
+
run: python3 -m pip uninstall -y transformers && python3 -m pip install -e .
|
| 251 |
+
|
| 252 |
+
- name: Update some packages
|
| 253 |
+
working-directory: /transformers
|
| 254 |
+
run: python3 -m pip install -U datasets
|
| 255 |
+
|
| 256 |
+
- name: Install
|
| 257 |
+
working-directory: /transformers
|
| 258 |
+
run: |
|
| 259 |
+
python3 -m pip install --no-cache-dir git+https://github.com/huggingface/accelerate@main#egg=accelerate
|
| 260 |
+
|
| 261 |
+
- name: Remove cached torch extensions
|
| 262 |
+
run: rm -rf /github/home/.cache/torch_extensions/
|
| 263 |
+
|
| 264 |
+
# To avoid unknown test failures
|
| 265 |
+
- name: Pre build DeepSpeed *again*
|
| 266 |
+
working-directory: /
|
| 267 |
+
run: |
|
| 268 |
+
python3 -m pip uninstall -y deepspeed
|
| 269 |
+
rm -rf DeepSpeed
|
| 270 |
+
git clone https://github.com/microsoft/DeepSpeed && cd DeepSpeed && rm -rf build
|
| 271 |
+
DS_BUILD_CPU_ADAM=1 DS_BUILD_FUSED_ADAM=1 python3 -m pip install . --global-option="build_ext" --global-option="-j8" --no-cache -v --disable-pip-version-check
|
| 272 |
+
|
| 273 |
+
- name: NVIDIA-SMI
|
| 274 |
+
run: |
|
| 275 |
+
nvidia-smi
|
| 276 |
+
|
| 277 |
+
- name: Environment
|
| 278 |
+
working-directory: /transformers
|
| 279 |
+
run: |
|
| 280 |
+
python3 utils/print_env.py
|
| 281 |
+
|
| 282 |
+
- name: Show installed libraries and their versions
|
| 283 |
+
working-directory: /transformers
|
| 284 |
+
run: pip freeze
|
| 285 |
+
|
| 286 |
+
- name: Run all tests on GPU
|
| 287 |
+
working-directory: /transformers
|
| 288 |
+
run: |
|
| 289 |
+
python3 -m pytest -v --make-reports=${{ matrix.machine_type }}_tests_torch_cuda_extensions_gpu tests/deepspeed tests/extended
|
| 290 |
+
|
| 291 |
+
- name: Failure short reports
|
| 292 |
+
if: ${{ failure() }}
|
| 293 |
+
continue-on-error: true
|
| 294 |
+
run: cat /transformers/reports/${{ matrix.machine_type }}_tests_torch_cuda_extensions_gpu/failures_short.txt
|
| 295 |
+
|
| 296 |
+
- name: "Test suite reports artifacts: ${{ matrix.machine_type }}_run_tests_torch_cuda_extensions_gpu_test_reports_postfix_${{ inputs.framework }}-${{ inputs.version }}"
|
| 297 |
+
if: ${{ always() }}
|
| 298 |
+
uses: actions/upload-artifact@v3
|
| 299 |
+
with:
|
| 300 |
+
name: ${{ matrix.machine_type }}_run_tests_torch_cuda_extensions_gpu_test_reports_postfix_${{ inputs.framework }}-${{ inputs.version }}
|
| 301 |
+
path: /transformers/reports/${{ matrix.machine_type }}_tests_torch_cuda_extensions_gpu
|
| 302 |
+
|
| 303 |
+
send_results:
|
| 304 |
+
name: Send results to webhook
|
| 305 |
+
runs-on: ubuntu-22.04
|
| 306 |
+
if: always()
|
| 307 |
+
needs: [
|
| 308 |
+
setup,
|
| 309 |
+
run_tests_single_gpu,
|
| 310 |
+
run_tests_multi_gpu,
|
| 311 |
+
run_all_tests_torch_cuda_extensions_gpu
|
| 312 |
+
]
|
| 313 |
+
steps:
|
| 314 |
+
- name: Preliminary job status
|
| 315 |
+
shell: bash
|
| 316 |
+
# For the meaning of these environment variables, see the job `Setup`
|
| 317 |
+
run: |
|
| 318 |
+
echo "Setup status: ${{ needs.setup.result }}"
|
| 319 |
+
|
| 320 |
+
- uses: actions/checkout@v3
|
| 321 |
+
- uses: actions/download-artifact@v3
|
| 322 |
+
|
| 323 |
+
# Create a directory to store test failure tables in the next step
|
| 324 |
+
- name: Create directory
|
| 325 |
+
run: mkdir test_failure_tables
|
| 326 |
+
|
| 327 |
+
- name: Send message to Slack
|
| 328 |
+
env:
|
| 329 |
+
CI_SLACK_BOT_TOKEN: ${{ secrets.CI_SLACK_BOT_TOKEN }}
|
| 330 |
+
CI_SLACK_CHANNEL_ID: ${{ secrets.CI_SLACK_CHANNEL_ID }}
|
| 331 |
+
CI_SLACK_CHANNEL_ID_DAILY: ${{ secrets.CI_SLACK_CHANNEL_ID_DAILY }}
|
| 332 |
+
CI_SLACK_CHANNEL_DUMMY_TESTS: ${{ secrets.CI_SLACK_CHANNEL_DUMMY_TESTS }}
|
| 333 |
+
CI_SLACK_REPORT_CHANNEL_ID: ${{ secrets.CI_SLACK_CHANNEL_ID_PAST_FUTURE }}
|
| 334 |
+
ACCESS_REPO_INFO_TOKEN: ${{ secrets.ACCESS_REPO_INFO_TOKEN }}
|
| 335 |
+
CI_EVENT: Past CI - ${{ inputs.framework }}-${{ inputs.version }}
|
| 336 |
+
SETUP_STATUS: ${{ needs.setup.result }}
|
| 337 |
+
# We pass `needs.setup.outputs.matrix` as the argument. A processing in `notification_service.py` to change
|
| 338 |
+
# `models/bert` to `models_bert` is required, as the artifact names use `_` instead of `/`.
|
| 339 |
+
run: |
|
| 340 |
+
pip install slack_sdk
|
| 341 |
+
pip show slack_sdk
|
| 342 |
+
python utils/notification_service.py "${{ needs.setup.outputs.matrix }}"
|
| 343 |
+
|
| 344 |
+
# Upload complete failure tables, as they might be big and only truncated versions could be sent to Slack.
|
| 345 |
+
- name: Failure table artifacts
|
| 346 |
+
if: ${{ always() }}
|
| 347 |
+
uses: actions/upload-artifact@v3
|
| 348 |
+
with:
|
| 349 |
+
name: test_failure_tables_${{ inputs.framework }}-${{ inputs.version }}
|
| 350 |
+
path: test_failure_tables
|
| 351 |
+
|
| 352 |
+
# delete-artifact
|
| 353 |
+
- uses: geekyeggo/delete-artifact@v2
|
| 354 |
+
with:
|
| 355 |
+
name: |
|
| 356 |
+
single-*
|
| 357 |
+
multi-*
|
transformers/.github/workflows/self-push-amd-mi210-caller.yml
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Self-hosted runner (AMD mi210 CI caller)
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
workflow_run:
|
| 5 |
+
workflows: ["Self-hosted runner (push-caller)"]
|
| 6 |
+
branches: ["main"]
|
| 7 |
+
types: [completed]
|
| 8 |
+
push:
|
| 9 |
+
branches:
|
| 10 |
+
- run_amd_push_ci_caller*
|
| 11 |
+
paths:
|
| 12 |
+
- "src/**"
|
| 13 |
+
- "tests/**"
|
| 14 |
+
- ".github/**"
|
| 15 |
+
- "templates/**"
|
| 16 |
+
- "utils/**"
|
| 17 |
+
|
| 18 |
+
jobs:
|
| 19 |
+
run_amd_ci:
|
| 20 |
+
name: AMD mi210
|
| 21 |
+
if: (cancelled() != true) && ((github.event_name == 'workflow_run') || ((github.event_name == 'push') && startsWith(github.ref_name, 'run_amd_push_ci_caller')))
|
| 22 |
+
uses: ./.github/workflows/self-push-amd.yml
|
| 23 |
+
with:
|
| 24 |
+
gpu_flavor: mi210
|
| 25 |
+
secrets: inherit
|
transformers/.github/workflows/self-push-amd-mi250-caller.yml
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Self-hosted runner (AMD mi250 CI caller)
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
workflow_run:
|
| 5 |
+
workflows: ["Self-hosted runner (push-caller)"]
|
| 6 |
+
branches: ["main"]
|
| 7 |
+
types: [completed]
|
| 8 |
+
push:
|
| 9 |
+
branches:
|
| 10 |
+
- run_amd_push_ci_caller*
|
| 11 |
+
paths:
|
| 12 |
+
- "src/**"
|
| 13 |
+
- "tests/**"
|
| 14 |
+
- ".github/**"
|
| 15 |
+
- "templates/**"
|
| 16 |
+
- "utils/**"
|
| 17 |
+
|
| 18 |
+
jobs:
|
| 19 |
+
run_amd_ci:
|
| 20 |
+
name: AMD mi250
|
| 21 |
+
if: (cancelled() != true) && ((github.event_name == 'workflow_run') || ((github.event_name == 'push') && startsWith(github.ref_name, 'run_amd_push_ci_caller')))
|
| 22 |
+
uses: ./.github/workflows/self-push-amd.yml
|
| 23 |
+
with:
|
| 24 |
+
gpu_flavor: mi250
|
| 25 |
+
secrets: inherit
|
transformers/.github/workflows/self-push-amd.yml
ADDED
|
@@ -0,0 +1,329 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Self-hosted runner AMD GPU (push)
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
workflow_call:
|
| 5 |
+
inputs:
|
| 6 |
+
gpu_flavor:
|
| 7 |
+
required: true
|
| 8 |
+
type: string
|
| 9 |
+
|
| 10 |
+
env:
|
| 11 |
+
HF_HOME: /mnt/cache
|
| 12 |
+
TRANSFORMERS_IS_CI: yes
|
| 13 |
+
OMP_NUM_THREADS: 8
|
| 14 |
+
MKL_NUM_THREADS: 8
|
| 15 |
+
PYTEST_TIMEOUT: 60
|
| 16 |
+
TF_FORCE_GPU_ALLOW_GROWTH: true
|
| 17 |
+
RUN_PT_TF_CROSS_TESTS: 1
|
| 18 |
+
HF_HUB_READ_TOKEN: ${{ secrets.HF_HUB_READ_TOKEN }}
|
| 19 |
+
|
| 20 |
+
jobs:
|
| 21 |
+
check_runner_status:
|
| 22 |
+
name: Check Runner Status
|
| 23 |
+
runs-on: ubuntu-22.04
|
| 24 |
+
steps:
|
| 25 |
+
- name: Checkout transformers
|
| 26 |
+
uses: actions/checkout@v3
|
| 27 |
+
with:
|
| 28 |
+
fetch-depth: 2
|
| 29 |
+
|
| 30 |
+
- name: Check Runner Status
|
| 31 |
+
run: python utils/check_self_hosted_runner.py --target_runners amd-mi210-single-gpu-ci-runner-docker --token ${{ secrets.ACCESS_REPO_INFO_TOKEN }}
|
| 32 |
+
|
| 33 |
+
check_runners:
|
| 34 |
+
name: Check Runners
|
| 35 |
+
needs: check_runner_status
|
| 36 |
+
strategy:
|
| 37 |
+
matrix:
|
| 38 |
+
machine_type: [single-gpu, multi-gpu]
|
| 39 |
+
runs-on: [self-hosted, docker-gpu, amd-gpu, '${{ matrix.machine_type }}', '${{ inputs.gpu_flavor }}']
|
| 40 |
+
container:
|
| 41 |
+
image: huggingface/transformers-pytorch-amd-gpu-push-ci # <--- We test only for PyTorch for now
|
| 42 |
+
options: --device /dev/kfd --device /dev/dri --env ROCR_VISIBLE_DEVICES --shm-size "16gb" --ipc host -v /mnt/cache/.cache/huggingface:/mnt/cache/
|
| 43 |
+
steps:
|
| 44 |
+
- name: ROCM-SMI
|
| 45 |
+
run: |
|
| 46 |
+
rocm-smi
|
| 47 |
+
- name: ROCM-INFO
|
| 48 |
+
run: |
|
| 49 |
+
rocminfo | grep "Agent" -A 14
|
| 50 |
+
- name: Show ROCR environment
|
| 51 |
+
run: |
|
| 52 |
+
echo "ROCR: $ROCR_VISIBLE_DEVICES"
|
| 53 |
+
|
| 54 |
+
setup_gpu:
|
| 55 |
+
name: Setup
|
| 56 |
+
needs: check_runners
|
| 57 |
+
strategy:
|
| 58 |
+
matrix:
|
| 59 |
+
machine_type: [single-gpu, multi-gpu]
|
| 60 |
+
runs-on: [self-hosted, docker-gpu, amd-gpu, '${{ matrix.machine_type }}', '${{ inputs.gpu_flavor }}']
|
| 61 |
+
container:
|
| 62 |
+
image: huggingface/transformers-pytorch-amd-gpu-push-ci # <--- We test only for PyTorch for now
|
| 63 |
+
options: --device /dev/kfd --device /dev/dri --env ROCR_VISIBLE_DEVICES --shm-size "16gb" --ipc host -v /mnt/cache/.cache/huggingface:/mnt/cache/
|
| 64 |
+
outputs:
|
| 65 |
+
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
| 66 |
+
test_map: ${{ steps.set-matrix.outputs.test_map }}
|
| 67 |
+
steps:
|
| 68 |
+
# Necessary to get the correct branch name and commit SHA for `workflow_run` event
|
| 69 |
+
# We also take into account the `push` event (we might want to test some changes in a branch)
|
| 70 |
+
- name: Prepare custom environment variables
|
| 71 |
+
shell: bash
|
| 72 |
+
# `CI_BRANCH_PUSH`: The branch name from the push event
|
| 73 |
+
# `CI_BRANCH_WORKFLOW_RUN`: The name of the branch on which this workflow is triggered by `workflow_run` event
|
| 74 |
+
# `CI_BRANCH`: The non-empty branch name from the above two (one and only one of them is empty)
|
| 75 |
+
# `CI_SHA_PUSH`: The commit SHA from the push event
|
| 76 |
+
# `CI_SHA_WORKFLOW_RUN`: The commit SHA that triggers this workflow by `workflow_run` event
|
| 77 |
+
# `CI_SHA`: The non-empty commit SHA from the above two (one and only one of them is empty)
|
| 78 |
+
run: |
|
| 79 |
+
CI_BRANCH_PUSH=${{ github.event.ref }}
|
| 80 |
+
CI_BRANCH_PUSH=${CI_BRANCH_PUSH/'refs/heads/'/''}
|
| 81 |
+
CI_BRANCH_WORKFLOW_RUN=${{ github.event.workflow_run.head_branch }}
|
| 82 |
+
CI_SHA_PUSH=${{ github.event.head_commit.id }}
|
| 83 |
+
CI_SHA_WORKFLOW_RUN=${{ github.event.workflow_run.head_sha }}
|
| 84 |
+
echo $CI_BRANCH_PUSH
|
| 85 |
+
echo $CI_BRANCH_WORKFLOW_RUN
|
| 86 |
+
echo $CI_SHA_PUSH
|
| 87 |
+
echo $CI_SHA_WORKFLOW_RUN
|
| 88 |
+
[[ ! -z "$CI_BRANCH_PUSH" ]] && echo "CI_BRANCH=$CI_BRANCH_PUSH" >> $GITHUB_ENV || echo "CI_BRANCH=$CI_BRANCH_WORKFLOW_RUN" >> $GITHUB_ENV
|
| 89 |
+
[[ ! -z "$CI_SHA_PUSH" ]] && echo "CI_SHA=$CI_SHA_PUSH" >> $GITHUB_ENV || echo "CI_SHA=$CI_SHA_WORKFLOW_RUN" >> $GITHUB_ENV
|
| 90 |
+
|
| 91 |
+
- name: print environment variables
|
| 92 |
+
run: |
|
| 93 |
+
echo "env.CI_BRANCH = ${{ env.CI_BRANCH }}"
|
| 94 |
+
echo "env.CI_SHA = ${{ env.CI_SHA }}"
|
| 95 |
+
|
| 96 |
+
- name: Update clone using environment variables
|
| 97 |
+
working-directory: /transformers
|
| 98 |
+
run: |
|
| 99 |
+
echo "original branch = $(git branch --show-current)"
|
| 100 |
+
git fetch && git checkout ${{ env.CI_BRANCH }}
|
| 101 |
+
echo "updated branch = $(git branch --show-current)"
|
| 102 |
+
git checkout ${{ env.CI_SHA }}
|
| 103 |
+
echo "log = $(git log -n 1)"
|
| 104 |
+
|
| 105 |
+
- name: Cleanup
|
| 106 |
+
working-directory: /transformers
|
| 107 |
+
run: |
|
| 108 |
+
rm -rf tests/__pycache__
|
| 109 |
+
rm -rf tests/models/__pycache__
|
| 110 |
+
rm -rf reports
|
| 111 |
+
|
| 112 |
+
- name: Show installed libraries and their versions
|
| 113 |
+
working-directory: /transformers
|
| 114 |
+
run: pip freeze
|
| 115 |
+
|
| 116 |
+
- name: Fetch the tests to run
|
| 117 |
+
working-directory: /transformers
|
| 118 |
+
# TODO: add `git-python` in the docker images
|
| 119 |
+
run: |
|
| 120 |
+
pip install --upgrade git-python
|
| 121 |
+
python3 utils/tests_fetcher.py --diff_with_last_commit | tee test_preparation.txt
|
| 122 |
+
|
| 123 |
+
- name: Report fetched tests
|
| 124 |
+
uses: actions/upload-artifact@v3
|
| 125 |
+
with:
|
| 126 |
+
name: test_fetched
|
| 127 |
+
path: /transformers/test_preparation.txt
|
| 128 |
+
|
| 129 |
+
- id: set-matrix
|
| 130 |
+
name: Organize tests into models
|
| 131 |
+
working-directory: /transformers
|
| 132 |
+
# The `keys` is used as GitHub actions matrix for jobs, i.e. `models/bert`, `tokenization`, `pipeline`, etc.
|
| 133 |
+
# The `test_map` is used to get the actual identified test files under each key.
|
| 134 |
+
# If no test to run (so no `test_map.json` file), create a dummy map (empty matrix will fail)
|
| 135 |
+
run: |
|
| 136 |
+
if [ -f test_map.json ]; then
|
| 137 |
+
keys=$(python3 -c 'import json; fp = open("test_map.json"); test_map = json.load(fp); fp.close(); d = list(test_map.keys()); print(d)')
|
| 138 |
+
test_map=$(python3 -c 'import json; fp = open("test_map.json"); test_map = json.load(fp); fp.close(); print(test_map)')
|
| 139 |
+
else
|
| 140 |
+
keys=$(python3 -c 'keys = ["dummy"]; print(keys)')
|
| 141 |
+
test_map=$(python3 -c 'test_map = {"dummy": []}; print(test_map)')
|
| 142 |
+
fi
|
| 143 |
+
echo $keys
|
| 144 |
+
echo $test_map
|
| 145 |
+
echo "matrix=$keys" >> $GITHUB_OUTPUT
|
| 146 |
+
echo "test_map=$test_map" >> $GITHUB_OUTPUT
|
| 147 |
+
|
| 148 |
+
run_tests_amdgpu:
|
| 149 |
+
name: Model tests
|
| 150 |
+
needs: setup_gpu
|
| 151 |
+
# `dummy` means there is no test to run
|
| 152 |
+
if: contains(fromJson(needs.setup_gpu.outputs.matrix), 'dummy') != true
|
| 153 |
+
strategy:
|
| 154 |
+
fail-fast: false
|
| 155 |
+
matrix:
|
| 156 |
+
folders: ${{ fromJson(needs.setup_gpu.outputs.matrix) }}
|
| 157 |
+
machine_type: [single-gpu, multi-gpu]
|
| 158 |
+
runs-on: [self-hosted, docker-gpu, amd-gpu, '${{ matrix.machine_type }}', '${{ inputs.gpu_flavor }}']
|
| 159 |
+
container:
|
| 160 |
+
image: huggingface/transformers-pytorch-amd-gpu-push-ci # <--- We test only for PyTorch for now
|
| 161 |
+
options: --device /dev/kfd --device /dev/dri --env ROCR_VISIBLE_DEVICES --shm-size "16gb" --ipc host -v /mnt/cache/.cache/huggingface:/mnt/cache/
|
| 162 |
+
steps:
|
| 163 |
+
# Necessary to get the correct branch name and commit SHA for `workflow_run` event
|
| 164 |
+
# We also take into account the `push` event (we might want to test some changes in a branch)
|
| 165 |
+
- name: Prepare custom environment variables
|
| 166 |
+
shell: bash
|
| 167 |
+
# For the meaning of these environment variables, see the job `Setup`
|
| 168 |
+
run: |
|
| 169 |
+
CI_BRANCH_PUSH=${{ github.event.ref }}
|
| 170 |
+
CI_BRANCH_PUSH=${CI_BRANCH_PUSH/'refs/heads/'/''}
|
| 171 |
+
CI_BRANCH_WORKFLOW_RUN=${{ github.event.workflow_run.head_branch }}
|
| 172 |
+
CI_SHA_PUSH=${{ github.event.head_commit.id }}
|
| 173 |
+
CI_SHA_WORKFLOW_RUN=${{ github.event.workflow_run.head_sha }}
|
| 174 |
+
echo $CI_BRANCH_PUSH
|
| 175 |
+
echo $CI_BRANCH_WORKFLOW_RUN
|
| 176 |
+
echo $CI_SHA_PUSH
|
| 177 |
+
echo $CI_SHA_WORKFLOW_RUN
|
| 178 |
+
[[ ! -z "$CI_BRANCH_PUSH" ]] && echo "CI_BRANCH=$CI_BRANCH_PUSH" >> $GITHUB_ENV || echo "CI_BRANCH=$CI_BRANCH_WORKFLOW_RUN" >> $GITHUB_ENV
|
| 179 |
+
[[ ! -z "$CI_SHA_PUSH" ]] && echo "CI_SHA=$CI_SHA_PUSH" >> $GITHUB_ENV || echo "CI_SHA=$CI_SHA_WORKFLOW_RUN" >> $GITHUB_ENV
|
| 180 |
+
|
| 181 |
+
- name: print environment variables
|
| 182 |
+
run: |
|
| 183 |
+
echo "env.CI_BRANCH = ${{ env.CI_BRANCH }}"
|
| 184 |
+
echo "env.CI_SHA = ${{ env.CI_SHA }}"
|
| 185 |
+
|
| 186 |
+
- name: Update clone using environment variables
|
| 187 |
+
working-directory: /transformers
|
| 188 |
+
run: |
|
| 189 |
+
echo "original branch = $(git branch --show-current)"
|
| 190 |
+
git fetch && git checkout ${{ env.CI_BRANCH }}
|
| 191 |
+
echo "updated branch = $(git branch --show-current)"
|
| 192 |
+
git checkout ${{ env.CI_SHA }}
|
| 193 |
+
echo "log = $(git log -n 1)"
|
| 194 |
+
|
| 195 |
+
- name: Reinstall transformers in edit mode (remove the one installed during docker image build)
|
| 196 |
+
working-directory: /transformers
|
| 197 |
+
run: python3 -m pip uninstall -y transformers && python3 -m pip install -e .
|
| 198 |
+
|
| 199 |
+
- name: Echo folder ${{ matrix.folders }}
|
| 200 |
+
shell: bash
|
| 201 |
+
# For folders like `models/bert`, set an env. var. (`matrix_folders`) to `models_bert`, which will be used to
|
| 202 |
+
# set the artifact folder names (because the character `/` is not allowed).
|
| 203 |
+
run: |
|
| 204 |
+
echo "${{ matrix.folders }}"
|
| 205 |
+
echo "${{ fromJson(needs.setup_gpu.outputs.test_map)[matrix.folders] }}"
|
| 206 |
+
matrix_folders=${{ matrix.folders }}
|
| 207 |
+
matrix_folders=${matrix_folders/'models/'/'models_'}
|
| 208 |
+
echo "$matrix_folders"
|
| 209 |
+
echo "matrix_folders=$matrix_folders" >> $GITHUB_ENV
|
| 210 |
+
|
| 211 |
+
- name: ROCM-SMI
|
| 212 |
+
run: |
|
| 213 |
+
rocm-smi
|
| 214 |
+
- name: ROCM-INFO
|
| 215 |
+
run: |
|
| 216 |
+
rocminfo | grep "Agent" -A 14
|
| 217 |
+
- name: Show ROCR environment
|
| 218 |
+
run: |
|
| 219 |
+
echo "ROCR: $ROCR_VISIBLE_DEVICES"
|
| 220 |
+
|
| 221 |
+
- name: Environment
|
| 222 |
+
working-directory: /transformers
|
| 223 |
+
run: |
|
| 224 |
+
python3 utils/print_env.py
|
| 225 |
+
|
| 226 |
+
- name: Show installed libraries and their versions
|
| 227 |
+
working-directory: /transformers
|
| 228 |
+
run: pip freeze
|
| 229 |
+
|
| 230 |
+
- name: Run all non-slow selected tests on GPU
|
| 231 |
+
working-directory: /transformers
|
| 232 |
+
run: |
|
| 233 |
+
python3 -m pytest -n 2 --dist=loadfile -v --make-reports=${{ matrix.machine_type }}_tests_gpu_${{ matrix.folders }} ${{ fromJson(needs.setup_gpu.outputs.test_map)[matrix.folders] }}
|
| 234 |
+
|
| 235 |
+
- name: Failure short reports
|
| 236 |
+
if: ${{ failure() }}
|
| 237 |
+
continue-on-error: true
|
| 238 |
+
run: cat /transformers/reports/${{ matrix.machine_type }}_tests_gpu_${{ matrix.folders }}/failures_short.txt
|
| 239 |
+
|
| 240 |
+
- name: "Test suite reports artifacts: ${{ matrix.machine_type }}_run_all_tests_gpu_${{ env.matrix_folders }}_test_reports"
|
| 241 |
+
if: ${{ always() }}
|
| 242 |
+
uses: actions/upload-artifact@v3
|
| 243 |
+
with:
|
| 244 |
+
name: ${{ matrix.machine_type }}_run_all_tests_gpu_${{ env.matrix_folders }}_test_reports
|
| 245 |
+
path: /transformers/reports/${{ matrix.machine_type }}_tests_gpu_${{ matrix.folders }}
|
| 246 |
+
|
| 247 |
+
send_results:
|
| 248 |
+
name: Send results to webhook
|
| 249 |
+
runs-on: ubuntu-22.04
|
| 250 |
+
if: always()
|
| 251 |
+
needs: [
|
| 252 |
+
check_runner_status,
|
| 253 |
+
check_runners,
|
| 254 |
+
setup_gpu,
|
| 255 |
+
run_tests_amdgpu,
|
| 256 |
+
# run_tests_torch_cuda_extensions_single_gpu,
|
| 257 |
+
# run_tests_torch_cuda_extensions_multi_gpu
|
| 258 |
+
]
|
| 259 |
+
steps:
|
| 260 |
+
- name: Preliminary job status
|
| 261 |
+
shell: bash
|
| 262 |
+
# For the meaning of these environment variables, see the job `Setup`
|
| 263 |
+
run: |
|
| 264 |
+
echo "Runner availability: ${{ needs.check_runner_status.result }}"
|
| 265 |
+
echo "Setup status: ${{ needs.setup_gpu.result }}"
|
| 266 |
+
echo "Runner status: ${{ needs.check_runners.result }}"
|
| 267 |
+
|
| 268 |
+
# Necessary to get the correct branch name and commit SHA for `workflow_run` event
|
| 269 |
+
# We also take into account the `push` event (we might want to test some changes in a branch)
|
| 270 |
+
- name: Prepare custom environment variables
|
| 271 |
+
shell: bash
|
| 272 |
+
# For the meaning of these environment variables, see the job `Setup`
|
| 273 |
+
run: |
|
| 274 |
+
CI_BRANCH_PUSH=${{ github.event.ref }}
|
| 275 |
+
CI_BRANCH_PUSH=${CI_BRANCH_PUSH/'refs/heads/'/''}
|
| 276 |
+
CI_BRANCH_WORKFLOW_RUN=${{ github.event.workflow_run.head_branch }}
|
| 277 |
+
CI_SHA_PUSH=${{ github.event.head_commit.id }}
|
| 278 |
+
CI_SHA_WORKFLOW_RUN=${{ github.event.workflow_run.head_sha }}
|
| 279 |
+
echo $CI_BRANCH_PUSH
|
| 280 |
+
echo $CI_BRANCH_WORKFLOW_RUN
|
| 281 |
+
echo $CI_SHA_PUSH
|
| 282 |
+
echo $CI_SHA_WORKFLOW_RUN
|
| 283 |
+
[[ ! -z "$CI_BRANCH_PUSH" ]] && echo "CI_BRANCH=$CI_BRANCH_PUSH" >> $GITHUB_ENV || echo "CI_BRANCH=$CI_BRANCH_WORKFLOW_RUN" >> $GITHUB_ENV
|
| 284 |
+
[[ ! -z "$CI_SHA_PUSH" ]] && echo "CI_SHA=$CI_SHA_PUSH" >> $GITHUB_ENV || echo "CI_SHA=$CI_SHA_WORKFLOW_RUN" >> $GITHUB_ENV
|
| 285 |
+
|
| 286 |
+
- name: print environment variables
|
| 287 |
+
run: |
|
| 288 |
+
echo "env.CI_BRANCH = ${{ env.CI_BRANCH }}"
|
| 289 |
+
echo "env.CI_SHA = ${{ env.CI_SHA }}"
|
| 290 |
+
|
| 291 |
+
- uses: actions/checkout@v3
|
| 292 |
+
# To avoid failure when multiple commits are merged into `main` in a short period of time.
|
| 293 |
+
# Checking out to an old commit beyond the fetch depth will get an error `fatal: reference is not a tree: ...
|
| 294 |
+
# (Only required for `workflow_run` event, where we get the latest HEAD on `main` instead of the event commit)
|
| 295 |
+
with:
|
| 296 |
+
fetch-depth: 20
|
| 297 |
+
|
| 298 |
+
- name: Update clone using environment variables
|
| 299 |
+
run: |
|
| 300 |
+
echo "original branch = $(git branch --show-current)"
|
| 301 |
+
git fetch && git checkout ${{ env.CI_BRANCH }}
|
| 302 |
+
echo "updated branch = $(git branch --show-current)"
|
| 303 |
+
git checkout ${{ env.CI_SHA }}
|
| 304 |
+
echo "log = $(git log -n 1)"
|
| 305 |
+
|
| 306 |
+
- uses: actions/download-artifact@v3
|
| 307 |
+
- name: Send message to Slack
|
| 308 |
+
env:
|
| 309 |
+
CI_SLACK_BOT_TOKEN: ${{ secrets.CI_SLACK_BOT_TOKEN }}
|
| 310 |
+
CI_SLACK_CHANNEL_ID: ${{ secrets.CI_SLACK_CHANNEL_ID }}
|
| 311 |
+
CI_SLACK_CHANNEL_ID_DAILY: ${{ secrets.CI_SLACK_CHANNEL_ID_DAILY }}
|
| 312 |
+
CI_SLACK_CHANNEL_ID_AMD: ${{ secrets.CI_SLACK_CHANNEL_ID_AMD }}
|
| 313 |
+
CI_SLACK_CHANNEL_DUMMY_TESTS: ${{ secrets.CI_SLACK_CHANNEL_DUMMY_TESTS }}
|
| 314 |
+
CI_SLACK_REPORT_CHANNEL_ID: ${{ secrets.CI_SLACK_CHANNEL_ID_AMD }}
|
| 315 |
+
ACCESS_REPO_INFO_TOKEN: ${{ secrets.ACCESS_REPO_INFO_TOKEN }}
|
| 316 |
+
CI_EVENT: Push CI (AMD) - ${{ inputs.gpu_flavor }}
|
| 317 |
+
CI_TITLE_PUSH: ${{ github.event.head_commit.message }}
|
| 318 |
+
CI_TITLE_WORKFLOW_RUN: ${{ github.event.workflow_run.head_commit.message }}
|
| 319 |
+
CI_SHA: ${{ env.CI_SHA }}
|
| 320 |
+
RUNNER_STATUS: ${{ needs.check_runner_status.result }}
|
| 321 |
+
RUNNER_ENV_STATUS: ${{ needs.check_runners.result }}
|
| 322 |
+
SETUP_STATUS: ${{ needs.setup_gpu.result }}
|
| 323 |
+
|
| 324 |
+
# We pass `needs.setup_gpu.outputs.matrix` as the argument. A processing in `notification_service.py` to change
|
| 325 |
+
# `models/bert` to `models_bert` is required, as the artifact names use `_` instead of `/`.
|
| 326 |
+
run: |
|
| 327 |
+
pip install slack_sdk
|
| 328 |
+
pip show slack_sdk
|
| 329 |
+
python utils/notification_service.py "${{ needs.setup_gpu.outputs.matrix }}"
|