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 dd0abad87bc7908e3e3bac616aa44538ae118e61..e025ccb2e13551171e1be8ce8aa0032665f4c21e 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 16966a1e2003f921c98f0526854e1b9dc23eabf3..280f451f9a019e89e81b387e9bf2cd90719ae668 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 @@ -37,6 +21,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 @@ -103,7 +89,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,