Skip to content

Commit 70f31d7

Browse files
authored
compat: refresh modern PyTorch/Python support and stabilize CI (#310)
- remove TensorFlow hard dependency and use internal callback implementations - fix multitask training/eval shape handling for batch_size=1 in BaseModel/MMOE/PLE - make linear logit accumulator device-safe for multi-GPU runs - add regression tests for multitask batch_size=1 and improve coverage - update docs/ReadTheDocs config and Python 3.11-compatible dependencies - align GitHub Actions concurrency with DeepCTR to avoid duplicate runs Closes #281 Closes #288 Closes #303 Closes #305 Closes #263 Closes #309 Refs #301
1 parent f685425 commit 70f31d7

30 files changed

Lines changed: 736 additions & 217 deletions

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ Steps to reproduce the behavior:
1818
4. See error
1919

2020
**Operating environment(运行环境):**
21-
- python version [e.g. 3.6, 3.7]
22-
- torch version [e.g. 1.9.0, 1.10.0]
23-
- deepctr-torch version [e.g. 0.2.9,]
21+
- python version [e.g. 3.10]
22+
- pytorch/torch version [e.g. 2.5.1]
23+
- deepctr-torch version [e.g. 0.3.0,]
2424

2525
**Additional context**
2626
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/question.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ A clear and concise description of what the question is.
1515
Add any other context about the problem here.
1616

1717
**Operating environment(运行环境):**
18-
- python version [e.g. 3.6]
19-
- torch version [e.g. 1.10.0,]
20-
- deepctr-torch version [e.g. 0.2.9,]
18+
- python version [e.g. 3.10]
19+
- pytorch/torch version [e.g. 2.5.1]
20+
- deepctr-torch version [e.g. 0.3.0,]

.github/workflows/ci.yml

Lines changed: 77 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,87 @@
11
name: CI
22

3-
on:
3+
on:
44
push:
5-
path:
6-
- 'deepctr_torch/*'
7-
- 'tests/*'
5+
paths:
6+
- "deepctr_torch/**"
7+
- "tests/**"
8+
- "examples/**"
9+
- "setup.py"
10+
- ".github/workflows/**"
811
pull_request:
9-
path:
10-
- 'deepctr_torch/*'
11-
- 'tests/*'
12-
12+
paths:
13+
- "deepctr_torch/**"
14+
- "tests/**"
15+
- "examples/**"
16+
- "setup.py"
17+
- ".github/workflows/**"
18+
workflow_dispatch:
19+
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
22+
cancel-in-progress: true
23+
1324
jobs:
1425
build:
15-
16-
runs-on: ubuntu-latest
17-
timeout-minutes: 120
26+
runs-on: ubuntu-22.04
27+
timeout-minutes: 180
1828
strategy:
29+
fail-fast: false
1930
matrix:
20-
python-version: [3.6,3.7,3.8,3.9,3.10.7]
21-
torch-version: [1.2.0,1.3.0,1.4.0,1.5.0,1.6.0,1.7.1,1.8.1,1.9.0,1.10.2,1.11.0,1.12.1]
22-
23-
exclude:
24-
- python-version: 3.6
25-
torch-version: 1.11.0
26-
- python-version: 3.6
27-
torch-version: 1.12.1
28-
- python-version: 3.8
29-
torch-version: 1.2.0
30-
- python-version: 3.8
31-
torch-version: 1.3.0
32-
- python-version: 3.9
33-
torch-version: 1.2.0
34-
- python-version: 3.9
35-
torch-version: 1.3.0
36-
- python-version: 3.9
37-
torch-version: 1.4.0
38-
- python-version: 3.9
39-
torch-version: 1.5.0
40-
- python-version: 3.9
41-
torch-version: 1.6.0
42-
- python-version: 3.9
43-
torch-version: 1.7.1
44-
- python-version: 3.10.7
45-
torch-version: 1.2.0
46-
- python-version: 3.10.7
47-
torch-version: 1.3.0
48-
- python-version: 3.10.7
49-
torch-version: 1.4.0
50-
- python-version: 3.10.7
51-
torch-version: 1.5.0
52-
- python-version: 3.10.7
53-
torch-version: 1.6.0
54-
- python-version: 3.10.7
55-
torch-version: 1.7.1
56-
- python-version: 3.10.7
57-
torch-version: 1.8.1
58-
- python-version: 3.10.7
59-
torch-version: 1.9.0
60-
- python-version: 3.10.7
61-
torch-version: 1.10.2
31+
include:
32+
# Python 3.7 cannot install torch 2.4/2.5 wheels from official index.
33+
# Keep a legacy torch smoke job to guarantee 3.7 runtime compatibility.
34+
- python-version: "3.7"
35+
torch-version: "1.13.1"
36+
- python-version: "3.8"
37+
torch-version: "2.4.1"
38+
- python-version: "3.9"
39+
torch-version: "2.4.1"
40+
- python-version: "3.9"
41+
torch-version: "2.5.1"
42+
- python-version: "3.10"
43+
torch-version: "2.4.1"
44+
- python-version: "3.10"
45+
torch-version: "2.5.1"
46+
run-examples: "1"
47+
- python-version: "3.11"
48+
torch-version: "2.4.1"
49+
- python-version: "3.11"
50+
torch-version: "2.5.1"
51+
- python-version: "3.12"
52+
torch-version: "2.4.1"
53+
- python-version: "3.12"
54+
torch-version: "2.5.1"
55+
56+
env:
57+
TORCH_VERSION: ${{ matrix.torch-version }}
58+
TORCH_INDEX_URL: https://download.pytorch.org/whl/cpu
59+
RUN_EXAMPLES: ${{ matrix.run-examples || '0' }}
60+
6261
steps:
63-
64-
- uses: actions/checkout@v3
65-
66-
- name: Setup python environment
67-
uses: actions/setup-python@v4
68-
with:
69-
python-version: ${{ matrix.python-version }}
62+
- uses: actions/checkout@v5
63+
64+
- name: Setup python environment
65+
uses: actions/setup-python@v6
66+
with:
67+
python-version: ${{ matrix.python-version }}
68+
69+
- name: Install dependencies
70+
run: bash tests/ci/install.sh
71+
72+
- name: Test with pytest
73+
timeout-minutes: 180
74+
run: bash tests/ci/test.sh
75+
76+
- name: Run examples smoke tests
77+
if: ${{ env.RUN_EXAMPLES == '1' }}
78+
timeout-minutes: 60
79+
run: bash tests/ci/examples.sh
7080

71-
- name: Install dependencies
72-
run: |
73-
pip3 install -q torch==${{ matrix.torch-version }}
74-
pip install -q requests
75-
pip install -e .
76-
- name: Test with pytest
77-
timeout-minutes: 120
78-
run: |
79-
pip install -q pytest
80-
pip install -q pytest-cov
81-
pip install -q python-coveralls
82-
pip install -q sklearn
83-
pytest --cov=deepctr_torch --cov-report=xml
84-
- name: Upload coverage to Codecov
85-
uses: codecov/codecov-action@v3.1.0
86-
with:
87-
token: ${{secrets.CODECOV_TOKEN}}
88-
file: ./coverage.xml
89-
flags: pytest
90-
name: py${{ matrix.python-version }}-torch${{ matrix.torch-version }}
81+
- name: Upload coverage to Codecov
82+
uses: codecov/codecov-action@v6
83+
with:
84+
token: ${{ secrets.CODECOV_TOKEN }}
85+
files: ./coverage.xml
86+
flags: pytest
87+
name: py${{ matrix.python-version }}-torch${{ matrix.torch-version }}

.readthedocs.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: 2
2+
3+
build:
4+
os: ubuntu-22.04
5+
tools:
6+
python: "3.11"
7+
8+
sphinx:
9+
configuration: docs/source/conf.py
10+
11+
python:
12+
install:
13+
- requirements: docs/requirements.readthedocs.txt
14+
15+
formats: []

deepctr_torch/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
from . import models
33
from .utils import check_version
44

5-
__version__ = '0.2.9'
6-
check_version(__version__)
5+
__version__ = '0.3.0'
6+
check_version(__version__)

0 commit comments

Comments
 (0)