From 5522817b259866c8d0b0ce477fa45b2254078760 Mon Sep 17 00:00:00 2001 From: zhou <7864854+yiwabxiangzhou@user.noreply.gitee.com> Date: Tue, 24 May 2022 08:17:58 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=B0=86loss-scale=3D?= =?UTF-8?q?=E2=80=9Cdynamic=E2=80=9D=EF=BC=8C=E5=9B=A0=E4=B8=BA=E7=BB=8F?= =?UTF-8?q?=E8=BF=87=E5=B0=9D=E8=AF=95=E4=B8=8D=E6=94=B6=E6=95=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PyTorch/contrib/cv/classification/RepVGG/train.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PyTorch/contrib/cv/classification/RepVGG/train.py b/PyTorch/contrib/cv/classification/RepVGG/train.py index 16966a1e20..20a7903807 100644 --- a/PyTorch/contrib/cv/classification/RepVGG/train.py +++ b/PyTorch/contrib/cv/classification/RepVGG/train.py @@ -37,6 +37,8 @@ import time import warnings import torch +if torch.__version__ >= "1.8.1": + import torch_npu import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn -- Gitee From 605c757781c22ff21d6fa1309c193486070eeec6 Mon Sep 17 00:00:00 2001 From: zhou <7864854+yiwabxiangzhou@user.noreply.gitee.com> Date: Wed, 25 May 2022 14:34:55 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=E6=9B=B4=E6=94=B9loss-scale=E4=B8=BAdynami?= =?UTF-8?q?c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PyTorch/contrib/cv/classification/RepVGG/test/train_full_8p.sh | 2 +- PyTorch/contrib/cv/classification/RepVGG/train.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PyTorch/contrib/cv/classification/RepVGG/test/train_full_8p.sh b/PyTorch/contrib/cv/classification/RepVGG/test/train_full_8p.sh index dd0abad87b..e025ccb2e1 100644 --- a/PyTorch/contrib/cv/classification/RepVGG/test/train_full_8p.sh +++ b/PyTorch/contrib/cv/classification/RepVGG/test/train_full_8p.sh @@ -42,5 +42,5 @@ nohup taskset -c $PID_START-$PID_END python3.7.5 -u train.py \ --custom-weight-decay \ --amp \ --opt-level "O2" \ ---loss-scale-value 32 > repvgg_8p.log 2>&1 & +--loss-scale-value "dynamic" > repvgg_8p.log 2>&1 & done diff --git a/PyTorch/contrib/cv/classification/RepVGG/train.py b/PyTorch/contrib/cv/classification/RepVGG/train.py index 20a7903807..da17c7ed9d 100644 --- a/PyTorch/contrib/cv/classification/RepVGG/train.py +++ b/PyTorch/contrib/cv/classification/RepVGG/train.py @@ -105,7 +105,7 @@ parser.add_argument("--num_gpus", default=1, type=int) parser.add_argument('--amp', default=False, action='store_true', help='use amp to train the model') parser.add_argument('--opt-level', default=None, type=str, help='apex optimize level') -parser.add_argument('--loss-scale-value', default='1024', type=int, help='static loss scale value') +parser.add_argument('--loss-scale-value', default='dynamic', type=str, help='static loss scale value') # other settings parser.add_argument('-p', '--print-freq', default=10, type=int, -- Gitee From 882e1627ee6b4c050b8417ceccd9258eaa452c90 Mon Sep 17 00:00:00 2001 From: zhou <7864854+yiwabxiangzhou@user.noreply.gitee.com> Date: Wed, 25 May 2022 14:49:48 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8D=8F=E8=AE=AE?= =?UTF-8?q?=E7=94=B3=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contrib/cv/classification/RepVGG/train.py | 38 ++++++------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/PyTorch/contrib/cv/classification/RepVGG/train.py b/PyTorch/contrib/cv/classification/RepVGG/train.py index da17c7ed9d..280f451f9a 100644 --- a/PyTorch/contrib/cv/classification/RepVGG/train.py +++ b/PyTorch/contrib/cv/classification/RepVGG/train.py @@ -1,33 +1,17 @@ -# BSD 3-Clause License +# -*- coding: utf-8 -*- +# Copyright 2020 Huawei Technologies Co., Ltd # -# Copyright (c) 2017 xxxx -# All rights reserved. -# Copyright 2021 Huawei Technologies Co., Ltd +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: +# http://www.apache.org/licenses/LICENSE-2.0 # -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# * Neither the name of the copyright holder nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. # ============================================================================ import argparse import os -- Gitee