From 8260a08a4bb155aeebaeb29844197c68de39ec3c Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Thu, 30 Jul 2020 03:06:54 +0800 Subject: [PATCH] SUBMARINE-588. [SDK] Fix checkstyle error in core.py ### What is this PR for? Fix checkstyle error in submarine/ml/pytorch/model/ctr/ https://github.com/apache/submarine/runs/923503735 ```bash Run ./submarine-sdk/pysubmarine/github-actions/lint.sh +++ dirname ./submarine-sdk/pysubmarine/github-actions/lint.sh ++ cd ./submarine-sdk/pysubmarine/github-actions ++ pwd + FWDIR=/home/runner/work/submarine/submarine/submarine-sdk/pysubmarine/github-actions + cd /home/runner/work/submarine/submarine/submarine-sdk/pysubmarine/github-actions + cd .. + pycodestyle --max-line-length=100 -- submarine tests + pylint --ignore experiment '--msg-template={path} ({line},{column}): [{msg_id} {symbol}] {msg}' --rcfile=pylintrc -- submarine tests ************* Module submarine.ml.pytorch.model.ctr.afm submarine/ml/pytorch/model/ctr/afm.py (30,0): [W0223 abstract-method] Method '_forward_unimplemented' is abstract in class 'Module' but is not overridden submarine/ml/pytorch/model/ctr/afm.py (57,0): [W0223 abstract-method] Method '_forward_unimplemented' is abstract in class 'Module' but is not overridden submarine/ml/pytorch/model/ctr/afm.py (81,0): [W0223 abstract-method] Method '_forward_unimplemented' is abstract in class 'Module' but is not overridden ************* Module submarine.ml.pytorch.model.ctr.deepfm submarine/ml/pytorch/model/ctr/deepfm.py (32,0): [W0223 abstract-method] Method '_forward_unimplemented' is abstract in class 'Module' but is not overridden ************* Module submarine.ml.pytorch.layers.core submarine/ml/pytorch/layers/core.py (20,0): [W0223 abstract-method] Method '_forward_unimplemented' is abstract in class 'Module' but is not overridden submarine/ml/pytorch/layers/core.py (42,0): [W0223 abstract-method] Method '_forward_unimplemented' is abstract in class 'Module' but is not overridden submarine/ml/pytorch/layers/core.py (57,0): [W0223 abstract-method] Method '_forward_unimplemented' is abstract in class 'Module' but is not overridden submarine/ml/pytorch/layers/core.py (72,0): [W0223 abstract-method] Method '_forward_unimplemented' is abstract in class 'Module' but is not overridden ``` ### What type of PR is it? [Hot Fix] ### Todos * [ ] - Task ### What is the Jira issue? https://issues.apache.org/jira/browse/SUBMARINE-588 ### How should this be tested? https://travis-ci.org/github/pingsutw/hadoop-submarine/builds/712952549 ### Screenshots (if appropriate) ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: Kevin Su Closes #365 from pingsutw/SUBMARINE-588 and squashes the following commits: 857bdfe [Kevin Su] Add apt update 5cb18cf [Kevin Su] Update torch version 4ff4458 [Kevin Su] Update pip e3f4511 [Kevin Su] SUBMARINE-588. [SDK] Fix checkstyle error in core.py --- .github/workflows/python.yml | 2 ++ submarine-sdk/pysubmarine/setup.py | 2 +- submarine-sdk/pysubmarine/submarine/ml/pytorch/layers/core.py | 1 + submarine-sdk/pysubmarine/submarine/ml/pytorch/model/ctr/afm.py | 1 + .../pysubmarine/submarine/ml/pytorch/model/ctr/deepfm.py | 1 + 5 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 6a5a08d810..6bdadc3945 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -18,6 +18,7 @@ jobs: - uses: actions/checkout@v1 - name: Verify MySQL connection from host run: | + sudo apt update sudo apt-get install -y mysql-client sudo service mysql restart # default mysql account and password in github actions @@ -34,6 +35,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | + pip install --upgrade pip pip install ./submarine-sdk/pysubmarine/. pip install -q tensorflow==${{ matrix.tf-version }} pip install -r ./submarine-sdk/pysubmarine/github-actions/test-requirements.txt diff --git a/submarine-sdk/pysubmarine/setup.py b/submarine-sdk/pysubmarine/setup.py index 667c65f187..35b036e88b 100644 --- a/submarine-sdk/pysubmarine/setup.py +++ b/submarine-sdk/pysubmarine/setup.py @@ -39,7 +39,7 @@ 'certifi >= 14.05.14', 'python-dateutil >= 2.5.3', 'pyarrow==0.17.0', - 'torch', + 'torch>=1.4.0', ], classifiers=[ 'Intended Audience :: Developers', diff --git a/submarine-sdk/pysubmarine/submarine/ml/pytorch/layers/core.py b/submarine-sdk/pysubmarine/submarine/ml/pytorch/layers/core.py index 98c8472060..d0fb2f584b 100644 --- a/submarine-sdk/pysubmarine/submarine/ml/pytorch/layers/core.py +++ b/submarine-sdk/pysubmarine/submarine/ml/pytorch/layers/core.py @@ -17,6 +17,7 @@ from torch import nn +# pylint: disable=W0223 class FeatureLinear(nn.Module): def __init__(self, num_features, out_features): diff --git a/submarine-sdk/pysubmarine/submarine/ml/pytorch/model/ctr/afm.py b/submarine-sdk/pysubmarine/submarine/ml/pytorch/model/ctr/afm.py index e5314f753c..cb3454f25d 100644 --- a/submarine-sdk/pysubmarine/submarine/ml/pytorch/model/ctr/afm.py +++ b/submarine-sdk/pysubmarine/submarine/ml/pytorch/model/ctr/afm.py @@ -27,6 +27,7 @@ def model_fn(self, params): return _AFM(**self.params['model']['kwargs']) +# pylint: disable=W0223 class _AFM(nn.Module): def __init__(self, num_features: int, embedding_dim: int, diff --git a/submarine-sdk/pysubmarine/submarine/ml/pytorch/model/ctr/deepfm.py b/submarine-sdk/pysubmarine/submarine/ml/pytorch/model/ctr/deepfm.py index d6c86ae0e9..fd239604e3 100644 --- a/submarine-sdk/pysubmarine/submarine/ml/pytorch/model/ctr/deepfm.py +++ b/submarine-sdk/pysubmarine/submarine/ml/pytorch/model/ctr/deepfm.py @@ -29,6 +29,7 @@ def model_fn(self, params): return _DeepFM(**self.params['model']['kwargs']) +# pylint: disable=W0223 class _DeepFM(nn.Module): def __init__(self, num_fields, num_features, embedding_dim, out_features,