Unverified Commit 307f632b authored by Arthur's avatar Arthur Committed by GitHub
Browse files

[`CI update`] Try to use dockers and no cache (#29202)



* change cis

* nits

* update

* minor updates

* [push-ci-image]

* nit [push-ci-image]

* nitsssss

* [build-ci-image]

* [push-ci-image]

* [push-ci-image]

* both

* [push-ci-image]

* this?

* [push-ci-image]

* pypi-kenlm needs g++

* [push-ci-image]

* nit

* more nits [push-ci-image]

* nits [push-ci-image]

* [push-ci-image]

* [push-ci-image]

* [push-ci-image]

* add vision

* [push-ci-image]

* [push-ci-image]

* add new dummy file but will need to update them [push-ci-image]

* [push-ci-image]

* show package size as well

* [push-ci-image]

* potentially ignore failures

* workflow updates

* nits [push-ci-image]

* [push-ci-image]

* fix consistency

* clean nciida triton

* also show big packages [push-ci-image]

* nit

* update

* another one

* line escape?

* add accelerate [push-ci-image]

* updates [push-ci-image]

* nits to run tests, no push-ci

* try to parse skip reason to make sure nothing is skipped that should no be skippped

* nit?

* always show skipped reasons

* nits

* better parsing of the test outputs

* action="store_true",

* failure on failed

* show matched

* debug

* update short summary with skipped, failed and errors

* nits

* nits

* coolu pdates

* remove docbuilder

* fix

* always run checks

* oups

* nits

* don't error out on library printing

* non zero exi codes

* no warning

* nit

* WAT?

* format nit

* [push-ci-image]

* fail if fail is needed

* [push-ci-image]

* sound file for torch light?

* [push-ci-image]

* order is important [push-ci-image]

* [push-ci-image] reduce even further

* [push-ci-image]

* use pytest rich !

* yes [push-ci-image]

* oupsy

* bring back the full traceback, but pytest rich should help

* nit

* [push-ci-image]

* re run

* nit

* [push-ci-image]

* [push-ci-image]

* [push-ci-image]

* empty push to trigger

* [push-ci-image]

* nit? [push-ci-image]

* empty

* try to install timm with no deps

* [push-ci-image]

* oups [push-ci-image]

* [push-ci-image]

* [push-ci-image] ?

* [push-ci-image] open ssh client for git checkout fast

* empty for torch light

* updates [push-ci-image]

* nit

* @v4 for checkout

* [push-ci-image]

* [push-ci-image]

* fix fetch tests with parallelism

* [push-ci-image]

* more parallelism

* nit

* more nits

* empty to re-trigger

* empty to re-trigger

* split by timing

* did not work with previous commit

* junit.xml

* no path?

* mmm this?

* junitxml format

* split by timing

* nit

* fix junit family

* now we can test if the xunit1 is compatible!

* this?

* fully list tests

* update

* update

* oups

* finally

* use classname

* remove working directory to make sure the path does not interfere

* okay no juni should have the correct path

* name split?

* sort by classname is what make most sense

* some testing

* naem

* oups

* test something fun

* autodetect

* 18?

* nit

* file size?

* uip

* 4 is best

* update to see versions

* better print

* [push-ci-image]

* [push-ci-image]

* please install the correct keras version

* [push-ci-image]

* [push-ci-image]

* [push-ci-image]

* [push-ci-image]

* [push-ci-image]

* uv is fucking me up

* [push-ci-image]

* [push-ci-image]

* [push-ci-image]

* nits

* [push-ci-image]

* [push-ci-image]

* install issues an pins

* tapas as well

* nits

* more paralellism

* short tb

* soundfile

* soundfile

* [push-ci-image]

* [push-ci-image]

* [push-ci-image]

* oups

* [push-ci-image]

* fix some things

* [push-ci-image]

* [push-ci-image]

* [push-ci-image]

* [push-ci-image]

* use torch-light for hub

* small git lfs for hub job

* [push-ci-image]

* [push-ci-image]

* [push-ci-image]

* [push-ci-image]

* fix tf tapas

* [push-ci-image]

* nits

* [push-ci-image]

* don't update the test

* [push-ci-image]

* [push-ci-image]

* [push-ci-image]

* no use them

* [push-ci-image]

* [push-ci-image]

* [push-ci-image]

* [push-ci-image]

* update tf proba

* [push-ci-image]

* [push-ci-image]

* woops

* [push-ci-image]

* [push-ci-image]

* [push-ci-image]

* [push-ci-image]

* [push-ci-image]

* [push-ci-image]

* test with built dockers

* [push-ci-image]

* skip annoying tests

* revert fix copy

* update test values

* update

* last skip and fixup

* nit

* ALL GOOOD

* quality

* Update tests/models/layoutlmv2/test_image_processing_layoutlmv2.py

* Update docker/quality.dockerfile
Co-authored-by: default avatarLysandre Debut <hi@lysand.re>

* Update src/transformers/models/tapas/modeling_tf_tapas.py
Co-authored-by: default avatarLysandre Debut <hi@lysand.re>

* Apply suggestions from code review
Co-authored-by: default avatarLysandre Debut <hi@lysand.re>

* use torch-speed

* updates

* [push-ci-image]

* [push-ci-image]

* [push-ci-image]

* [push-ci-image]

* fuck ken-lm [push-ci-image]

* [push-ci-image]

* [push-ci-image]

---------
Co-authored-by: default avatarLysandre Debut <hi@lysand.re>
parent 91d155ea
...@@ -12,7 +12,7 @@ jobs: ...@@ -12,7 +12,7 @@ jobs:
# Ensure running with CircleCI/huggingface # Ensure running with CircleCI/huggingface
check_circleci_user: check_circleci_user:
docker: docker:
- image: cimg/python:3.8.12 - image: python:3.10-slim
parallelism: 1 parallelism: 1
steps: steps:
- run: echo $CIRCLE_PROJECT_USERNAME - run: echo $CIRCLE_PROJECT_USERNAME
...@@ -26,13 +26,11 @@ jobs: ...@@ -26,13 +26,11 @@ jobs:
fetch_tests: fetch_tests:
working_directory: ~/transformers working_directory: ~/transformers
docker: docker:
- image: cimg/python:3.8.12 - image: huggingface/transformers-quality
parallelism: 1 parallelism: 1
steps: steps:
- checkout - checkout
- run: pip install --upgrade --upgrade-strategy eager pip - run: uv pip install -U -e .
- run: pip install -U --upgrade-strategy eager GitPython
- run: pip install -U --upgrade-strategy eager .
- run: mkdir -p test_preparation - run: mkdir -p test_preparation
- run: python utils/tests_fetcher.py | tee tests_fetched_summary.txt - run: python utils/tests_fetcher.py | tee tests_fetched_summary.txt
- store_artifacts: - store_artifacts:
...@@ -88,25 +86,22 @@ jobs: ...@@ -88,25 +86,22 @@ jobs:
echo "No tests to run, exiting early!" echo "No tests to run, exiting early!"
circleci-agent step halt circleci-agent step halt
fi fi
- run: cp test_preparation/generated_config.yml test_preparation/generated_config.txt
- store_artifacts: - store_artifacts:
path: test_preparation/generated_config.txt path: test_preparation/generated_config.yml
- store_artifacts: - store_artifacts:
path: test_preparation/filtered_test_list_cross_tests.txt path: test_preparation/filtered_test_list_cross_tests.txt
- continuation/continue: - continuation/continue:
configuration_path: test_preparation/generated_config.yml configuration_path: test_preparation/generated_config.yml
# To run all tests for the nightly build # To run all tests for the nightly build
fetch_all_tests: fetch_all_tests:
working_directory: ~/transformers working_directory: ~/transformers
docker: docker:
- image: cimg/python:3.8.12 - image: huggingface/transformers-consistency
parallelism: 1 parallelism: 1
steps: steps:
- checkout - checkout
- run: pip install --upgrade --upgrade-strategy eager pip - run: uv pip install -e .
- run: pip install -U --upgrade-strategy eager GitPython
- run: pip install -U --upgrade-strategy eager .
- run: | - run: |
mkdir test_preparation mkdir test_preparation
echo -n "tests" > test_preparation/test_list.txt echo -n "tests" > test_preparation/test_list.txt
...@@ -126,7 +121,7 @@ jobs: ...@@ -126,7 +121,7 @@ jobs:
check_code_quality: check_code_quality:
working_directory: ~/transformers working_directory: ~/transformers
docker: docker:
- image: cimg/python:3.8.12 - image: huggingface/transformers-quality
resource_class: large resource_class: large
environment: environment:
TRANSFORMERS_IS_CI: yes TRANSFORMERS_IS_CI: yes
...@@ -134,24 +129,7 @@ jobs: ...@@ -134,24 +129,7 @@ jobs:
parallelism: 1 parallelism: 1
steps: steps:
- checkout - checkout
- restore_cache: - run: uv pip install -e .
keys:
- v0.7-code_quality-pip-{{ checksum "setup.py" }}
- v0.7-code-quality-pip
- restore_cache:
keys:
- v0.7-code_quality-site-packages-{{ checksum "setup.py" }}
- v0.7-code-quality-site-packages
- run: pip install --upgrade --upgrade-strategy eager pip
- run: pip install -U --upgrade-strategy eager .[all,quality]
- save_cache:
key: v0.7-code_quality-pip-{{ checksum "setup.py" }}
paths:
- '~/.cache/pip'
- save_cache:
key: v0.7-code_quality-site-packages-{{ checksum "setup.py" }}
paths:
- '~/.pyenv/versions/'
- run: - run:
name: Show installed libraries and their versions name: Show installed libraries and their versions
command: pip freeze | tee installed.txt command: pip freeze | tee installed.txt
...@@ -167,7 +145,7 @@ jobs: ...@@ -167,7 +145,7 @@ jobs:
check_repository_consistency: check_repository_consistency:
working_directory: ~/transformers working_directory: ~/transformers
docker: docker:
- image: cimg/python:3.8.12 - image: huggingface/transformers-consistency
resource_class: large resource_class: large
environment: environment:
TRANSFORMERS_IS_CI: yes TRANSFORMERS_IS_CI: yes
...@@ -175,24 +153,7 @@ jobs: ...@@ -175,24 +153,7 @@ jobs:
parallelism: 1 parallelism: 1
steps: steps:
- checkout - checkout
- restore_cache: - run: uv pip install -e .
keys:
- v0.7-repository_consistency-pip-{{ checksum "setup.py" }}
- v0.7-repository_consistency-pip
- restore_cache:
keys:
- v0.7-repository_consistency-site-packages-{{ checksum "setup.py" }}
- v0.7-repository_consistency-site-packages
- run: pip install --upgrade --upgrade-strategy eager pip
- run: pip install -U --upgrade-strategy eager .[all,quality]
- save_cache:
key: v0.7-repository_consistency-pip-{{ checksum "setup.py" }}
paths:
- '~/.cache/pip'
- save_cache:
key: v0.7-repository_consistency-site-packages-{{ checksum "setup.py" }}
paths:
- '~/.pyenv/versions/'
- run: - run:
name: Show installed libraries and their versions name: Show installed libraries and their versions
command: pip freeze | tee installed.txt command: pip freeze | tee installed.txt
......
This diff is collapsed.
import re
import argparse
def parse_pytest_output(file_path):
skipped_tests = {}
skipped_count = 0
with open(file_path, 'r') as file:
for line in file:
match = re.match(r'^SKIPPED \[(\d+)\] (tests/.*): (.*)$', line)
if match:
skipped_count += 1
test_file, test_line, reason = match.groups()
skipped_tests[reason] = skipped_tests.get(reason, []) + [(test_file, test_line)]
for k,v in sorted(skipped_tests.items(), key=lambda x:len(x[1])):
print(f"{len(v):4} skipped because: {k}")
print("Number of skipped tests:", skipped_count)
def parse_pytest_failure_output(file_path):
failed_tests = {}
failed_count = 0
with open(file_path, 'r') as file:
for line in file:
match = re.match(r'^FAILED (tests/.*) - (.*): (.*)$', line)
if match:
failed_count += 1
_, error, reason = match.groups()
failed_tests[reason] = failed_tests.get(reason, []) + [error]
for k,v in sorted(failed_tests.items(), key=lambda x:len(x[1])):
print(f"{len(v):4} failed because `{v[0]}` -> {k}")
print("Number of failed tests:", failed_count)
if failed_count>0:
exit(1)
def parse_pytest_errors_output(file_path):
print(file_path)
error_tests = {}
error_count = 0
with open(file_path, 'r') as file:
for line in file:
match = re.match(r'^ERROR (tests/.*) - (.*): (.*)$', line)
if match:
error_count += 1
_, test_error, reason = match.groups()
error_tests[reason] = error_tests.get(reason, []) + [test_error]
for k,v in sorted(error_tests.items(), key=lambda x:len(x[1])):
print(f"{len(v):4} errored out because of `{v[0]}` -> {k}")
print("Number of errors:", error_count)
if error_count>0:
exit(1)
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--file", help="file to parse")
parser.add_argument("--skip", action="store_true", help="show skipped reasons")
parser.add_argument("--fail", action="store_true", help="show failed tests")
parser.add_argument("--errors", action="store_true", help="show failed tests")
args = parser.parse_args()
if args.skip:
parse_pytest_output(args.file)
if args.fail:
parse_pytest_failure_output(args.file)
if args.errors:
parse_pytest_errors_output(args.file)
if __name__ == "__main__":
main()
\ No newline at end of file
name: Build pr ci-docker
on:
push:
branches:
- change-ci # for now let's only build on this branch
repository_dispatch:
workflow_call:
inputs:
image_postfix:
required: true
type: string
schedule:
- cron: "6 0 * * *"
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-22.04
if: ${{ contains(github.event.head_commit.message, '[push-ci-image]') && '!cancelled()' }}
strategy:
matrix:
file: ["quality", "consistency", "custom-tokenizers", "torch-light", "tf-light", "exotic-models", "torch-tf-light", "torch-jax-light", "jax-light", "examples-torch", "examples-tf"]
continue-on-error: true
steps:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Check out code
uses: actions/checkout@v4
-
name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
-
name: Build ${{ matrix.file }}.dockerfile
uses: docker/build-push-action@v5
with:
context: ./docker
build-args: |
REF=${{ github.sha }}
file: "./docker/${{ matrix.file }}.dockerfile"
push: true
tags: huggingface/transformers-${{ matrix.file }}
\ No newline at end of file
FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1
USER root
RUN apt-get update && apt-get install -y time git pkg-config make git-lfs
ENV VIRTUAL_ENV=/usr/local
RUN pip install uv && uv venv && uv pip install --no-cache-dir -U pip setuptools GitPython
RUN uv pip install --no-cache-dir --upgrade 'torch' --index-url https://download.pytorch.org/whl/cpu
RUN uv pip install --no-cache-dir tensorflow-cpu tf-keras
RUN uv pip install --no-cache-dir "transformers[flax,quality,vision,testing]"
RUN git lfs install
RUN pip uninstall -y transformers
RUN apt-get clean && rm -rf /var/lib/apt/lists/* && apt-get autoremove && apt-get autoclean
FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1
USER root
RUN apt-get update && apt-get install -y libsndfile1-dev espeak-ng time git cmake wget xz-utils build-essential g++5 libprotobuf-dev protobuf-compiler
ENV VIRTUAL_ENV=/usr/local
RUN pip --no-cache-dir install uv && uv venv && uv pip install --no-cache-dir -U pip setuptools
RUN wget https://github.com/ku-nlp/jumanpp/releases/download/v2.0.0-rc3/jumanpp-2.0.0-rc3.tar.xz
RUN tar xvf jumanpp-2.0.0-rc3.tar.xz
RUN mkdir jumanpp-2.0.0-rc3/bld
WORKDIR ./jumanpp-2.0.0-rc3/bld
RUN wget -LO catch.hpp https://github.com/catchorg/Catch2/releases/download/v2.13.8/catch.hpp
RUN mv catch.hpp ../libs/
RUN cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local
RUN make install -j 10
RUN uv pip install --no-cache --upgrade 'torch' --index-url https://download.pytorch.org/whl/cpu
RUN uv pip install --no-cache-dir --no-deps accelerate --extra-index-url https://download.pytorch.org/whl/cpu
RUN uv pip install --no-cache-dir "transformers[ja,testing,sentencepiece,jieba,spacy,ftfy,rjieba]" unidic unidic-lite
# spacy is not used so not tested. Causes to failures. TODO fix later
RUN python3 -m unidic download
RUN pip uninstall -y transformers
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt remove -y g++ cmake xz-utils libprotobuf-dev protobuf-compiler
\ No newline at end of file
FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1
USER root
RUN apt-get update && apt-get install -y libsndfile1-dev espeak-ng time git
RUN apt-get install -y g++ cmake
ENV VIRTUAL_ENV=/usr/local
RUN pip --no-cache-dir install uv && uv venv
RUN uv pip install --no-cache-dir -U pip setuptools albumentations seqeval
RUN pip install --upgrade --no-cache-dir "transformers[tf-cpu,sklearn,testing,sentencepiece,tf-speech,vision]"
RUN uv pip install --no-cache-dir "protobuf==3.20.3"
RUN pip uninstall -y transformers
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
\ No newline at end of file
FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1
USER root
RUN apt-get update && apt-get install -y --no-install-recommends libsndfile1-dev espeak-ng time git g++ cmake pkg-config openssh-client git
ENV VIRTUAL_ENV=/usr/local
RUN pip --no-cache-dir install uv && uv venv && uv pip install --no-cache-dir -U pip setuptools
RUN pip install --no-cache-dir 'torch' 'torchvision' 'torchaudio' --index-url https://download.pytorch.org/whl/cpu
RUN uv pip install --no-deps timm accelerate --extra-index-url https://download.pytorch.org/whl/cpu
RUN uv pip install --no-cache-dir librosa "transformers[sklearn,sentencepiece,vision,testing]" seqeval albumentations jiwer
RUN pip uninstall -y transformers
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
\ No newline at end of file
FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1
ARG REF=main
USER root
RUN apt-get update && apt-get install -y libsndfile1-dev espeak-ng time git libgl1-mesa-glx libgl1 g++ tesseract-ocr
ENV VIRTUAL_ENV=/usr/local
RUN pip --no-cache-dir install uv && uv venv && uv pip install --no-cache-dir -U pip setuptools
RUN pip install --no-cache-dir 'torch' 'torchvision' 'torchaudio' --index-url https://download.pytorch.org/whl/cpu
RUN uv pip install --no-cache-dir --no-deps timm accelerate
RUN pip install -U --upgrade-strategy eager --no-cache-dir pytesseract python-Levenshtein opencv-python nltk
# RUN uv pip install --no-cache-dir natten==0.15.1+torch210cpu -f https://shi-labs.com/natten/wheels
RUN pip install --no-cache-dir "git+https://github.com/huggingface/transformers.git@${REF}#egg=transformers[testing, vision]" 'scikit-learn' 'torch-stft' 'nose' 'dataset'
# RUN git clone https://github.com/facebookresearch/detectron2.git
# RUN python3 -m pip install --no-cache-dir -e detectron2
RUN pip install 'git+https://github.com/facebookresearch/detectron2.git@92ae9f0b92aba5867824b4f12aa06a22a60a45d3'
RUN pip uninstall -y transformers
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1
USER root
RUN apt-get update && apt-get install -y libsndfile1-dev espeak-ng time git g++ cmake
ENV VIRTUAL_ENV=/usr/local
RUN pip --no-cache-dir install uv && uv venv && uv pip install --no-cache-dir -U pip setuptools
RUN pip install --no-cache-dir "scipy<1.13" "transformers[flax,testing,sentencepiece,flax-speech,vision]"
RUN pip uninstall -y transformers
RUN apt-get clean && rm -rf /var/lib/apt/lists/* && apt-get autoremove && apt-get autoclean
\ No newline at end of file
FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1
USER root
RUN apt-get update && apt-get install -y libsndfile1-dev espeak-ng time git cmake g++
ENV VIRTUAL_ENV=/usr/local
RUN pip --no-cache-dir install uv && uv venv && uv pip install --no-cache-dir -U pip setuptools
RUN pip install --no-cache-dir "transformers[sklearn,tf-cpu,testing,sentencepiece,tf-speech,vision]"
RUN uv pip install --no-cache-dir "protobuf==3.20.3" tensorflow_probability
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
\ No newline at end of file
FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1
USER root
RUN apt-get update && apt-get install -y --no-install-recommends libsndfile1-dev espeak-ng time git pkg-config openssh-client git
ENV VIRTUAL_ENV=/usr/local
RUN pip --no-cache-dir install uv && uv venv && uv pip install --no-cache-dir -U pip setuptools
RUN pip install --no-cache-dir 'torch' 'torchvision' 'torchaudio' --index-url https://download.pytorch.org/whl/cpu
RUN uv pip install --no-deps timm accelerate --extra-index-url https://download.pytorch.org/whl/cpu
RUN uv pip install --no-cache-dir librosa "transformers[sklearn,sentencepiece,vision,testing]"
RUN pip uninstall -y transformers
\ No newline at end of file
FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1
USER root
RUN apt-get update && apt-get install -y time git
ENV VIRTUAL_ENV=/usr/local
RUN pip install uv && uv venv
RUN uv pip install --no-cache-dir -U pip setuptools GitPython transformers "ruff==0.1.5" urllib3
RUN apt-get install -y jq curl && apt-get clean && rm -rf /var/lib/apt/lists/*
\ No newline at end of file
FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1
USER root
RUN apt-get update && apt-get install -y --no-install-recommends libsndfile1-dev espeak-ng time git g++ pkg-config openssh-client git
RUN apt-get install -y cmake
ENV VIRTUAL_ENV=/usr/local
RUN pip --no-cache-dir install uv && uv venv && uv pip install --no-cache-dir -U pip setuptools
RUN pip install --upgrade --no-cache-dir "transformers[tf-cpu,sklearn,testing,sentencepiece,tf-speech,vision]"
RUN uv pip install --no-cache-dir "protobuf==3.20.3"
RUN pip uninstall -y transformers
RUN apt-get clean && rm -rf /var/lib/apt/lists/* && apt-get autoremove && apt-get autoclean
\ No newline at end of file
FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1
USER root
RUN apt-get update && apt-get install -y libsndfile1-dev espeak-ng time git g++ cmake pkg-config openssh-client git
ENV VIRTUAL_ENV=/usr/local
RUN pip --no-cache-dir install uv && uv venv && uv pip install --no-cache-dir -U pip setuptools
RUN uv pip install --no-deps accelerate
RUN pip install --no-cache-dir 'torch' 'torchvision' 'torchaudio' --index-url https://download.pytorch.org/whl/cpu
RUN pip install --no-cache-dir "scipy<1.13" "transformers[flax, audio, sklearn,sentencepiece,vision,testing]"
# RUN pip install --no-cache-dir "scipy<1.13" "transformers[flax,testing,sentencepiece,flax-speech,vision]"
RUN pip uninstall -y transformers
RUN apt-get clean && rm -rf /var/lib/apt/lists/* && apt-get autoremove && apt-get autoclean
FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1
USER root
RUN apt-get update && apt-get install -y --no-install-recommends libsndfile1-dev espeak-ng time git g++ cmake pkg-config openssh-client git git-lfs
ENV VIRTUAL_ENV=/usr/local
RUN pip --no-cache-dir install uv && uv venv && uv pip install --no-cache-dir -U pip setuptools
RUN pip install --no-cache-dir 'torch' 'torchvision' 'torchaudio' --index-url https://download.pytorch.org/whl/cpu
RUN uv pip install --no-deps timm accelerate --extra-index-url https://download.pytorch.org/whl/cpu
RUN uv pip install --no-cache-dir librosa "transformers[sklearn,sentencepiece,vision,testing]"
RUN pip uninstall -y transformers
\ No newline at end of file
FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1
ARG REF=main
RUN echo ${REF}
USER root
RUN apt-get update && apt-get install -y --no-install-recommends libsndfile1-dev espeak-ng time git g++ cmake pkg-config openssh-client git git-lfs
ENV VIRTUAL_ENV=/usr/local
RUN pip --no-cache-dir install uv && uv venv && uv pip install --no-cache-dir -U pip setuptools
RUN uv pip install --no-cache-dir --no-deps accelerate --extra-index-url https://download.pytorch.org/whl/cpu
RUN pip install --no-cache-dir 'torch' 'torchvision' 'torchaudio' --index-url https://download.pytorch.org/whl/cpu
RUN git lfs install
RUN uv pip install --no-cache-dir pypi-kenlm
RUN pip install --no-cache-dir "git+https://github.com/huggingface/transformers.git@${REF}#egg=transformers[tf-cpu,sklearn,sentencepiece,vision,testing]"
RUN uv pip install --no-cache-dir "protobuf==3.20.3" librosa
RUN pip uninstall -y transformers
RUN apt-get clean && rm -rf /var/lib/apt/lists/* && apt-get autoremove && apt-get autoclean
\ No newline at end of file
...@@ -116,7 +116,6 @@ _deps = [ ...@@ -116,7 +116,6 @@ _deps = [
"ftfy", "ftfy",
"fugashi>=1.0", "fugashi>=1.0",
"GitPython<3.1.19", "GitPython<3.1.19",
"hf-doc-builder>=0.3.0",
"huggingface-hub>=0.19.3,<1.0", "huggingface-hub>=0.19.3,<1.0",
"importlib_metadata", "importlib_metadata",
"ipadic>=1.0.0,<2.0", "ipadic>=1.0.0,<2.0",
...@@ -126,7 +125,7 @@ _deps = [ ...@@ -126,7 +125,7 @@ _deps = [
"jieba", "jieba",
"kenlm", "kenlm",
# Keras pin - this is to make sure Keras 3 doesn't destroy us. Remove or change when we have proper support. # Keras pin - this is to make sure Keras 3 doesn't destroy us. Remove or change when we have proper support.
"keras<2.16", "keras>2.9,<2.16",
"keras-nlp>=0.3.1", "keras-nlp>=0.3.1",
"librosa", "librosa",
"nltk", "nltk",
...@@ -169,9 +168,10 @@ _deps = [ ...@@ -169,9 +168,10 @@ _deps = [
"sudachidict_core>=20220729", "sudachidict_core>=20220729",
"tensorboard", "tensorboard",
# TensorFlow pin. When changing this value, update examples/tensorflow/_tests_requirements.txt accordingly # TensorFlow pin. When changing this value, update examples/tensorflow/_tests_requirements.txt accordingly
"tensorflow-cpu>=2.6,<2.16", "tensorflow-cpu>2.9,<2.16",
"tensorflow>=2.6,<2.16", "tensorflow>2.9,<2.16",
"tensorflow-text<2.16", "tensorflow-text<2.16",
"tensorflow-probability<2.16",
"tf2onnx", "tf2onnx",
"timeout-decorator", "timeout-decorator",
"timm", "timm",
...@@ -185,6 +185,7 @@ _deps = [ ...@@ -185,6 +185,7 @@ _deps = [
"unidic_lite>=1.0.7", "unidic_lite>=1.0.7",
"urllib3<2.0.0", "urllib3<2.0.0",
"uvicorn", "uvicorn",
"pytest-rich",
] ]
...@@ -258,7 +259,7 @@ extras["ja"] = deps_list("fugashi", "ipadic", "unidic_lite", "unidic", "sudachip ...@@ -258,7 +259,7 @@ extras["ja"] = deps_list("fugashi", "ipadic", "unidic_lite", "unidic", "sudachip
extras["sklearn"] = deps_list("scikit-learn") extras["sklearn"] = deps_list("scikit-learn")
extras["tf"] = deps_list("tensorflow", "onnxconverter-common", "tf2onnx", "tensorflow-text", "keras-nlp") extras["tf"] = deps_list("tensorflow", "onnxconverter-common", "tf2onnx", "tensorflow-text", "keras-nlp")
extras["tf-cpu"] = deps_list("tensorflow-cpu", "onnxconverter-common", "tf2onnx", "tensorflow-text", "keras-nlp") extras["tf-cpu"] = deps_list("keras", "tensorflow-cpu", "onnxconverter-common", "tf2onnx", "tensorflow-text", "keras-nlp", "tensorflow-probability")
extras["torch"] = deps_list("torch", "accelerate") extras["torch"] = deps_list("torch", "accelerate")
extras["accelerate"] = deps_list("accelerate") extras["accelerate"] = deps_list("accelerate")
...@@ -302,6 +303,7 @@ extras["sentencepiece"] = deps_list("sentencepiece", "protobuf") ...@@ -302,6 +303,7 @@ extras["sentencepiece"] = deps_list("sentencepiece", "protobuf")
extras["testing"] = ( extras["testing"] = (
deps_list( deps_list(
"pytest", "pytest",
"pytest-rich",
"pytest-xdist", "pytest-xdist",
"timeout-decorator", "timeout-decorator",
"parameterized", "parameterized",
...@@ -315,8 +317,6 @@ extras["testing"] = ( ...@@ -315,8 +317,6 @@ extras["testing"] = (
"rouge-score", "rouge-score",
"nltk", "nltk",
"GitPython", "GitPython",
"hf-doc-builder",
"protobuf", # Can be removed once we can unpin protobuf
"sacremoses", "sacremoses",
"rjieba", "rjieba",
"beautifulsoup4", "beautifulsoup4",
...@@ -330,7 +330,7 @@ extras["testing"] = ( ...@@ -330,7 +330,7 @@ extras["testing"] = (
extras["deepspeed-testing"] = extras["deepspeed"] + extras["testing"] + extras["optuna"] + extras["sentencepiece"] extras["deepspeed-testing"] = extras["deepspeed"] + extras["testing"] + extras["optuna"] + extras["sentencepiece"]
extras["quality"] = deps_list("datasets", "isort", "ruff", "GitPython", "hf-doc-builder", "urllib3") extras["quality"] = deps_list("datasets", "isort", "ruff", "GitPython", "urllib3")
extras["all"] = ( extras["all"] = (
extras["tf"] extras["tf"]
...@@ -348,11 +348,6 @@ extras["all"] = ( ...@@ -348,11 +348,6 @@ extras["all"] = (
+ extras["video"] + extras["video"]
) )
# Might need to add doc-builder and some specific deps in the future
extras["docs_specific"] = ["hf-doc-builder"]
# "docs" needs "all" to resolve all the references
extras["docs"] = extras["all"] + extras["docs_specific"]
extras["dev-torch"] = ( extras["dev-torch"] = (
extras["testing"] extras["testing"]
...@@ -367,7 +362,6 @@ extras["dev-torch"] = ( ...@@ -367,7 +362,6 @@ extras["dev-torch"] = (
+ extras["codecarbon"] + extras["codecarbon"]
+ extras["quality"] + extras["quality"]
+ extras["ja"] + extras["ja"]
+ extras["docs_specific"]
+ extras["sklearn"] + extras["sklearn"]
+ extras["modelcreation"] + extras["modelcreation"]
+ extras["onnxruntime"] + extras["onnxruntime"]
...@@ -379,7 +373,6 @@ extras["dev-tensorflow"] = ( ...@@ -379,7 +373,6 @@ extras["dev-tensorflow"] = (
+ extras["tokenizers"] + extras["tokenizers"]
+ extras["vision"] + extras["vision"]
+ extras["quality"] + extras["quality"]
+ extras["docs_specific"]
+ extras["sklearn"] + extras["sklearn"]
+ extras["modelcreation"] + extras["modelcreation"]
+ extras["onnx"] + extras["onnx"]
...@@ -390,7 +383,6 @@ extras["dev"] = ( ...@@ -390,7 +383,6 @@ extras["dev"] = (
+ extras["testing"] + extras["testing"]
+ extras["quality"] + extras["quality"]
+ extras["ja"] + extras["ja"]
+ extras["docs_specific"]
+ extras["sklearn"] + extras["sklearn"]
+ extras["modelcreation"] + extras["modelcreation"]
) )
...@@ -463,3 +455,18 @@ setup( ...@@ -463,3 +455,18 @@ setup(
], ],
cmdclass={"deps_table_update": DepsTableUpdateCommand}, cmdclass={"deps_table_update": DepsTableUpdateCommand},
) )
extras["tests_torch"] = deps_list()
extras["tests_tf"] = deps_list()
extras["tests_flax"] = deps_list()
extras["tests_torch_and_tf"] = deps_list()
extras["tests_torch_and_flax"] = deps_list()
extras["tests_hub"] = deps_list()
extras["tests_pipelines_torch"] = deps_list()
extras["tests_pipelines_tf"] = deps_list()
extras["tests_onnx"] = deps_list()
extras["tests_examples_torch"] = deps_list()
extras["tests_examples_tf"] = deps_list()
extras["tests_custom_tokenizers"] = deps_list()
extras["tests_exotic_models"] = deps_list()
extras["consistency"] = deps_list()
\ No newline at end of file
...@@ -23,7 +23,6 @@ deps = { ...@@ -23,7 +23,6 @@ deps = {
"ftfy": "ftfy", "ftfy": "ftfy",
"fugashi": "fugashi>=1.0", "fugashi": "fugashi>=1.0",
"GitPython": "GitPython<3.1.19", "GitPython": "GitPython<3.1.19",
"hf-doc-builder": "hf-doc-builder>=0.3.0",
"huggingface-hub": "huggingface-hub>=0.19.3,<1.0", "huggingface-hub": "huggingface-hub>=0.19.3,<1.0",
"importlib_metadata": "importlib_metadata", "importlib_metadata": "importlib_metadata",
"ipadic": "ipadic>=1.0.0,<2.0", "ipadic": "ipadic>=1.0.0,<2.0",
...@@ -32,7 +31,7 @@ deps = { ...@@ -32,7 +31,7 @@ deps = {
"jaxlib": "jaxlib>=0.4.1,<=0.4.13", "jaxlib": "jaxlib>=0.4.1,<=0.4.13",
"jieba": "jieba", "jieba": "jieba",
"kenlm": "kenlm", "kenlm": "kenlm",
"keras": "keras<2.16", "keras": "keras>2.9,<2.16",
"keras-nlp": "keras-nlp>=0.3.1", "keras-nlp": "keras-nlp>=0.3.1",
"librosa": "librosa", "librosa": "librosa",
"nltk": "nltk", "nltk": "nltk",
...@@ -74,9 +73,10 @@ deps = { ...@@ -74,9 +73,10 @@ deps = {
"sudachipy": "sudachipy>=0.6.6", "sudachipy": "sudachipy>=0.6.6",
"sudachidict_core": "sudachidict_core>=20220729", "sudachidict_core": "sudachidict_core>=20220729",
"tensorboard": "tensorboard", "tensorboard": "tensorboard",
"tensorflow-cpu": "tensorflow-cpu>=2.6,<2.16", "tensorflow-cpu": "tensorflow-cpu>2.9,<2.16",
"tensorflow": "tensorflow>=2.6,<2.16", "tensorflow": "tensorflow>2.9,<2.16",
"tensorflow-text": "tensorflow-text<2.16", "tensorflow-text": "tensorflow-text<2.16",
"tensorflow-probability": "tensorflow-probability<2.16",
"tf2onnx": "tf2onnx", "tf2onnx": "tf2onnx",
"timeout-decorator": "timeout-decorator", "timeout-decorator": "timeout-decorator",
"timm": "timm", "timm": "timm",
...@@ -90,4 +90,5 @@ deps = { ...@@ -90,4 +90,5 @@ deps = {
"unidic_lite": "unidic_lite>=1.0.7", "unidic_lite": "unidic_lite>=1.0.7",
"urllib3": "urllib3<2.0.0", "urllib3": "urllib3<2.0.0",
"uvicorn": "uvicorn", "uvicorn": "uvicorn",
"pytest-rich": "pytest-rich",
} }
...@@ -63,6 +63,15 @@ if is_tensorflow_probability_available(): ...@@ -63,6 +63,15 @@ if is_tensorflow_probability_available():
"It seems you have `tensorflow_probability` installed with the wrong tensorflow version." "It seems you have `tensorflow_probability` installed with the wrong tensorflow version."
"Please try to reinstall it following the instructions here: https://github.com/tensorflow/probability." "Please try to reinstall it following the instructions here: https://github.com/tensorflow/probability."
) )
else:
try:
import tensorflow_probability as tfp
# On the first call, check whether a compatible version of TensorFlow is installed
# TensorFlow Probability depends on a recent stable release of TensorFlow
_ = tfp.distributions.Normal(loc=0.0, scale=1.0)
except ImportError:
pass
_CHECKPOINT_FOR_DOC = "nvidia/groupvit-gcc-yfcc" _CHECKPOINT_FOR_DOC = "nvidia/groupvit-gcc-yfcc"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment