Skip to content

Commit

Permalink
Merge pull request huggingface#7 from huggingface/main
Browse files Browse the repository at this point in the history
goog
  • Loading branch information
jamesthesnake authored Mar 28, 2023
2 parents c599e98 + b29fd69 commit 9aecbdf
Show file tree
Hide file tree
Showing 1,167 changed files with 72,536 additions and 7,195 deletions.
18 changes: 9 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
# Ensure running with CircleCI/huggingface
check_circleci_user:
docker:
- image: cimg/python:3.7.12
- image: cimg/python:3.8.12
parallelism: 1
steps:
- run: echo $CIRCLE_PROJECT_USERNAME
Expand All @@ -26,7 +26,7 @@ jobs:
fetch_tests:
working_directory: ~/transformers
docker:
- image: cimg/python:3.7.12
- image: cimg/python:3.8.12
parallelism: 1
steps:
- checkout
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
fetch_all_tests:
working_directory: ~/transformers
docker:
- image: cimg/python:3.7.12
- image: cimg/python:3.8.12
parallelism: 1
steps:
- checkout
Expand All @@ -111,7 +111,7 @@ jobs:
check_code_quality:
working_directory: ~/transformers
docker:
- image: cimg/python:3.7.12
- image: cimg/python:3.8.12
resource_class: large
environment:
TRANSFORMERS_IS_CI: yes
Expand All @@ -121,8 +121,8 @@ jobs:
- checkout
- restore_cache:
keys:
- v0.5-code_quality-{{ checksum "setup.py" }}
- v0.5-code-quality
- v0.6-code_quality-{{ checksum "setup.py" }}
- v0.6-code-quality
- run: pip install --upgrade pip
- run: pip install .[all,quality]
- save_cache:
Expand All @@ -144,7 +144,7 @@ jobs:
check_repository_consistency:
working_directory: ~/transformers
docker:
- image: cimg/python:3.7.12
- image: cimg/python:3.8.12
resource_class: large
environment:
TRANSFORMERS_IS_CI: yes
Expand All @@ -154,8 +154,8 @@ jobs:
- checkout
- restore_cache:
keys:
- v0.5-repository_consistency-{{ checksum "setup.py" }}
- v0.5-repository_consistency
- v0.6-repository_consistency-{{ checksum "setup.py" }}
- v0.6-repository_consistency
- run: pip install --upgrade pip
- run: pip install .[all,quality]
- save_cache:
Expand Down
34 changes: 24 additions & 10 deletions .circleci/create_circleci_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,24 @@
import yaml


COMMON_ENV_VARIABLES = {"OMP_NUM_THREADS": 1, "TRANSFORMERS_IS_CI": True, "PYTEST_TIMEOUT": 120}
COMMON_ENV_VARIABLES = {
"OMP_NUM_THREADS": 1,
"TRANSFORMERS_IS_CI": True,
"PYTEST_TIMEOUT": 120,
"RUN_PIPELINE_TESTS": False,
"RUN_PT_TF_CROSS_TESTS": False,
"RUN_PT_FLAX_CROSS_TESTS": False,
}
COMMON_PYTEST_OPTIONS = {"max-worker-restart": 0, "dist": "loadfile", "s": None}
DEFAULT_DOCKER_IMAGE = [{"image": "cimg/python:3.7.12"}]
DEFAULT_DOCKER_IMAGE = [{"image": "cimg/python:3.8.12"}]


@dataclass
class CircleCIJob:
name: str
additional_env: Dict[str, Any] = None
cache_name: str = None
cache_version: str = "0.5"
cache_version: str = "0.6"
docker_image: List[Dict[str, str]] = None
install_steps: List[str] = None
marker: Optional[str] = None
Expand Down Expand Up @@ -64,10 +71,12 @@ def __post_init__(self):
self.parallelism = 1

def to_dict(self):
env = COMMON_ENV_VARIABLES.copy()
env.update(self.additional_env)
job = {
"working_directory": self.working_directory,
"docker": self.docker_image,
"environment": {**COMMON_ENV_VARIABLES, **self.additional_env},
"environment": env,
}
if self.resource_class is not None:
job["resource_class"] = self.resource_class
Expand Down Expand Up @@ -173,7 +182,7 @@ def job_name(self):
"torch_and_tf",
additional_env={"RUN_PT_TF_CROSS_TESTS": True},
install_steps=[
"sudo apt-get -y update && sudo apt-get install -y libsndfile1-dev espeak-ng git-lfs",
"sudo apt-get -y update && sudo apt-get install -y libsndfile1-dev espeak-ng git-lfs cmake",
"git lfs install",
"pip install --upgrade pip",
"pip install .[sklearn,tf-cpu,torch,testing,sentencepiece,torch-speech,vision]",
Expand Down Expand Up @@ -215,7 +224,7 @@ def job_name(self):
tf_job = CircleCIJob(
"tf",
install_steps=[
"sudo apt-get -y update && sudo apt-get install -y libsndfile1-dev espeak-ng",
"sudo apt-get -y update && sudo apt-get install -y libsndfile1-dev espeak-ng cmake",
"pip install --upgrade pip",
"pip install .[sklearn,tf-cpu,testing,sentencepiece,tf-speech,vision]",
"pip install tensorflow_probability",
Expand All @@ -239,25 +248,28 @@ def job_name(self):

pipelines_torch_job = CircleCIJob(
"pipelines_torch",
additional_env={"RUN_PIPELINE_TESTS": True},
install_steps=[
"sudo apt-get -y update && sudo apt-get install -y libsndfile1-dev espeak-ng",
"pip install --upgrade pip",
"pip install .[sklearn,torch,testing,sentencepiece,torch-speech,vision,timm,video]",
],
pytest_options={"rA": None},
tests_to_run="tests/pipelines/"
marker="is_pipeline_test",
)


pipelines_tf_job = CircleCIJob(
"pipelines_tf",
additional_env={"RUN_PIPELINE_TESTS": True},
install_steps=[
"sudo apt-get -y update && sudo apt-get install -y cmake",
"pip install --upgrade pip",
"pip install .[sklearn,tf-cpu,testing,sentencepiece,vision]",
"pip install tensorflow_probability",
],
pytest_options={"rA": None},
tests_to_run="tests/pipelines/"
marker="is_pipeline_test",
)


Expand Down Expand Up @@ -307,6 +319,7 @@ def job_name(self):
"examples_tensorflow",
cache_name="tensorflow_examples",
install_steps=[
"sudo apt-get -y update && sudo apt-get install -y cmake",
"pip install --upgrade pip",
"pip install .[sklearn,tensorflow,sentencepiece,testing]",
"pip install -r examples/tensorflow/_tests_requirements.txt",
Expand Down Expand Up @@ -344,6 +357,7 @@ def job_name(self):
onnx_job = CircleCIJob(
"onnx",
install_steps=[
"sudo apt-get -y update && sudo apt-get install -y cmake",
"pip install --upgrade pip",
"pip install .[torch,tf,testing,sentencepiece,onnxruntime,vision,rjieba]",
],
Expand Down Expand Up @@ -379,11 +393,11 @@ def job_name(self):
"repo_utils",
install_steps=[
"pip install --upgrade pip",
"pip install .[quality,testing]",
"pip install .[quality,testing,torch]",
],
parallelism=None,
pytest_num_workers=1,
resource_class=None,
resource_class="large",
tests_to_run="tests/repo_utils",
)

Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/build-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ jobs:
name: "Latest PyTorch + TensorFlow [dev]"
runs-on: ubuntu-latest
steps:
- name: Cleanup disk
run: |
sudo ls -l /usr/local/lib/
sudo ls -l /usr/share/
sudo du -sh /usr/local/lib/
sudo du -sh /usr/share/
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
sudo du -sh /usr/local/lib/
sudo du -sh /usr/share/
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/check_runner_status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
CI_SLACK_CHANNEL_ID_DAILY: ${{ secrets.CI_SLACK_CHANNEL_ID_DAILY }}
CI_SLACK_CHANNEL_DUMMY_TESTS: ${{ secrets.CI_SLACK_CHANNEL_DUMMY_TESTS }}
CI_SLACK_REPORT_CHANNEL_ID: ${{ secrets.CI_SLACK_CHANNEL_ID_DAILY }}
ACCESS_REPO_INFO_TOKEN: ${{ secrets.ACCESS_REPO_INFO_TOKEN }}
CI_EVENT: runner status check
RUNNER_STATUS: ${{ needs.check_runner_status.result }}
OFFLINE_RUNNERS: ${{ needs.check_runner_status.outputs.offline_runners }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/doctests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ jobs:
run: |
python3 utils/print_env.py
- name: Show installed libraries and their versions
run: pip freeze

- name: Prepare files for doctests
run: |
python3 utils/prepare_for_doc_test.py src docs
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/self-nightly-scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ jobs:
CI_SLACK_CHANNEL_ID_DAILY: ${{ secrets.CI_SLACK_CHANNEL_ID_DAILY }}
CI_SLACK_CHANNEL_DUMMY_TESTS: ${{ secrets.CI_SLACK_CHANNEL_DUMMY_TESTS }}
CI_SLACK_REPORT_CHANNEL_ID: ${{ secrets.CI_SLACK_CHANNEL_ID_PAST_FUTURE }}
ACCESS_REPO_INFO_TOKEN: ${{ secrets.ACCESS_REPO_INFO_TOKEN }}
CI_EVENT: nightly-build
RUNNER_STATUS: ${{ needs.check_runner_status.result }}
RUNNER_ENV_STATUS: ${{ needs.check_runners.result }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/self-past.yml
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ jobs:
CI_SLACK_CHANNEL_ID_DAILY: ${{ secrets.CI_SLACK_CHANNEL_ID_DAILY }}
CI_SLACK_CHANNEL_DUMMY_TESTS: ${{ secrets.CI_SLACK_CHANNEL_DUMMY_TESTS }}
CI_SLACK_REPORT_CHANNEL_ID: ${{ secrets.CI_SLACK_CHANNEL_ID_PAST_FUTURE }}
ACCESS_REPO_INFO_TOKEN: ${{ secrets.ACCESS_REPO_INFO_TOKEN }}
CI_EVENT: Past CI - ${{ inputs.framework }}-${{ inputs.version }}
RUNNER_STATUS: ${{ needs.check_runner_status.result }}
RUNNER_ENV_STATUS: ${{ needs.check_runners.result }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/self-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ jobs:
CI_SLACK_CHANNEL_ID_DAILY: ${{ secrets.CI_SLACK_CHANNEL_ID_DAILY }}
CI_SLACK_CHANNEL_DUMMY_TESTS: ${{ secrets.CI_SLACK_CHANNEL_DUMMY_TESTS }}
CI_SLACK_REPORT_CHANNEL_ID: ${{ secrets.CI_SLACK_CHANNEL_ID }}
ACCESS_REPO_INFO_TOKEN: ${{ secrets.ACCESS_REPO_INFO_TOKEN }}
CI_EVENT: push
CI_TITLE_PUSH: ${{ github.event.head_commit.message }}
CI_TITLE_WORKFLOW_RUN: ${{ github.event.workflow_run.head_commit.message }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/self-scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ jobs:
CI_SLACK_CHANNEL_ID_DAILY: ${{ secrets.CI_SLACK_CHANNEL_ID_DAILY }}
CI_SLACK_CHANNEL_DUMMY_TESTS: ${{ secrets.CI_SLACK_CHANNEL_DUMMY_TESTS }}
CI_SLACK_REPORT_CHANNEL_ID: ${{ secrets.CI_SLACK_CHANNEL_ID_DAILY }}
ACCESS_REPO_INFO_TOKEN: ${{ secrets.ACCESS_REPO_INFO_TOKEN }}
CI_EVENT: scheduled
RUNNER_STATUS: ${{ needs.check_runner_status.result }}
RUNNER_ENV_STATUS: ${{ needs.check_runners.result }}
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/update_tiny_models.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Self-hosted runner (push)

on:
push:
branches:
- update_tiny_models*
repository_dispatch:
schedule:
- cron: "0 2 * * *"

env:
TOKEN: ${{ secrets.SYLVAIN_HF_TOKEN }}

jobs:
update_tiny_models:
name: Update tiny models
runs-on: ubuntu-latest
steps:
- name: Checkout transformers
uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Install
run: |
python -m pip install -U .[dev]
python -m pip install -U natten
- name: Update tiny models
run: |
python utils/update_tiny_models.py
- name: Full report
run: cat tiny_models/reports/tiny_model_creation_report.json

- name: Failure report
run: cat tiny_models/reports/simple_failed_report.txt

- name: Summary report
run: cat tiny_models/reports/tiny_model_summary.json

- name: Test suite reports artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: tiny_model_creation_reports
path: tiny_models/reports
Loading

0 comments on commit 9aecbdf

Please sign in to comment.