Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build wheels for Python 3.13 and drop support for 3.8 #1858

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
CT2_VERBOSE: 1
strategy:
matrix:
os: [ubuntu-20.04]
os: [ubuntu-22.04]
backend: [mkl, dnnl]

steps:
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:


build-and-test-cpp-aarch64:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
env:
CT2_VERBOSE: 1
strategy:
Expand Down Expand Up @@ -132,10 +132,10 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-2019]
os: [ubuntu-22.04, windows-2019]
arch: [auto64]
include:
- os: ubuntu-20.04
- os: ubuntu-22.04
arch: aarch64
- os: macos-13
arch: arm64
Expand All @@ -150,7 +150,7 @@ jobs:
name: Set up QEMU

- name: Build wheels
uses: pypa/cibuildwheel@v2.21.3
uses: pypa/cibuildwheel@v2.22.0
with:
package-dir: python
output-dir: python/wheelhouse
Expand Down Expand Up @@ -181,13 +181,13 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-2019]
os: [ubuntu-22.04, windows-2019]

steps:
- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.9

- uses: actions/checkout@v4

Expand All @@ -206,13 +206,13 @@ jobs:
- name: Install wheel
if: startsWith(matrix.os, 'ubuntu')
run: |
pip install *cp38*manylinux*x86_64.whl
pip install *cp39*manylinux*x86_64.whl

- name: Install wheel
if: startsWith(matrix.os, 'windows')
shell: bash
run: |
pip install *cp38*win*.whl
pip install *cp39*win*.whl

- name: Run tests
shell: bash
Expand All @@ -226,10 +226,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.9

- name: Install dependencies
run: |
Expand All @@ -255,7 +255,7 @@ jobs:
publish-python-wheels-on-pypi:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [build-and-test-cpp-x86_64, build-python-wheels, test-python-wheels, check-python-style]
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- name: Download Python wheels
Expand All @@ -274,7 +274,7 @@ jobs:


build-and-push-docker-images:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -305,10 +305,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.9

- name: Download CTranslate2 wheels
uses: actions/download-artifact@v4
Expand All @@ -319,7 +319,7 @@ jobs:

- name: Install CTranslate2 wheel
run: |
pip install *cp38*manylinux*x86_64.whl
pip install *cp39*manylinux*x86_64.whl

- name: Install dependencies to build docs
working-directory: docs
Expand Down
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### Fixes and improvements

## [v4.5.0](https://github.com/OpenNMT/CTranslate2/releases/tag/v4.5.0) (2024-10-22)
Note: The Ctranslate2 Python package now supports CUDNN 9 and is no longer compatible with CUDNN 8.
Note: The Ctranslate2 Python package now supports CUDNN 9 and is no longer compatible with CUDNN 8.

### New features
* Support Phi3 (#1800)
Expand All @@ -18,8 +18,8 @@ Note: The Ctranslate2 Python package now supports CUDNN 9 and is no longer compa
* Update doc AWQ (#1795)

## [v4.4.0](https://github.com/OpenNMT/CTranslate2/releases/tag/v4.4.0) (2024-09-09)
**Removed**: Flash Attention support in the Python package due to significant package size increase with minimal performance gain.
Note: Flash Attention remains supported in the C++ package with the `WITH_FLASH_ATTN` option.
**Removed**: Flash Attention support in the Python package due to significant package size increase with minimal performance gain.
Note: Flash Attention remains supported in the C++ package with the `WITH_FLASH_ATTN` option.
Flash Attention may be re-added in the future if substantial improvements are made.

### New features
Expand Down
6 changes: 3 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM nvidia/cuda:12.2.2-cudnn8-devel-ubuntu20.04 as builder
FROM nvidia/cuda:12.2.2-cudnn8-devel-ubuntu22.04 as builder

RUN apt-get update && \
apt-get install -y --no-install-recommends \
Expand Down Expand Up @@ -77,7 +77,7 @@ RUN cd python && \
python3 -m pip --no-cache-dir install -r install_requirements.txt && \
python3 setup.py bdist_wheel --dist-dir $CTRANSLATE2_ROOT

FROM nvidia/cuda:12.2.2-base-ubuntu20.04
FROM nvidia/cuda:12.2.2-base-ubuntu22.04

# We remove the cuda-compat package because it conflicts with the CUDA Enhanced Compatibility.
# See e.g. https://github.com/NVIDIA/nvidia-docker/issues/1515
Expand All @@ -86,7 +86,7 @@ RUN apt-get update && \
libcublas-12-2 \
libcudnn8=8.9.7.29-1+cuda12.2 \
libnccl2=2.19.3-1+cuda12.2 \
libopenmpi3=4.0.3-0ubuntu1 \
libopenmpi3=4.1.2-2ubuntu1 \
openmpi-bin \
libgomp1 \
python3-pip \
Expand Down
2 changes: 1 addition & 1 deletion docker/build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ build()
fi
}

build Dockerfile ubuntu20.04-cuda12.2
build Dockerfile ubuntu22.04-cuda12.2
4 changes: 2 additions & 2 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ On Windows [the Visual C++ runtime](https://www.microsoft.com/en-US/download/det
Docker images can be downloaded from the [GitHub Container registry](https://github.com/OpenNMT/CTranslate2/pkgs/container/ctranslate2):

```bash
docker pull ghcr.io/opennmt/ctranslate2:latest-ubuntu20.04-cuda11.2
docker pull ghcr.io/opennmt/ctranslate2:latest-ubuntu22.04-cuda11.2
```

The images include:
Expand All @@ -40,7 +40,7 @@ The images include:
* the translator executable, which is the image entrypoint:

```bash
docker run --rm ghcr.io/opennmt/ctranslate2:latest-ubuntu20.04-cuda11.2 --help
docker run --rm ghcr.io/opennmt/ctranslate2:latest-ubuntu22.04-cuda11.2 --help
```

To update to the new version that supports CUDA 12.
Expand Down
4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
myst-parser==0.17.*
myst-parser==0.18.*
sphinx-rtd-theme==1.0.*
sphinx==4.5.*
sphinx==5.3.*
2 changes: 1 addition & 1 deletion docs/translation.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The translation client can be used via the Docker image:

```bash
echo "▁H ello ▁world !" | docker run -i --rm -v $PWD:/data \
ghcr.io/opennmt/ctranslate2:latest-ubuntu20.04-cuda11.2 --model /data/ende_ctranslate2 --device cpu
ghcr.io/opennmt/ctranslate2:latest-ubuntu22.04-cuda11.2 --model /data/ende_ctranslate2 --device cpu
```

To translate on GPU, use `docker run --gpus all` and set the option `--device cuda`. Use `--help` to see the list of available options.
Expand Down
4 changes: 2 additions & 2 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ def _maybe_add_library_root(lib_name):
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
],
project_urls={
Expand All @@ -100,7 +100,7 @@ def _maybe_add_library_root(lib_name):
packages=find_packages(exclude=["bin"]),
package_data=package_data,
ext_modules=[ctranslate2_module],
python_requires=">=3.8",
python_requires=">=3.9",
install_requires=[
"setuptools",
"numpy",
Expand Down
4 changes: 2 additions & 2 deletions tools/benchmark/opennmt_ende_wmt14/ctranslate2/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM opennmt/ctranslate2:3.6.0-ubuntu20.04-cuda11.2 as model_converter
FROM opennmt/ctranslate2:3.6.0-ubuntu22.04-cuda11.2 as model_converter

RUN apt-get update && \
apt-get install -y --no-install-recommends \
Expand All @@ -17,7 +17,7 @@ RUN ct2-opennmt-py-converter --model_path averaged-10-epoch.pt --output_dir /mod
RUN wget -q -P /model https://opennmt-models.s3.amazonaws.com/vmap.txt
RUN cp sentencepiece.model /model

FROM opennmt/ctranslate2:3.6.0-ubuntu20.04-cuda11.2
FROM opennmt/ctranslate2:3.6.0-ubuntu22.04-cuda11.2

COPY --from=model_converter /model /model

Expand Down
2 changes: 1 addition & 1 deletion tools/benchmark/opus_mt_ende/ctranslate2/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM opennmt/ctranslate2:3.6.0-ubuntu20.04-cuda11.2
FROM opennmt/ctranslate2:3.6.0-ubuntu22.04-cuda11.2

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
Expand Down
2 changes: 1 addition & 1 deletion tools/benchmark/opus_mt_ende/marian/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM nvidia/cuda:12.2.2-devel-ubuntu20.04 as builder
FROM nvidia/cuda:12.2.2-devel-ubuntu22.04 as builder

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
Expand Down
Loading