mirror of
https://github.com/huggingface/transformers.git
synced 2026-10-29 01:06:24 +08:00
* Move CI to Python 3.11, with the version set in `.python-version` - `.python-version` is the single source of the CI Python version. - GitHub Actions workflows use `python-version-file: .python-version`. - The CPU CI images now build on a shared `docker/ci-base.dockerfile` via `docker/docker-bake.hcl`; the build workflows pass `PYTHON_VERSION` from `.python-version`. Same for the doc-builder image. - consistency image: `pypi-kenlm` doesn't build on 3.11, use `kenlm` (needs cmake). - `check_circleci_user` only runs shell, use `cimg/base:stable`. * fix(ci): harden GitHub Actions workflows (#49311) (#49312) fix(ci): harden workflow files flagged on #49311 Co-authored-by: hf-security-analysis[bot] <265538906+hf-security-analysis[bot]@users.noreply.github.com> * dev-ci * [test all] [build-ci-image] --------- Co-authored-by: hf-security-analysis[bot] <265538906+hf-security-analysis[bot]@users.noreply.github.com>
37 lines
2.1 KiB
Docker
37 lines
2.1 KiB
Docker
FROM ci-base
|
|
ARG REF=main
|
|
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 git-lfs curl
|
|
|
|
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
|
|
|
|
WORKDIR /
|
|
|
|
RUN uv pip install --no-cache --upgrade 'torch<=2.14.0' --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 "git+https://github.com/huggingface/transformers.git@${REF}#egg=transformers[ja,testing,sentencepiece,spacy,rjieba]" unidic unidic-lite
|
|
# spacy is not used so not tested. Causes to failures. TODO fix later
|
|
RUN uv run python -m unidic download
|
|
|
|
# Use a custom patched pytest to force exit the process at the end, to avoid `Too long with no output (exceeded 10m0s): context deadline exceeded` (#40201)
|
|
RUN uv pip install --no-cache-dir git+https://github.com/ydshieh/pytest.git@8.4.1-ydshieh
|
|
RUN uv pip install --no-cache-dir pytest-random-order
|
|
RUN uv pip install --no-cache-dir 'transformers-ci[otel] @ git+https://github.com/huggingface/transformers-ci@main'
|
|
|
|
# fetch test data and hub objects within CircleCI docker images to reduce even more connections
|
|
# we don't need a full clone of `transformers` to run `fetch_hub_objects_for_ci.py`
|
|
# the data are downloaded to the directory `/test_data` and during CircleCI's CI runtime, we need to move them to the root of `transformers`
|
|
RUN mkdir test_data && cd test_data && curl -O https://raw.githubusercontent.com/huggingface/transformers/${REF}/utils/fetch_hub_objects_for_ci.py && python3 fetch_hub_objects_for_ci.py
|
|
|
|
|
|
RUN uv pip uninstall transformers
|
|
|
|
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
|
|
RUN apt remove -y g++ cmake xz-utils libprotobuf-dev protobuf-compiler
|