From a5ada1e043e3ad8429984ca20e2ace1402b70aba Mon Sep 17 00:00:00 2001 From: WuHaobo Date: Tue, 21 Apr 2020 00:49:09 +0800 Subject: [PATCH] add ad --- .pre-commit-config.yaml | 6 ------ ppcls/utils/logger.py | 15 ++++++++++++++- tools/train.py | 10 +++++++--- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 676872ba..66263810 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,12 +24,6 @@ files: \.(md|yml)$ - id: check-case-conflict -- repo: https://github.com/asottile/reorder_python_imports - rev: v1.9.0 - hooks: - - id: reorder-python-imports - args: [--py3-plus] - - repo: https://github.com/Lucas-C/pre-commit-hooks sha: v1.0.1 hooks: diff --git a/ppcls/utils/logger.py b/ppcls/utils/logger.py index 20575c32..b66818fd 100644 --- a/ppcls/utils/logger.py +++ b/ppcls/utils/logger.py @@ -72,10 +72,23 @@ def error(fmt, *args): def advertisement(): + """ + Show the advertising message like the following: + + =========================================================== + == PaddleClas is powered by PaddlePaddle ! == + =========================================================== + == == + == For more info please go to the following website. == + == == + == https://github.com/PaddlePaddle/PaddleClas == + =========================================================== + + """ copyright = "PaddleClas is powered by PaddlePaddle !" info = "For more info please go to the following website." website = "https://github.com/PaddlePaddle/PaddleClas" - AD_LEN = 55 + AD_LEN = 6 + len(max([copyright, info, website], key=len)) _logger.info("\n{0}\n{1}\n{2}\n{3}\n{4}\n{5}\n{6}\n{7}\n".format( "=" * (AD_LEN + 4), diff --git a/tools/train.py b/tools/train.py index b4e3c788..1fc1465e 100644 --- a/tools/train.py +++ b/tools/train.py @@ -11,19 +11,23 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + import argparse import os import paddle.fluid as fluid -import program from paddle.fluid.incubate.fleet.base import role_maker from paddle.fluid.incubate.fleet.collective import fleet from ppcls.data import Reader from ppcls.utils import logger from ppcls.utils.config import get_config -from ppcls.utils.save_load import init_model -from ppcls.utils.save_load import save_model +from ppcls.utils.save_load import init_model, save_model +import program def parse_args(): -- GitLab