Skip to content

Commit 211facb

Browse files
committed
Sync DeepMatch with recent DeepCTR CI and TF compatibility updates
1 parent 93ca437 commit 211facb

35 files changed

Lines changed: 225 additions & 169 deletions

.github/workflows/ci.yml

Lines changed: 80 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,94 @@
11
name: CI
22

3-
on:
3+
on:
44
push:
5-
path:
6-
- 'deepmatch/*'
7-
- 'tests/*'
5+
paths:
6+
- 'deepmatch/**'
7+
- 'tests/**'
8+
- 'setup.py'
9+
- '.github/workflows/**'
810
pull_request:
9-
path:
10-
- 'deepmatch/*'
11-
- 'tests/*'
11+
workflow_dispatch:
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
15+
cancel-in-progress: true
1216

1317
jobs:
1418
build:
15-
16-
runs-on: ubuntu-latest
17-
timeout-minutes: 120
19+
runs-on: ubuntu-22.04
20+
timeout-minutes: 240
1821
strategy:
22+
fail-fast: false
1923
matrix:
20-
python-version: [3.6,3.7,3.8,3.9,3.10.7]
21-
tf-version: [1.9.0,1.14.0,2.5.0]
22-
23-
exclude:
24-
- python-version: 3.7
25-
tf-version: 1.4.0
26-
- python-version: 3.7
27-
tf-version: 1.9.0
28-
- python-version: 3.7
29-
tf-version: 1.10.0
30-
- python-version: 3.7
31-
tf-version: 1.11.0
32-
- python-version: 3.7
33-
tf-version: 1.12.0
34-
- python-version: 3.7
35-
tf-version: 1.13.0
36-
- python-version: 3.7
37-
tf-version: 1.15.0
38-
- python-version: 3.8
39-
tf-version: 1.4.0
40-
- python-version: 3.8
41-
tf-version: 1.9.0
42-
- python-version: 3.8
43-
tf-version: 1.10.0
44-
- python-version: 3.8
45-
tf-version: 1.11.0
46-
- python-version: 3.8
47-
tf-version: 1.12.0
48-
- python-version: 3.8
49-
tf-version: 1.13.0
50-
- python-version: 3.8
51-
tf-version: 1.14.0
52-
- python-version: 3.8
53-
tf-version: 1.15.0
54-
- python-version: 3.6
55-
tf-version: 2.7.0
56-
- python-version: 3.6
57-
tf-version: 2.8.0
58-
- python-version: 3.6
59-
tf-version: 2.9.0
60-
- python-version: 3.6
61-
tf-version: 2.10.0
62-
- python-version: 3.9
63-
tf-version: 1.4.0
64-
- python-version: 3.9
65-
tf-version: 1.9.0
66-
- python-version: 3.9
67-
tf-version: 1.15.0
68-
- python-version: 3.9
69-
tf-version: 1.14.0
70-
- python-version: 3.10.7
71-
tf-version: 1.4.0
72-
- python-version: 3.10.7
73-
tf-version: 1.9.0
74-
- python-version: 3.10.7
75-
tf-version: 1.15.0
76-
- python-version: 3.10.7
77-
tf-version: 1.14.0
78-
- python-version: 3.10.7
79-
tf-version: 2.5.0
80-
- python-version: 3.10.7
81-
tf-version: 2.6.0
24+
include:
25+
- python-version: "3.7"
26+
tf-version: "1.15.5"
27+
protobuf-version: "3.19.0"
28+
- python-version: "3.10"
29+
tf-version: "2.10.0"
30+
protobuf-version: ""
31+
- python-version: "3.10"
32+
tf-version: "2.15.0"
33+
protobuf-version: ""
34+
- python-version: "3.11"
35+
tf-version: "2.15.0"
36+
protobuf-version: ""
8237

8338
steps:
39+
- uses: actions/checkout@v5
40+
41+
- name: Detect code-related changes
42+
id: filter
43+
uses: dorny/paths-filter@v3
44+
with:
45+
filters: |
46+
code_related:
47+
- 'deepmatch/**'
48+
- 'tests/**'
49+
- 'setup.py'
50+
- '.github/workflows/**'
51+
52+
- name: Docs-only PR fast-path
53+
if: ${{ github.event_name == 'pull_request' && steps.filter.outputs.code_related != 'true' }}
54+
run: echo "Docs-only PR detected; skipping heavy CI steps."
55+
56+
- name: Setup python environment
57+
if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.code_related == 'true' }}
58+
uses: actions/setup-python@v6
59+
with:
60+
python-version: ${{ matrix.python-version }}
61+
62+
- name: Install dependencies
63+
if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.code_related == 'true' }}
64+
run: |
65+
python -m pip install -q --upgrade pip setuptools wheel
66+
python -m pip install -q "numpy<2"
67+
python -m pip install -q tensorflow==${{ matrix.tf-version }}
68+
python -m pip install -q pytest pytest-cov
69+
python -m pip install -e .
70+
71+
- name: Install TF1 protobuf pin
72+
if: ${{ (github.event_name != 'pull_request' || steps.filter.outputs.code_related == 'true') && matrix.protobuf-version != '' }}
73+
run: |
74+
python -m pip install -q protobuf==${{ matrix.protobuf-version }}
8475
85-
- uses: actions/checkout@v3
76+
- name: Dependency check
77+
if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.code_related == 'true' }}
78+
run: |
79+
python -m pip check
8680
87-
- name: Setup python environment
88-
uses: actions/setup-python@v4
89-
with:
90-
python-version: ${{ matrix.python-version }}
81+
- name: Test with pytest
82+
if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.code_related == 'true' }}
83+
timeout-minutes: 240
84+
run: |
85+
pytest --cov=deepmatch --cov-report=xml --cov-report=term-missing:skip-covered
9186
92-
- name: Install dependencies
93-
run: |
94-
sudo apt update && sudo apt install -y pkg-config libhdf5-dev
95-
pip3 install -q tensorflow==${{ matrix.tf-version }}
96-
pip install -q protobuf==3.19.0
97-
pip install -q requests
98-
pip install -e .
99-
- name: Test with pytest
100-
timeout-minutes: 120
101-
run: |
102-
pip install -q pytest
103-
pip install -q pytest-cov
104-
pip install -q python-coveralls
105-
pytest --cov=deepmatch --cov-report=xml
106-
- name: Upload coverage to Codecov
107-
uses: codecov/codecov-action@v3.1.0
108-
with:
109-
token: ${{secrets.CODECOV_TOKEN}}
110-
file: ./coverage.xml
111-
flags: pytest
112-
name: py${{ matrix.python-version }}-tf${{ matrix.tf-version }}
87+
- name: Upload coverage to Codecov
88+
if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.code_related == 'true' }}
89+
uses: codecov/codecov-action@v6
90+
with:
91+
token: ${{ secrets.CODECOV_TOKEN }}
92+
files: ./coverage.xml
93+
flags: pytest
94+
name: py${{ matrix.python-version }}-tf${{ matrix.tf-version }}

.readthedocs.yml

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

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# DeepMatch
22

33
[![Python Versions](https://img.shields.io/pypi/pyversions/deepmatch.svg)](https://pypi.org/project/deepmatch)
4-
[![TensorFlow Versions](https://img.shields.io/badge/TensorFlow-1.9+/2.0+-blue.svg)](https://pypi.org/project/deepmatch)
4+
[![TensorFlow Versions](https://img.shields.io/badge/TensorFlow-1.15/2.0+-blue.svg)](https://pypi.org/project/deepmatch)
55
[![Downloads](https://pepy.tech/badge/deepmatch)](https://pepy.tech/project/deepmatch)
66
[![PyPI Version](https://img.shields.io/pypi/v/deepmatch.svg)](https://pypi.org/project/deepmatch)
77
[![GitHub Issues](https://img.shields.io/github/issues/shenweichen/deepmatch.svg
@@ -10,14 +10,27 @@
1010

1111

1212
[![Documentation Status](https://readthedocs.org/projects/deepmatch/badge/?version=latest)](https://deepmatch.readthedocs.io/)
13-
![CI status](https://github.com/shenweichen/deepmatch/workflows/CI/badge.svg)
13+
[![CI](https://github.com/shenweichen/DeepMatch/actions/workflows/ci.yml/badge.svg)](https://github.com/shenweichen/DeepMatch/actions/workflows/ci.yml)
1414
[![codecov](https://codecov.io/gh/shenweichen/DeepMatch/branch/master/graph/badge.svg)](https://codecov.io/gh/shenweichen/DeepMatch)
1515
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/c5a2769ec35444d8958f6b58ff85029b)](https://www.codacy.com/gh/shenweichen/DeepMatch/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=shenweichen/DeepMatch&amp;utm_campaign=Badge_Grade)
1616
[![Disscussion](https://img.shields.io/badge/chat-wechat-brightgreen?style=flat)](https://github.com/shenweichen/DeepMatch#disscussiongroup)
1717
[![License](https://img.shields.io/github/license/shenweichen/deepmatch.svg)](https://github.com/shenweichen/deepmatch/blob/master/LICENSE)
1818

1919
DeepMatch is a deep matching model library for recommendations & advertising. It's easy to **train models** and to **export representation vectors** for user and item which can be used for **ANN search**.You can use any complex model with `model.fit()`and `model.predict()` .
2020

21+
## Installation and compatibility
22+
23+
DeepMatch does not pin or install TensorFlow for you. Install a TensorFlow build that matches your Python, NumPy, CPU/GPU, and operating system first, then install DeepMatch:
24+
25+
```bash
26+
pip install tensorflow
27+
pip install deepmatch
28+
```
29+
30+
For Python `>=3.9`, DeepMatch and its dependencies allow modern `h5py` releases with `h5py>=3.7.0`. If TensorFlow reports a NumPy conflict, follow the TensorFlow requirement for your selected TensorFlow release, for example using `numpy<2` when required by TensorFlow.
31+
32+
Use public `tensorflow.keras` APIs in your own code and examples. Avoid mixing `tensorflow.python.keras` with `tensorflow.keras`, because `tensorflow.python.*` is private TensorFlow API and can break model serialization or optimizer/metric loading across TensorFlow versions.
33+
2134
Let's [**Get Started!**](https://deepmatch.readthedocs.io/en/latest/Quick-Start.html) or [**Run examples**](./examples/colab_MovieLen1M_YoutubeDNN.ipynb) !
2235

2336

@@ -88,4 +101,3 @@ Let's [**Get Started!**](https://deepmatch.readthedocs.io/en/latest/Quick-Start.
88101
|公众号:浅梦学习笔记|微信:deepctrbot|学习小组 [加入](https://t.zsxq.com/026UJEuzv) [主题集合](https://mp.weixin.qq.com/mp/appmsgalbum?__biz=MjM5MzY4NzE3MA==&action=getalbum&album_id=1361647041096843265&scene=126#wechat_redirect)|
89102
|:--:|:--:|:--:|
90103
| [![公众号](./docs/pics/code.png)](https://github.com/shenweichen/AlgoNotes)| [![微信](./docs/pics/deepctrbot.png)](https://github.com/shenweichen/AlgoNotes)|[![学习小组](./docs/pics/planet_github.png)](https://t.zsxq.com/026UJEuzv)|
91-

deepmatch/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from .utils import check_version
22

3-
__version__ = '0.3.1'
3+
__version__ = '0.3.2'
44
check_version(__version__)

deepmatch/layers/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import numpy as np
99
import tensorflow as tf
1010
from deepctr.layers.utils import reduce_max, reduce_mean, reduce_sum, concat_func, div, softmax
11-
from tensorflow.python.keras.initializers import Zeros
12-
from tensorflow.python.keras.layers import Layer
11+
from tensorflow.keras.initializers import Zeros
12+
from tensorflow.keras.layers import Layer
1313

1414

1515
class PoolingLayer(Layer):

deepmatch/layers/interaction.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import tensorflow as tf
99
from deepctr.layers.normalization import LayerNormalization
1010
from deepctr.layers.utils import softmax, reduce_mean
11-
from tensorflow.python.keras.initializers import TruncatedNormal
12-
from tensorflow.python.keras.layers import Layer, Dense, Dropout
11+
from tensorflow.keras.initializers import TruncatedNormal
12+
from tensorflow.keras.layers import Layer, Dense, Dropout
1313

1414

1515
class DotAttention(Layer):

deepmatch/layers/sequence.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"""
77

88
import tensorflow as tf
9-
from tensorflow.python.keras.layers import Layer
9+
from tensorflow.keras.layers import Layer
1010

1111

1212
class DynamicMultiRNN(Layer):

deepmatch/models/comirec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
embedding_lookup, varlen_embedding_lookup, get_varlen_pooling_list, get_dense_input, build_input_features
1212
from deepctr.layers import DNN, PositionEncoding
1313
from deepctr.layers.utils import NoMask, combined_dnn_input, add_func
14-
from tensorflow.python.keras.layers import Concatenate, Lambda
15-
from tensorflow.python.keras.models import Model
14+
from tensorflow.keras.layers import Concatenate, Lambda
15+
from tensorflow.keras.models import Model
1616

1717
from ..inputs import create_embedding_matrix
1818
from ..layers.core import CapsuleLayer, PoolingLayer, MaskUserEmbedding, LabelAwareAttention, SampledSoftmaxLayer, \

deepmatch/models/dssm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from deepctr.feature_column import build_input_features, create_embedding_matrix
1111
from deepctr.layers import PredictionLayer, DNN, combined_dnn_input
12-
from tensorflow.python.keras.models import Model
12+
from tensorflow.keras.models import Model
1313

1414
from ..inputs import input_from_feature_columns
1515
from ..layers.core import InBatchSoftmaxLayer

deepmatch/models/fm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
from deepctr.feature_column import build_input_features
77
from deepctr.layers.core import PredictionLayer
88
from deepctr.layers.utils import concat_func, reduce_sum
9-
from tensorflow.python.keras.layers import Lambda
10-
from tensorflow.python.keras.models import Model
9+
from tensorflow.keras.layers import Lambda
10+
from tensorflow.keras.models import Model
1111

1212
from ..inputs import create_embedding_matrix, input_from_feature_columns
1313
from ..layers.core import InBatchSoftmaxLayer

0 commit comments

Comments
 (0)