diff --git a/cv/classification/alexnet/pytorch/__init__.py b/cv/classification/alexnet/pytorch/__init__.py index 011573976ed1c1e69c9282a42400acc3e68c3586..6faec1658ec48ce73b4ab3a65ada4e52b4a403bf 100644 --- a/cv/classification/alexnet/pytorch/__init__.py +++ b/cv/classification/alexnet/pytorch/__init__.py @@ -1,18 +1,3 @@ -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. - from .utils import * from .common_utils import * from .data_loader import * diff --git a/cv/classification/alexnet/pytorch/common_utils/__init__.py b/cv/classification/alexnet/pytorch/common_utils/__init__.py index 7d2e011f7cec1af806b4635fcf65849b55f1111b..32e8c4f57a6ba20a37bb3cfd1e7a5ed59a61f8d4 100644 --- a/cv/classification/alexnet/pytorch/common_utils/__init__.py +++ b/cv/classification/alexnet/pytorch/common_utils/__init__.py @@ -1,18 +1,3 @@ -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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 random import numpy as np @@ -35,4 +20,4 @@ def manual_seed(seed, deterministic=False): torch.backends.cudnn.benchmark = False else: torch.backends.cudnn.deterministic = False - torch.backends.cudnn.benchmark = True + torch.backends.cudnn.benchmark = True \ No newline at end of file diff --git a/cv/classification/alexnet/pytorch/common_utils/dist.py b/cv/classification/alexnet/pytorch/common_utils/dist.py index f556707d9067171a7bd45be80902561ead65b9fc..ea56ca267755706ab1a62e9d5e93c71b6245c639 100644 --- a/cv/classification/alexnet/pytorch/common_utils/dist.py +++ b/cv/classification/alexnet/pytorch/common_utils/dist.py @@ -1,18 +1,6 @@ -# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. +# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + from collections import defaultdict, deque import datetime diff --git a/cv/classification/alexnet/pytorch/common_utils/metric_logger.py b/cv/classification/alexnet/pytorch/common_utils/metric_logger.py index eadf5fe15b43f0a7ead082568ba52d0f5e690257..960641c4da4a8c94aa418c44a22ef5ded8908392 100644 --- a/cv/classification/alexnet/pytorch/common_utils/metric_logger.py +++ b/cv/classification/alexnet/pytorch/common_utils/metric_logger.py @@ -1,18 +1,6 @@ -# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. +# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + from collections import defaultdict import datetime diff --git a/cv/classification/alexnet/pytorch/common_utils/misc.py b/cv/classification/alexnet/pytorch/common_utils/misc.py index 8c5e49bcd21622b00e41551257ced4473c97b450..c9b501cf8f6267488d002f2ae2a526c56ad2c392 100644 --- a/cv/classification/alexnet/pytorch/common_utils/misc.py +++ b/cv/classification/alexnet/pytorch/common_utils/misc.py @@ -1,18 +1,3 @@ -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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 os import sys import errno @@ -23,4 +8,4 @@ def mkdir(path): os.makedirs(path) except OSError as e: if e.errno != errno.EEXIST: - raise + raise \ No newline at end of file diff --git a/cv/classification/alexnet/pytorch/common_utils/smooth_value.py b/cv/classification/alexnet/pytorch/common_utils/smooth_value.py index 3360b91f6811ed94a70c263927044b570d5f220a..30cb89d6001999bcad91ba784cc8f871080a1ff8 100644 --- a/cv/classification/alexnet/pytorch/common_utils/smooth_value.py +++ b/cv/classification/alexnet/pytorch/common_utils/smooth_value.py @@ -1,18 +1,5 @@ -# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. +# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from collections import defaultdict, deque @@ -85,4 +72,4 @@ class SmoothedValue(object): avg=self.avg, global_avg=self.global_avg, max=self.max, - value=self.value) + value=self.value) \ No newline at end of file diff --git a/cv/classification/alexnet/pytorch/dataloader/__init__.py b/cv/classification/alexnet/pytorch/dataloader/__init__.py index 66b217b8507dfb048e3a366fc0fe6374f24eedc4..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/cv/classification/alexnet/pytorch/dataloader/__init__.py +++ b/cv/classification/alexnet/pytorch/dataloader/__init__.py @@ -1,14 +0,0 @@ -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. \ No newline at end of file diff --git a/cv/classification/alexnet/pytorch/dataloader/classification.py b/cv/classification/alexnet/pytorch/dataloader/classification.py index a6c0a6b6d2b0f2b1c9fb83c55825aa712cf500c2..030af6dee3ed4687b0616952fc4cb1c45da6c250 100644 --- a/cv/classification/alexnet/pytorch/dataloader/classification.py +++ b/cv/classification/alexnet/pytorch/dataloader/classification.py @@ -1,18 +1,11 @@ -# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. +# Copyright Declaration: This software, including all of its code and documentation, +# except for the third-party software it contains, is a copyrighted work of Shanghai Iluvatar CoreX +# Semiconductor Co., Ltd. and its affiliates ("Iluvatar CoreX") in accordance with the PRC Copyright +# Law and relevant international treaties, and all rights contained therein are enjoyed by Iluvatar +# CoreX. No user of this software shall have any right, ownership or interest in this software and +# any use of this software shall be in compliance with the terms and conditions of the End User +# License Agreement. import os diff --git a/cv/classification/alexnet/pytorch/dataloader/dali_classification.py b/cv/classification/alexnet/pytorch/dataloader/dali_classification.py index 3662fdd166c7c18377c7f19f573f425181384c06..4c92283b234ceb8d9932eabd1bb1bb01d467fefb 100644 --- a/cv/classification/alexnet/pytorch/dataloader/dali_classification.py +++ b/cv/classification/alexnet/pytorch/dataloader/dali_classification.py @@ -1,19 +1,11 @@ -# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. - +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. +# Copyright Declaration: This software, including all of its code and documentation, +# except for the third-party software it contains, is a copyrighted work of Shanghai Iluvatar CoreX +# Semiconductor Co., Ltd. and its affiliates ("Iluvatar CoreX") in accordance with the PRC Copyright +# Law and relevant international treaties, and all rights contained therein are enjoyed by Iluvatar +# CoreX. No user of this software shall have any right, ownership or interest in this software and +# any use of this software shall be in compliance with the terms and conditions of the End User +# License Agreement. import os @@ -126,4 +118,4 @@ def main(arguments): if __name__ == '__main__': import os, time, sys import argparse - sys.exit(main(sys.argv[1:])) + sys.exit(main(sys.argv[1:])) \ No newline at end of file diff --git a/cv/classification/alexnet/pytorch/dataloader/utils/__init__.py b/cv/classification/alexnet/pytorch/dataloader/utils/__init__.py index 66b217b8507dfb048e3a366fc0fe6374f24eedc4..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/cv/classification/alexnet/pytorch/dataloader/utils/__init__.py +++ b/cv/classification/alexnet/pytorch/dataloader/utils/__init__.py @@ -1,14 +0,0 @@ -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. \ No newline at end of file diff --git a/cv/classification/alexnet/pytorch/dataloader/utils/presets_classification.py b/cv/classification/alexnet/pytorch/dataloader/utils/presets_classification.py index f1f58abbde3bae63dbbc8b4a8375a5f697fb0499..b3f559af4457bef4fe537e93ffa776947517735b 100644 --- a/cv/classification/alexnet/pytorch/dataloader/utils/presets_classification.py +++ b/cv/classification/alexnet/pytorch/dataloader/utils/presets_classification.py @@ -1,18 +1,5 @@ -# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. +# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from torchvision.transforms import autoaugment, transforms diff --git a/cv/classification/alexnet/pytorch/model/alexnet.py b/cv/classification/alexnet/pytorch/model/alexnet.py index 0be32bb486237b3bbd0b310893f408ed019ad282..484f404f5f797ce7a9afc7d010e4b2cc367b8982 100644 --- a/cv/classification/alexnet/pytorch/model/alexnet.py +++ b/cv/classification/alexnet/pytorch/model/alexnet.py @@ -1,18 +1,3 @@ -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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 torch.nn as nn diff --git a/cv/classification/alexnet/pytorch/start_scripts/get_num_devices.sh b/cv/classification/alexnet/pytorch/start_scripts/get_num_devices.sh index 9e79ba13813458d62f7d0d4bf4d2928833f8a287..7c543335e94067ed34b8bcf06e4b44333945e5c7 100644 --- a/cv/classification/alexnet/pytorch/start_scripts/get_num_devices.sh +++ b/cv/classification/alexnet/pytorch/start_scripts/get_num_devices.sh @@ -1,18 +1,4 @@ #!/bin/bash -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. devices=$CUDA_VISIBLE_DEVICES if [ -n "$devices" ]; then diff --git a/cv/classification/alexnet/pytorch/start_scripts/train_alexnet_dist_torch.sh b/cv/classification/alexnet/pytorch/start_scripts/train_alexnet_dist_torch.sh index ce98a6b2fe7d3b429feda141fafecfc60e065147..24b76e6c2f12c91ae7c0277a3b4df454b9e3c1cf 100644 --- a/cv/classification/alexnet/pytorch/start_scripts/train_alexnet_dist_torch.sh +++ b/cv/classification/alexnet/pytorch/start_scripts/train_alexnet_dist_torch.sh @@ -1,18 +1,3 @@ -#!/bin/bash -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. source ./get_num_devices.sh python3 -m torch.distributed.launch --nproc_per_node=$IX_NUM_CUDA_VISIBLE_DEVICES --use_env \ diff --git a/cv/classification/alexnet/pytorch/start_scripts/train_alexnet_torch.sh b/cv/classification/alexnet/pytorch/start_scripts/train_alexnet_torch.sh index a24350f53ce672a7e168f82ec59ea23ca8201320..abe0229d69dc6ed8c3e02cf2718bb7606d376f52 100644 --- a/cv/classification/alexnet/pytorch/start_scripts/train_alexnet_torch.sh +++ b/cv/classification/alexnet/pytorch/start_scripts/train_alexnet_torch.sh @@ -1,18 +1,3 @@ -#!/bin/bash -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. python3 ../train.py \ --data-path /home/datasets/cv/imagenet \ diff --git a/cv/classification/alexnet/pytorch/train.py b/cv/classification/alexnet/pytorch/train.py index b7b8ad9fcc2c5d28d12785161b029bc2c0359ac0..9a5fa8745d9a3b494a5f3eb7f08de8b8f6e96e27 100644 --- a/cv/classification/alexnet/pytorch/train.py +++ b/cv/classification/alexnet/pytorch/train.py @@ -1,18 +1,5 @@ -# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. +# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import datetime import os diff --git a/cv/classification/alexnet/pytorch/train_horovod.py b/cv/classification/alexnet/pytorch/train_horovod.py index fdb5b15d3287e8de2f3d77ef9e3fd6114259bd32..fee424a752fce604aa1a83458af8ad5b2f9c5dcf 100644 --- a/cv/classification/alexnet/pytorch/train_horovod.py +++ b/cv/classification/alexnet/pytorch/train_horovod.py @@ -1,18 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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 torch import argparse import torch.backends.cudnn as cudnn diff --git a/cv/classification/alexnet/pytorch/utils_.py b/cv/classification/alexnet/pytorch/utils_.py index 3adf157dadd95a7213f29eedd7288ad725f8b17a..3d34c4df0e66af0812ee6b9c1176be8a75ecce18 100644 --- a/cv/classification/alexnet/pytorch/utils_.py +++ b/cv/classification/alexnet/pytorch/utils_.py @@ -1,18 +1,5 @@ -# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. +# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from collections import defaultdict, deque, OrderedDict diff --git a/cv/classification/efficientnet_b4/pytorch/common_utils/smooth_value.py b/cv/classification/efficientnet_b4/pytorch/common_utils/smooth_value.py index ce54196fe3088672f04b1b1edc432fc8023c061e..30cb89d6001999bcad91ba784cc8f871080a1ff8 100755 --- a/cv/classification/efficientnet_b4/pytorch/common_utils/smooth_value.py +++ b/cv/classification/efficientnet_b4/pytorch/common_utils/smooth_value.py @@ -1,6 +1,6 @@ +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. + from collections import defaultdict, deque import datetime @@ -72,4 +72,4 @@ class SmoothedValue(object): avg=self.avg, global_avg=self.global_avg, max=self.max, - value=self.value) + value=self.value) \ No newline at end of file diff --git a/cv/classification/efficientnet_b4/pytorch/train.py b/cv/classification/efficientnet_b4/pytorch/train.py index 98e92eba3ff383cccc0801d2735160cac9ddf541..949b9470e50da743d462aeed2c18040a652efc69 100755 --- a/cv/classification/efficientnet_b4/pytorch/train.py +++ b/cv/classification/efficientnet_b4/pytorch/train.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import datetime diff --git a/cv/classification/googlenet/pytorch/__init__.py b/cv/classification/googlenet/pytorch/__init__.py index 70667c25f65559465d8db10198cede5f0fcddb06..6faec1658ec48ce73b4ab3a65ada4e52b4a403bf 100755 --- a/cv/classification/googlenet/pytorch/__init__.py +++ b/cv/classification/googlenet/pytorch/__init__.py @@ -1,17 +1,3 @@ -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. from .utils import * from .common_utils import * from .data_loader import * diff --git a/cv/classification/googlenet/pytorch/common_utils/__init__.py b/cv/classification/googlenet/pytorch/common_utils/__init__.py index 7e6377c90fe46f812613da61de8848eb2770c9de..32e8c4f57a6ba20a37bb3cfd1e7a5ed59a61f8d4 100755 --- a/cv/classification/googlenet/pytorch/common_utils/__init__.py +++ b/cv/classification/googlenet/pytorch/common_utils/__init__.py @@ -1,11 +1,3 @@ -# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. -# Copyright Declaration: This software, including all of its code and documentation, -# except for the third-party software it contains, is a copyrighted work of Shanghai Iluvatar CoreX -# Semiconductor Co., Ltd. and its affiliates ("Iluvatar CoreX") in accordance with the PRC Copyright -# Law and relevant international treaties, and all rights contained therein are enjoyed by Iluvatar -# CoreX. No user of this software shall have any right, ownership or interest in this software and -# any use of this software shall be in compliance with the terms and conditions of the End User -# License Agreement. import random import numpy as np diff --git a/cv/classification/googlenet/pytorch/common_utils/misc.py b/cv/classification/googlenet/pytorch/common_utils/misc.py index 3e366eca50effc35fc15114831b34dd6a71a183a..c9b501cf8f6267488d002f2ae2a526c56ad2c392 100755 --- a/cv/classification/googlenet/pytorch/common_utils/misc.py +++ b/cv/classification/googlenet/pytorch/common_utils/misc.py @@ -1,11 +1,3 @@ -# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. -# Copyright Declaration: This software, including all of its code and documentation, -# except for the third-party software it contains, is a copyrighted work of Shanghai Iluvatar CoreX -# Semiconductor Co., Ltd. and its affiliates ("Iluvatar CoreX") in accordance with the PRC Copyright -# Law and relevant international treaties, and all rights contained therein are enjoyed by Iluvatar -# CoreX. No user of this software shall have any right, ownership or interest in this software and -# any use of this software shall be in compliance with the terms and conditions of the End User -# License Agreement. import os import sys import errno diff --git a/cv/classification/googlenet/pytorch/common_utils/smooth_value.py b/cv/classification/googlenet/pytorch/common_utils/smooth_value.py index d4e3d2b6ffcc7d3ed9f3de607d113bcde7bd2dfe..30cb89d6001999bcad91ba784cc8f871080a1ff8 100755 --- a/cv/classification/googlenet/pytorch/common_utils/smooth_value.py +++ b/cv/classification/googlenet/pytorch/common_utils/smooth_value.py @@ -1,5 +1,4 @@ -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. @@ -73,4 +72,4 @@ class SmoothedValue(object): avg=self.avg, global_avg=self.global_avg, max=self.max, - value=self.value) + value=self.value) \ No newline at end of file diff --git a/cv/classification/googlenet/pytorch/dataloader/__init__.py b/cv/classification/googlenet/pytorch/dataloader/__init__.py index 23eeb377758ffd0cef6f4b909a2da77ba179c87a..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100755 --- a/cv/classification/googlenet/pytorch/dataloader/__init__.py +++ b/cv/classification/googlenet/pytorch/dataloader/__init__.py @@ -1,8 +0,0 @@ -# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. -# Copyright Declaration: This software, including all of its code and documentation, -# except for the third-party software it contains, is a copyrighted work of Shanghai Iluvatar CoreX -# Semiconductor Co., Ltd. and its affiliates ("Iluvatar CoreX") in accordance with the PRC Copyright -# Law and relevant international treaties, and all rights contained therein are enjoyed by Iluvatar -# CoreX. No user of this software shall have any right, ownership or interest in this software and -# any use of this software shall be in compliance with the terms and conditions of the End User -# License Agreement. diff --git a/cv/classification/googlenet/pytorch/dataloader/utils/__init__.py b/cv/classification/googlenet/pytorch/dataloader/utils/__init__.py index 23eeb377758ffd0cef6f4b909a2da77ba179c87a..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100755 --- a/cv/classification/googlenet/pytorch/dataloader/utils/__init__.py +++ b/cv/classification/googlenet/pytorch/dataloader/utils/__init__.py @@ -1,8 +0,0 @@ -# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. -# Copyright Declaration: This software, including all of its code and documentation, -# except for the third-party software it contains, is a copyrighted work of Shanghai Iluvatar CoreX -# Semiconductor Co., Ltd. and its affiliates ("Iluvatar CoreX") in accordance with the PRC Copyright -# Law and relevant international treaties, and all rights contained therein are enjoyed by Iluvatar -# CoreX. No user of this software shall have any right, ownership or interest in this software and -# any use of this software shall be in compliance with the terms and conditions of the End User -# License Agreement. diff --git a/cv/classification/googlenet/pytorch/train.py b/cv/classification/googlenet/pytorch/train.py index 63d1ccb4e3832f2c0ca6b2fc9cdc737c822b9868..bc6a458e3bf116bfc8419f786d045059f6a21030 100755 --- a/cv/classification/googlenet/pytorch/train.py +++ b/cv/classification/googlenet/pytorch/train.py @@ -1,17 +1,4 @@ -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import datetime diff --git a/cv/classification/googlenet/pytorch/utils_.py b/cv/classification/googlenet/pytorch/utils_.py index 31a4eebae6523619f7715662594b3dd52613580f..3d34c4df0e66af0812ee6b9c1176be8a75ecce18 100755 --- a/cv/classification/googlenet/pytorch/utils_.py +++ b/cv/classification/googlenet/pytorch/utils_.py @@ -1,18 +1,6 @@ +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. + from collections import defaultdict, deque, OrderedDict import copy diff --git a/cv/classification/resnet50/pytorch/__init__.py b/cv/classification/resnet50/pytorch/__init__.py index 38ed0d0b2aae2f5197b77fb14d8df54378adc750..6faec1658ec48ce73b4ab3a65ada4e52b4a403bf 100644 --- a/cv/classification/resnet50/pytorch/__init__.py +++ b/cv/classification/resnet50/pytorch/__init__.py @@ -1,17 +1,3 @@ -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. from .utils import * from .common_utils import * from .data_loader import * diff --git a/cv/classification/resnet50/pytorch/common_utils/__init__.py b/cv/classification/resnet50/pytorch/common_utils/__init__.py index 855a91a925db75636e71f1da82f90223ad82a633..32e8c4f57a6ba20a37bb3cfd1e7a5ed59a61f8d4 100644 --- a/cv/classification/resnet50/pytorch/common_utils/__init__.py +++ b/cv/classification/resnet50/pytorch/common_utils/__init__.py @@ -1,17 +1,3 @@ -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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 random import numpy as np diff --git a/cv/classification/resnet50/pytorch/common_utils/dist.py b/cv/classification/resnet50/pytorch/common_utils/dist.py index ac4831fbaf529bbb7fb92b1a4eedc555ae349cbf..ea56ca267755706ab1a62e9d5e93c71b6245c639 100644 --- a/cv/classification/resnet50/pytorch/common_utils/dist.py +++ b/cv/classification/resnet50/pytorch/common_utils/dist.py @@ -1,5 +1,4 @@ -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. diff --git a/cv/classification/resnet50/pytorch/common_utils/misc.py b/cv/classification/resnet50/pytorch/common_utils/misc.py index 3e366eca50effc35fc15114831b34dd6a71a183a..c9b501cf8f6267488d002f2ae2a526c56ad2c392 100644 --- a/cv/classification/resnet50/pytorch/common_utils/misc.py +++ b/cv/classification/resnet50/pytorch/common_utils/misc.py @@ -1,11 +1,3 @@ -# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. -# Copyright Declaration: This software, including all of its code and documentation, -# except for the third-party software it contains, is a copyrighted work of Shanghai Iluvatar CoreX -# Semiconductor Co., Ltd. and its affiliates ("Iluvatar CoreX") in accordance with the PRC Copyright -# Law and relevant international treaties, and all rights contained therein are enjoyed by Iluvatar -# CoreX. No user of this software shall have any right, ownership or interest in this software and -# any use of this software shall be in compliance with the terms and conditions of the End User -# License Agreement. import os import sys import errno diff --git a/cv/classification/resnet50/pytorch/dataloader/__init__.py b/cv/classification/resnet50/pytorch/dataloader/__init__.py index 23eeb377758ffd0cef6f4b909a2da77ba179c87a..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/cv/classification/resnet50/pytorch/dataloader/__init__.py +++ b/cv/classification/resnet50/pytorch/dataloader/__init__.py @@ -1,8 +0,0 @@ -# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. -# Copyright Declaration: This software, including all of its code and documentation, -# except for the third-party software it contains, is a copyrighted work of Shanghai Iluvatar CoreX -# Semiconductor Co., Ltd. and its affiliates ("Iluvatar CoreX") in accordance with the PRC Copyright -# Law and relevant international treaties, and all rights contained therein are enjoyed by Iluvatar -# CoreX. No user of this software shall have any right, ownership or interest in this software and -# any use of this software shall be in compliance with the terms and conditions of the End User -# License Agreement. diff --git a/cv/classification/resnet50/pytorch/dataloader/utils/__init__.py b/cv/classification/resnet50/pytorch/dataloader/utils/__init__.py index 23eeb377758ffd0cef6f4b909a2da77ba179c87a..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/cv/classification/resnet50/pytorch/dataloader/utils/__init__.py +++ b/cv/classification/resnet50/pytorch/dataloader/utils/__init__.py @@ -1,8 +0,0 @@ -# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. -# Copyright Declaration: This software, including all of its code and documentation, -# except for the third-party software it contains, is a copyrighted work of Shanghai Iluvatar CoreX -# Semiconductor Co., Ltd. and its affiliates ("Iluvatar CoreX") in accordance with the PRC Copyright -# Law and relevant international treaties, and all rights contained therein are enjoyed by Iluvatar -# CoreX. No user of this software shall have any right, ownership or interest in this software and -# any use of this software shall be in compliance with the terms and conditions of the End User -# License Agreement. diff --git a/cv/classification/resnet50/pytorch/dataloader/utils/presets_classification.py b/cv/classification/resnet50/pytorch/dataloader/utils/presets_classification.py index b2b518d02b0adf60480ffe0b233548afc74170cd..b3f559af4457bef4fe537e93ffa776947517735b 100644 --- a/cv/classification/resnet50/pytorch/dataloader/utils/presets_classification.py +++ b/cv/classification/resnet50/pytorch/dataloader/utils/presets_classification.py @@ -1,17 +1,3 @@ -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. # Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. diff --git a/cv/classification/resnet50/pytorch/train.py b/cv/classification/resnet50/pytorch/train.py index 3e13694d0231ab9b24c8713ada33aab9fb49b63e..03feeb0a0d6fa15eb4ca62156629c7bfdbe8807d 100644 --- a/cv/classification/resnet50/pytorch/train.py +++ b/cv/classification/resnet50/pytorch/train.py @@ -1,5 +1,4 @@ -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import datetime diff --git a/cv/classification/seresnext/pytorch/seresnext.py b/cv/classification/seresnext/pytorch/seresnext.py index 8785f87acd552047f3ccf67294ecf6516c028f44..8c6def1cdf16fbec73abb61a0ef90b40eeb1f70c 100644 --- a/cv/classification/seresnext/pytorch/seresnext.py +++ b/cv/classification/seresnext/pytorch/seresnext.py @@ -1,17 +1,3 @@ -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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 torch from functools import partial from torchvision.models.resnet import _resnet diff --git a/cv/detection/fasterrcnn/pytorch/dataloaders/transforms_det.py b/cv/detection/fasterrcnn/pytorch/dataloaders/transforms_det.py index 3df4d47f01d2b150169bfbe91962d6f776234aa3..405e760c03caeceea8ef79a464d86062bd5d2547 100644 --- a/cv/detection/fasterrcnn/pytorch/dataloaders/transforms_det.py +++ b/cv/detection/fasterrcnn/pytorch/dataloaders/transforms_det.py @@ -1,5 +1,4 @@ -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. diff --git a/cv/detection/fasterrcnn/pytorch/start_scripts/get_num_devices.sh b/cv/detection/fasterrcnn/pytorch/start_scripts/get_num_devices.sh index 5fac573bb81dfef560bb70f9e435793f68fe3662..f0701ce8d17681ecadea8cdd5d61b7da90e02ca2 100644 --- a/cv/detection/fasterrcnn/pytorch/start_scripts/get_num_devices.sh +++ b/cv/detection/fasterrcnn/pytorch/start_scripts/get_num_devices.sh @@ -1,18 +1,5 @@ #!/bin/bash -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. + devices=$CUDA_VISIBLE_DEVICES if [ -n "$devices" ]; then _devices=(${devices//,/ }) diff --git a/cv/detection/fasterrcnn/pytorch/start_scripts/init_torch.sh b/cv/detection/fasterrcnn/pytorch/start_scripts/init_torch.sh index 686347477b87db265a9e27dd4c6fbb6c795d2407..1c2d7f9ec04bb3689781beec8907077cb194ee3f 100644 --- a/cv/detection/fasterrcnn/pytorch/start_scripts/init_torch.sh +++ b/cv/detection/fasterrcnn/pytorch/start_scripts/init_torch.sh @@ -1,16 +1,3 @@ #!/bin/bash -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. + pip3 install pycocotools \ No newline at end of file diff --git a/cv/detection/fasterrcnn/pytorch/start_scripts/train_fasterrcnn_resnet50_amp_dist_torch.sh b/cv/detection/fasterrcnn/pytorch/start_scripts/train_fasterrcnn_resnet50_amp_dist_torch.sh index 00566f8257fef7ad92b92688196210e2f8143c4d..72400ed0b4e717dd3810bab1a1bedeb9d27db06b 100644 --- a/cv/detection/fasterrcnn/pytorch/start_scripts/train_fasterrcnn_resnet50_amp_dist_torch.sh +++ b/cv/detection/fasterrcnn/pytorch/start_scripts/train_fasterrcnn_resnet50_amp_dist_torch.sh @@ -1,18 +1,3 @@ -#!/bin/bash -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. source get_num_devices.sh export DRT_MEMCPYUSEKERNEL=20000000000 diff --git a/cv/detection/fasterrcnn/pytorch/start_scripts/train_fasterrcnn_resnet50_amp_torch.sh b/cv/detection/fasterrcnn/pytorch/start_scripts/train_fasterrcnn_resnet50_amp_torch.sh index 93790ccead888588379f449960d3530c1bdeb194..cff0d78d6346b848fc6bc81b12a212e6ce4f1eb0 100644 --- a/cv/detection/fasterrcnn/pytorch/start_scripts/train_fasterrcnn_resnet50_amp_torch.sh +++ b/cv/detection/fasterrcnn/pytorch/start_scripts/train_fasterrcnn_resnet50_amp_torch.sh @@ -1,18 +1,3 @@ -#!/bin/bash -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. export PYTORCH_DISABLE_VEC_KERNEL=1 export PT_USE_CUDNN_BATCHNORM_SPATIAL_PERSISTENT=1 CUDA_VISIBLE_DEVICES=0 python3 ../train.py \ diff --git a/cv/detection/fasterrcnn/pytorch/start_scripts/train_fasterrcnn_resnet50_dist_torch.sh b/cv/detection/fasterrcnn/pytorch/start_scripts/train_fasterrcnn_resnet50_dist_torch.sh index 2d26c3cc1acf5104c0411a8f8f1ea3694d5988c3..395bc09c4787ccb7c6a82886aea814a9e4f9e6bf 100644 --- a/cv/detection/fasterrcnn/pytorch/start_scripts/train_fasterrcnn_resnet50_dist_torch.sh +++ b/cv/detection/fasterrcnn/pytorch/start_scripts/train_fasterrcnn_resnet50_dist_torch.sh @@ -1,18 +1,3 @@ -#!/bin/bash -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. source get_num_devices.sh export DRT_MEMCPYUSEKERNEL=20000000000 diff --git a/cv/detection/fasterrcnn/pytorch/start_scripts/train_fasterrcnn_resnet50_torch.sh b/cv/detection/fasterrcnn/pytorch/start_scripts/train_fasterrcnn_resnet50_torch.sh index 37405b9db72ae99d608cc69731c3cbf6aad8333a..37b813b2f33ba6be9e402ca6bda21a64304a8006 100644 --- a/cv/detection/fasterrcnn/pytorch/start_scripts/train_fasterrcnn_resnet50_torch.sh +++ b/cv/detection/fasterrcnn/pytorch/start_scripts/train_fasterrcnn_resnet50_torch.sh @@ -1,18 +1,3 @@ -#!/bin/bash -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. CUDA_VISIBLE_DEVICES=0 python3 ../train.py \ --data-path /home/datasets/cv/VOC2012_sample \ diff --git a/cv/detection/fasterrcnn/pytorch/train.py b/cv/detection/fasterrcnn/pytorch/train.py index ff4e9981361eb37dffa13dd30160418f5d0d0e63..0370396b7707fc175578368d7274d0686759903e 100644 --- a/cv/detection/fasterrcnn/pytorch/train.py +++ b/cv/detection/fasterrcnn/pytorch/train.py @@ -1,5 +1,4 @@ -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. r"""PyTorch Detection Training. diff --git a/cv/detection/fasterrcnn/pytorch/utils/dist.py b/cv/detection/fasterrcnn/pytorch/utils/dist.py index dcd2330d1cde69dcad2a4c1ff843d63daf43cba6..e23dc5146d0509688adba9f983ebb87cd79b4bbb 100644 --- a/cv/detection/fasterrcnn/pytorch/utils/dist.py +++ b/cv/detection/fasterrcnn/pytorch/utils/dist.py @@ -1,5 +1,4 @@ -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. diff --git a/cv/detection/fasterrcnn/pytorch/utils/smooth_value.py b/cv/detection/fasterrcnn/pytorch/utils/smooth_value.py index bfe9279f499b0c969e2607140c343957bde1b377..4014b96e49fa4774b8b896dd06bd50a2163edef6 100644 --- a/cv/detection/fasterrcnn/pytorch/utils/smooth_value.py +++ b/cv/detection/fasterrcnn/pytorch/utils/smooth_value.py @@ -1,5 +1,4 @@ -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. @@ -74,4 +73,4 @@ class SmoothedValue(object): avg=self.avg, global_avg=self.global_avg, max=self.max, - value=self.value) + value=self.value) \ No newline at end of file diff --git a/cv/detection/retinanet/pytorch/common_utils/dist.py b/cv/detection/retinanet/pytorch/common_utils/dist.py index 6b6fe4154a72a5058941063c1de74824fffdc1de..ea56ca267755706ab1a62e9d5e93c71b6245c639 100644 --- a/cv/detection/retinanet/pytorch/common_utils/dist.py +++ b/cv/detection/retinanet/pytorch/common_utils/dist.py @@ -1,6 +1,6 @@ +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. + from collections import defaultdict, deque import datetime diff --git a/cv/detection/retinanet/pytorch/common_utils/metric_logger.py b/cv/detection/retinanet/pytorch/common_utils/metric_logger.py index 2c70e32fc8833e435b34184e15cbf2475f06f4fe..960641c4da4a8c94aa418c44a22ef5ded8908392 100644 --- a/cv/detection/retinanet/pytorch/common_utils/metric_logger.py +++ b/cv/detection/retinanet/pytorch/common_utils/metric_logger.py @@ -1,6 +1,6 @@ +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. + from collections import defaultdict import datetime diff --git a/cv/detection/retinanet/pytorch/common_utils/smooth_value.py b/cv/detection/retinanet/pytorch/common_utils/smooth_value.py index 32c7e6337564b05051ab14570e7ce0b494b57a90..30cb89d6001999bcad91ba784cc8f871080a1ff8 100644 --- a/cv/detection/retinanet/pytorch/common_utils/smooth_value.py +++ b/cv/detection/retinanet/pytorch/common_utils/smooth_value.py @@ -1,6 +1,6 @@ +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. + from collections import defaultdict, deque import datetime diff --git a/cv/detection/retinanet/pytorch/dataloader/detection.py b/cv/detection/retinanet/pytorch/dataloader/detection.py index 7558f5da4c8441a7ef34db3a67b804566c3589a1..ecd66e196ff4b3b1ac45615c8882192a25c1e050 100644 --- a/cv/detection/retinanet/pytorch/dataloader/detection.py +++ b/cv/detection/retinanet/pytorch/dataloader/detection.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright Declaration: This software, including all of its code and documentation, # except for the third-party software it contains, is a copyrighted work of Shanghai Iluvatar CoreX # Semiconductor Co., Ltd. and its affiliates ("Iluvatar CoreX") in accordance with the PRC Copyright diff --git a/cv/detection/retinanet/pytorch/dataloader/utils/coco_utils.py b/cv/detection/retinanet/pytorch/dataloader/utils/coco_utils.py index 4cc0b0f2ba41fcc10778321fffb89d40cd346917..cef31f4a84c98727a0699ac724afd6609b5e2bad 100644 --- a/cv/detection/retinanet/pytorch/dataloader/utils/coco_utils.py +++ b/cv/detection/retinanet/pytorch/dataloader/utils/coco_utils.py @@ -1,6 +1,6 @@ +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. + import copy import os diff --git a/cv/detection/retinanet/pytorch/dataloader/utils/pascal_voc.py b/cv/detection/retinanet/pytorch/dataloader/utils/pascal_voc.py index d8c46a4c2ce1c30cc30953a0cb86dcf71c4377e9..d6094254145ae7f5c7dab80b494f39d71a6de9ed 100644 --- a/cv/detection/retinanet/pytorch/dataloader/utils/pascal_voc.py +++ b/cv/detection/retinanet/pytorch/dataloader/utils/pascal_voc.py @@ -1,6 +1,6 @@ +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. + from collections import OrderedDict import cv2 diff --git a/cv/detection/retinanet/pytorch/dataloader/utils/presets_detection.py b/cv/detection/retinanet/pytorch/dataloader/utils/presets_detection.py index 5263e1bb491a18238a90c413701d7b92f5f5522d..75946f0788cd0bbae50761134611cd3a2acf0e12 100644 --- a/cv/detection/retinanet/pytorch/dataloader/utils/presets_detection.py +++ b/cv/detection/retinanet/pytorch/dataloader/utils/presets_detection.py @@ -1,6 +1,6 @@ +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. + from . import transforms_det as T diff --git a/cv/detection/retinanet/pytorch/dataloader/utils/presets_segmentation.py b/cv/detection/retinanet/pytorch/dataloader/utils/presets_segmentation.py index b123f231465bddcba6bc854ea1b70246a3364ac4..45e0d029b5998e27ffae96f60173a59d94cbdc74 100644 --- a/cv/detection/retinanet/pytorch/dataloader/utils/presets_segmentation.py +++ b/cv/detection/retinanet/pytorch/dataloader/utils/presets_segmentation.py @@ -1,6 +1,6 @@ +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. + from . import transforms_seg as T diff --git a/cv/detection/retinanet/pytorch/dataloader/utils/transforms_det.py b/cv/detection/retinanet/pytorch/dataloader/utils/transforms_det.py index 3df4d47f01d2b150169bfbe91962d6f776234aa3..405e760c03caeceea8ef79a464d86062bd5d2547 100644 --- a/cv/detection/retinanet/pytorch/dataloader/utils/transforms_det.py +++ b/cv/detection/retinanet/pytorch/dataloader/utils/transforms_det.py @@ -1,5 +1,4 @@ -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. diff --git a/cv/detection/retinanet/pytorch/engine.py b/cv/detection/retinanet/pytorch/engine.py index 0e64fb571bd3133596f0048daebc301de903f8cf..9afb3bdad9b698faa67b7aab590651d52a246bed 100644 --- a/cv/detection/retinanet/pytorch/engine.py +++ b/cv/detection/retinanet/pytorch/engine.py @@ -1,6 +1,5 @@ +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. import math import sys diff --git a/cv/detection/retinanet/pytorch/train.py b/cv/detection/retinanet/pytorch/train.py index 92ebe8fb9c9cc7b7aa099dbf8dd272a61cf0b59d..59e8c73ae6d946a02c22417ff6457f5ac9fe9ed8 100644 --- a/cv/detection/retinanet/pytorch/train.py +++ b/cv/detection/retinanet/pytorch/train.py @@ -1,5 +1,4 @@ -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. r"""PyTorch Detection Training. diff --git a/cv/ocr/dbnet/pytorch/configs/_base_/det_datasets/icdar2015.py b/cv/ocr/dbnet/pytorch/configs/_base_/det_datasets/icdar2015.py index 6e14ae22270be238a43db707c817f15a67e1efd7..bcbabfb00fd6e97668f449f35f520d0e03b0333e 100755 --- a/cv/ocr/dbnet/pytorch/configs/_base_/det_datasets/icdar2015.py +++ b/cv/ocr/dbnet/pytorch/configs/_base_/det_datasets/icdar2015.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. dataset_type = 'IcdarDataset' data_root = 'OCR_Detect' diff --git a/cv/ocr/dbnet/pytorch/configs/_base_/det_models/dbnet_r18_fpnc.py b/cv/ocr/dbnet/pytorch/configs/_base_/det_models/dbnet_r18_fpnc.py index 4d9fa24e17c477a9b4d79726d50094def033d872..98f0896d00243f5c4d7a9d5930509438092e322e 100755 --- a/cv/ocr/dbnet/pytorch/configs/_base_/det_models/dbnet_r18_fpnc.py +++ b/cv/ocr/dbnet/pytorch/configs/_base_/det_models/dbnet_r18_fpnc.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. model = dict( type='DBNet', backbone=dict( diff --git a/cv/ocr/dbnet/pytorch/configs/_base_/det_pipelines/dbnet_pipeline.py b/cv/ocr/dbnet/pytorch/configs/_base_/det_pipelines/dbnet_pipeline.py index cd0433641cb2bee4a1e2563158ee4259182991d7..40eee02db3b68d5682841532d1122c92bdca2a65 100755 --- a/cv/ocr/dbnet/pytorch/configs/_base_/det_pipelines/dbnet_pipeline.py +++ b/cv/ocr/dbnet/pytorch/configs/_base_/det_pipelines/dbnet_pipeline.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) diff --git a/cv/ocr/dbnet/pytorch/configs/textdet/dbnet/dbnet_r18_fpnc_1200e_icdar2015.py b/cv/ocr/dbnet/pytorch/configs/textdet/dbnet/dbnet_r18_fpnc_1200e_icdar2015.py index 40ca14bc321aaae495dcf72056b11303f52ec8b8..467903fef4604dedfd1efbeaa011de0a32dcea74 100755 --- a/cv/ocr/dbnet/pytorch/configs/textdet/dbnet/dbnet_r18_fpnc_1200e_icdar2015.py +++ b/cv/ocr/dbnet/pytorch/configs/textdet/dbnet/dbnet_r18_fpnc_1200e_icdar2015.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. _base_ = [ '../../_base_/default_runtime.py', '../../_base_/schedules/schedule_sgd_1200e.py', diff --git a/cv/ocr/dbnet/pytorch/configs/textdet/dbnet/dbnet_r50dcnv2_fpnc_1200e_icdar2015.py b/cv/ocr/dbnet/pytorch/configs/textdet/dbnet/dbnet_r50dcnv2_fpnc_1200e_icdar2015.py index a7eee5a97733a22c056e6cc10226af27952a55ea..6089f1e593dba9b5abab8726bb5a318116a85e6d 100755 --- a/cv/ocr/dbnet/pytorch/configs/textdet/dbnet/dbnet_r50dcnv2_fpnc_1200e_icdar2015.py +++ b/cv/ocr/dbnet/pytorch/configs/textdet/dbnet/dbnet_r50dcnv2_fpnc_1200e_icdar2015.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. _base_ = [ '../../_base_/default_runtime.py', '../../_base_/schedules/schedule_sgd_1200e.py', diff --git a/cv/ocr/dbnet/pytorch/dbnet/__init__.py b/cv/ocr/dbnet/pytorch/dbnet/__init__.py index ed46a6711329441b0621d165970667bcfb52e673..c8dd3959738d822fac322818f026be82dd8c5b4d 100755 --- a/cv/ocr/dbnet/pytorch/dbnet/__init__.py +++ b/cv/ocr/dbnet/pytorch/dbnet/__init__.py @@ -56,15 +56,15 @@ assert (dbnet_cv_version >= digit_version(dbnet_cv_minimum_version) f'Please use DBNET_CV >= {dbnet_cv_minimum_version}, ' \ f'<= {dbnet_cv_maximum_version} instead.' -# dbnet_det_minimum_version = '2.21.0' -# dbnet_det_maximum_version = '3.0.0' -# dbnet_det_version = digit_version(dbnet_det.__version__) +# mmdet_minimum_version = '2.21.0' +# mmdet_maximum_version = '3.0.0' +# mmdet_version = digit_version(mmdet.__version__) -# assert (dbnet_det_version >= digit_version(dbnet_det_minimum_version) -# and dbnet_det_version <= digit_version(dbnet_det_maximum_version)), \ -# f'dbnet_detection {dbnet_det.__version__} is incompatible ' \ +# assert (mmdet_version >= digit_version(mmdet_minimum_version) +# and mmdet_version <= digit_version(mmdet_maximum_version)), \ +# f'MMDetection {mmdet.__version__} is incompatible ' \ # f'with MMOCR {__version__}. ' \ -# f'Please use dbnet_detection >= {dbnet_det_minimum_version}, ' \ -# f'<= {dbnet_det_maximum_version} instead.' +# f'Please use MMDetection >= {mmdet_minimum_version}, ' \ +# f'<= {mmdet_maximum_version} instead.' __all__ = ['__version__', 'short_version', 'digit_version'] diff --git a/cv/ocr/dbnet/pytorch/dbnet/apis/train.py b/cv/ocr/dbnet/pytorch/dbnet/apis/train.py index 6532a5320f16ba12377a81e11996e1c6ca3c96f0..f079e6f82d3cbc7186b97c7f29889bd302322544 100755 --- a/cv/ocr/dbnet/pytorch/dbnet/apis/train.py +++ b/cv/ocr/dbnet/pytorch/dbnet/apis/train.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. # Copyright (c) OpenMMLab. All rights reserved. import warnings diff --git a/cv/ocr/dbnet/pytorch/dbnet/datasets/icdar_dataset.py b/cv/ocr/dbnet/pytorch/dbnet/datasets/icdar_dataset.py index 5881a2c9192eac960b4a19314017a6cce95768ca..fb1717837b8cee42ccd607e7944126cb870d9a11 100755 --- a/cv/ocr/dbnet/pytorch/dbnet/datasets/icdar_dataset.py +++ b/cv/ocr/dbnet/pytorch/dbnet/datasets/icdar_dataset.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. # Copyright (c) OpenMMLab. All rights reserved. import dbnet_cv import numpy as np diff --git a/cv/ocr/dbnet/pytorch/dbnet/datasets/pipelines/transforms.py b/cv/ocr/dbnet/pytorch/dbnet/datasets/pipelines/transforms.py index fd2dd62836747efd0c85f6495ce8d3dd7bd7bb18..83003385c06378d2c925e426e969703d4aa1f7d4 100755 --- a/cv/ocr/dbnet/pytorch/dbnet/datasets/pipelines/transforms.py +++ b/cv/ocr/dbnet/pytorch/dbnet/datasets/pipelines/transforms.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. # Copyright (c) OpenMMLab. All rights reserved. import math diff --git a/cv/ocr/dbnet/pytorch/dbnet/models/builder.py b/cv/ocr/dbnet/pytorch/dbnet/models/builder.py index b2e3cdc65d3f889707c199d2294f36779fda581b..581e7dffaeca08127b9cfb3f246af84549c8eb0a 100755 --- a/cv/ocr/dbnet/pytorch/dbnet/models/builder.py +++ b/cv/ocr/dbnet/pytorch/dbnet/models/builder.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. # Copyright (c) OpenMMLab. All rights reserved. import warnings diff --git a/cv/ocr/dbnet/pytorch/dbnet/models/common/detectors/single_stage.py b/cv/ocr/dbnet/pytorch/dbnet/models/common/detectors/single_stage.py index 8408ead5c3e16881242d85e30f2068f77d75d2c6..9c280f12c197133079c0d4b8aa560f3b5764e5fb 100755 --- a/cv/ocr/dbnet/pytorch/dbnet/models/common/detectors/single_stage.py +++ b/cv/ocr/dbnet/pytorch/dbnet/models/common/detectors/single_stage.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. # Copyright (c) OpenMMLab. All rights reserved. import warnings diff --git a/cv/ocr/dbnet/pytorch/dbnet/models/textdet/dense_heads/db_head.py b/cv/ocr/dbnet/pytorch/dbnet/models/textdet/dense_heads/db_head.py index dc6a6899506e31c32228c9343ee49059a33201c6..a9f7175fc3933919f3701f415ac580182015f1c7 100755 --- a/cv/ocr/dbnet/pytorch/dbnet/models/textdet/dense_heads/db_head.py +++ b/cv/ocr/dbnet/pytorch/dbnet/models/textdet/dense_heads/db_head.py @@ -85,7 +85,6 @@ class DBHead(HeadMixin, BaseModule): def _init_thr(self, inner_channels, bias=False): in_channels = inner_channels - seq = Sequential( nn.Conv2d( in_channels, inner_channels // 4, 3, padding=1, bias=bias), diff --git a/cv/ocr/dbnet/pytorch/dbnet/models/textdet/detectors/single_stage_text_detector.py b/cv/ocr/dbnet/pytorch/dbnet/models/textdet/detectors/single_stage_text_detector.py index d42abfa5cf8db73fe937bb8d038bebb67d2de89d..e0248902f013e020f49f8cf4493a0c4357f8c730 100755 --- a/cv/ocr/dbnet/pytorch/dbnet/models/textdet/detectors/single_stage_text_detector.py +++ b/cv/ocr/dbnet/pytorch/dbnet/models/textdet/detectors/single_stage_text_detector.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. # Copyright (c) OpenMMLab. All rights reserved. import torch diff --git a/cv/ocr/dbnet/pytorch/dbnet/models/textdet/losses/db_loss.py b/cv/ocr/dbnet/pytorch/dbnet/models/textdet/losses/db_loss.py index 4dc0a69e554028d90e12d24cb78516db8c29a255..531ca77558b5a55aea92a54d1f8628a16b9eb308 100755 --- a/cv/ocr/dbnet/pytorch/dbnet/models/textdet/losses/db_loss.py +++ b/cv/ocr/dbnet/pytorch/dbnet/models/textdet/losses/db_loss.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. # Copyright (c) OpenMMLab. All rights reserved. import torch import torch.nn.functional as F diff --git a/cv/ocr/dbnet/pytorch/dbnet_det/core/evaluation/bbox_overlaps.py b/cv/ocr/dbnet/pytorch/dbnet_det/core/evaluation/bbox_overlaps.py index 2d1102ac11ec624260e1ec325d5b0638d23a1ca4..5d6eb82fcfc8d5444dd2a13b7d95b978f8206a55 100755 --- a/cv/ocr/dbnet/pytorch/dbnet_det/core/evaluation/bbox_overlaps.py +++ b/cv/ocr/dbnet/pytorch/dbnet_det/core/evaluation/bbox_overlaps.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. # Copyright (c) OpenMMLab. All rights reserved. import numpy as np diff --git a/cv/ocr/dbnet/pytorch/dbnet_det/core/evaluation/eval_hooks.py b/cv/ocr/dbnet/pytorch/dbnet_det/core/evaluation/eval_hooks.py index 5cf56f999b7ae56a535f98454c74d6f14b0d51d6..c977c2b4809ddeeb8fbb9765f8f0de9610ee7fb0 100755 --- a/cv/ocr/dbnet/pytorch/dbnet_det/core/evaluation/eval_hooks.py +++ b/cv/ocr/dbnet/pytorch/dbnet_det/core/evaluation/eval_hooks.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. # Copyright (c) OpenMMLab. All rights reserved. import bisect import os.path as osp diff --git a/cv/ocr/dbnet/pytorch/dbnet_det/core/evaluation/mean_ap.py b/cv/ocr/dbnet/pytorch/dbnet_det/core/evaluation/mean_ap.py index 9b9c55a2ef3b115d0ce4e86e8b80f761d6f0ded3..0e70ebd21b38d2a5becceb49334395265dcfd0e5 100755 --- a/cv/ocr/dbnet/pytorch/dbnet_det/core/evaluation/mean_ap.py +++ b/cv/ocr/dbnet/pytorch/dbnet_det/core/evaluation/mean_ap.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. # Copyright (c) OpenMMLab. All rights reserved. from multiprocessing import Pool diff --git a/cv/ocr/dbnet/pytorch/dbnet_det/core/evaluation/recall.py b/cv/ocr/dbnet/pytorch/dbnet_det/core/evaluation/recall.py index 25b1ca1dc7717d54e97729cab084198daf33dd15..ba361f1992bb6202c4491dc73a9e014b47c741d1 100755 --- a/cv/ocr/dbnet/pytorch/dbnet_det/core/evaluation/recall.py +++ b/cv/ocr/dbnet/pytorch/dbnet_det/core/evaluation/recall.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. # Copyright (c) OpenMMLab. All rights reserved. from collections.abc import Sequence diff --git a/cv/ocr/dbnet/pytorch/dbnet_det/datasets/pipelines/loading.py b/cv/ocr/dbnet/pytorch/dbnet_det/datasets/pipelines/loading.py index 391b328498b7b03a0b03cffe8f308571d1bde076..1446bcfd30244ce188558612afaff810b8ff9d75 100755 --- a/cv/ocr/dbnet/pytorch/dbnet_det/datasets/pipelines/loading.py +++ b/cv/ocr/dbnet/pytorch/dbnet_det/datasets/pipelines/loading.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. # Copyright (c) OpenMMLab. All rights reserved. import os.path as osp diff --git a/cv/ocr/dbnet/pytorch/dbnet_det/datasets/samplers/class_aware_sampler.py b/cv/ocr/dbnet/pytorch/dbnet_det/datasets/samplers/class_aware_sampler.py index f6a17cdbf8df814d1833d048fe775f4b0232a384..28a8e9e6b15189bff43562fdc8fc2d89ac762649 100755 --- a/cv/ocr/dbnet/pytorch/dbnet_det/datasets/samplers/class_aware_sampler.py +++ b/cv/ocr/dbnet/pytorch/dbnet_det/datasets/samplers/class_aware_sampler.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. # Copyright (c) OpenMMLab. All rights reserved. import math diff --git a/cv/ocr/dbnet/pytorch/dbnet_det/models/__init__.py b/cv/ocr/dbnet/pytorch/dbnet_det/models/__init__.py index 65006afdcc573261c06d3f84a60e02f90564db49..1d9c3415a6dde15f49f6ed739179e2969a428c67 100755 --- a/cv/ocr/dbnet/pytorch/dbnet_det/models/__init__.py +++ b/cv/ocr/dbnet/pytorch/dbnet_det/models/__init__.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. # Copyright (c) OpenMMLab. All rights reserved. from .backbones import * # noqa: F401,F403 from .builder import (BACKBONES, DETECTORS, HEADS, LOSSES, NECKS, diff --git a/cv/ocr/dbnet/pytorch/dbnet_det/models/backbones/__init__.py b/cv/ocr/dbnet/pytorch/dbnet_det/models/backbones/__init__.py index 866f54e177d777eca2d29daf0e187fa7632c6e1d..9d0ec69d05a27f11b23858f5a14cde4cad70e8ce 100755 --- a/cv/ocr/dbnet/pytorch/dbnet_det/models/backbones/__init__.py +++ b/cv/ocr/dbnet/pytorch/dbnet_det/models/backbones/__init__.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. # Copyright (c) OpenMMLab. All rights reserved. # from .csp_darknet import CSPDarknet # from .darknet import Darknet diff --git a/cv/ocr/dbnet/pytorch/dbnet_det/models/detectors/base.py b/cv/ocr/dbnet/pytorch/dbnet_det/models/detectors/base.py index 35a02dbc74bfb224b505a7da55a152e188e76274..a5353df8c49712c46a1e5a0e94eb8f628e2cd88e 100755 --- a/cv/ocr/dbnet/pytorch/dbnet_det/models/detectors/base.py +++ b/cv/ocr/dbnet/pytorch/dbnet_det/models/detectors/base.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. # Copyright (c) OpenMMLab. All rights reserved. from abc import ABCMeta, abstractmethod from collections import OrderedDict diff --git a/cv/ocr/dbnet/pytorch/dbnet_det/models/detectors/single_stage.py b/cv/ocr/dbnet/pytorch/dbnet_det/models/detectors/single_stage.py index 1b6b2d391edd830e7a136057a2103ba622f43ad4..ae3f1b29cce34c2b7aecf45a7d030dde4a761bb8 100755 --- a/cv/ocr/dbnet/pytorch/dbnet_det/models/detectors/single_stage.py +++ b/cv/ocr/dbnet/pytorch/dbnet_det/models/detectors/single_stage.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. # Copyright (c) OpenMMLab. All rights reserved. import warnings diff --git a/cv/ocr/dbnet/pytorch/dbnet_det/models/utils/__init__.py b/cv/ocr/dbnet/pytorch/dbnet_det/models/utils/__init__.py index 848e7eabc3bcaddc73949814cf61c61a07ed98d0..2682bb0c9ac3ba60893f3799816f8d5a663faf95 100755 --- a/cv/ocr/dbnet/pytorch/dbnet_det/models/utils/__init__.py +++ b/cv/ocr/dbnet/pytorch/dbnet_det/models/utils/__init__.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. # Copyright (c) OpenMMLab. All rights reserved. # from .brick_wrappers import AdaptiveAvgPool2d, adaptive_avg_pool2d # from .builder import build_linear_layer, build_transformer diff --git a/cv/ocr/dbnet/pytorch/dbnet_det/utils/__init__.py b/cv/ocr/dbnet/pytorch/dbnet_det/utils/__init__.py index d0c3a821dcc56ff823910dbbf982f0ed4882253f..17e93409ef40298152d1f661102e301cd98c3a48 100755 --- a/cv/ocr/dbnet/pytorch/dbnet_det/utils/__init__.py +++ b/cv/ocr/dbnet/pytorch/dbnet_det/utils/__init__.py @@ -9,7 +9,6 @@ from .logger import get_caller_name, get_root_logger, log_img_scale # from .split_batch import split_batch from .util_distribution import build_ddp, build_dp, get_device - # __all__ = [ # 'get_root_logger', 'collect_env', 'find_latest_checkpoint', # 'update_data_root', 'setup_multi_processes', 'get_caller_name', diff --git a/cv/ocr/dbnet/pytorch/dbnet_det/utils/logger.py b/cv/ocr/dbnet/pytorch/dbnet_det/utils/logger.py index d9736e7003d26c9114c7ee1feb2336bba92bb06d..2de27f607c468b2b7347dc523512116a4d0e5da1 100755 --- a/cv/ocr/dbnet/pytorch/dbnet_det/utils/logger.py +++ b/cv/ocr/dbnet/pytorch/dbnet_det/utils/logger.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. # Copyright (c) OpenMMLab. All rights reserved. import inspect import logging diff --git a/cv/ocr/dbnet/pytorch/tools/analyze_logs.py b/cv/ocr/dbnet/pytorch/tools/analyze_logs.py index 5ad1b7645ced1defc48730d7347aaad6de4efcae..c0714c50898b8feb84f077a48abceb38e8eecbe2 100755 --- a/cv/ocr/dbnet/pytorch/tools/analyze_logs.py +++ b/cv/ocr/dbnet/pytorch/tools/analyze_logs.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. # Copyright (c) OpenMMLab. All rights reserved. """Modified from https://github.com/open- mmlab/mmdetection/blob/master/tools/analysis_tools/analyze_logs.py.""" diff --git a/cv/ocr/satrn/pytorch/base/apis/__init__.py b/cv/ocr/satrn/pytorch/base/apis/__init__.py index 6708a6fd3145d12471cd50b52f976446cbd3eb97..776a08dd8614c8f94fcf6b891693c9c881d090a9 100755 --- a/cv/ocr/satrn/pytorch/base/apis/__init__.py +++ b/cv/ocr/satrn/pytorch/base/apis/__init__.py @@ -1,7 +1,4 @@ # Copyright (c) OpenMMLab. All rights reserved. -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. - from .train import init_random_seed, train_detector from .utils import (disable_text_recog_aug_test, replace_image_to_tensor, tensor2grayimgs) diff --git a/cv/ocr/satrn/pytorch/base/basic_utils/__init__.py b/cv/ocr/satrn/pytorch/base/basic_utils/__init__.py index b5264a747d2d03459a1d3af2a3bb2612d6e10f5d..489d60df6ec58a5c6285cbc1ff2f7cbe620eef49 100755 --- a/cv/ocr/satrn/pytorch/base/basic_utils/__init__.py +++ b/cv/ocr/satrn/pytorch/base/basic_utils/__init__.py @@ -21,5 +21,5 @@ __all__ = [ 'equal_len', 'is_2dlist', 'valid_boundary', 'lmdb_converter', 'drop_orientation', 'convert_annotations', 'is_not_png', 'list_to_file', 'list_from_file', 'is_on_same_line', 'stitch_boxes_into_lines', - 'StringStrip', 'revert_sync_batchnorm' + 'StringStrip', 'revert_sync_batchnorm' ] diff --git a/cv/ocr/satrn/pytorch/base/basic_utils/lmdb_util.py b/cv/ocr/satrn/pytorch/base/basic_utils/lmdb_util.py index 21215eaf834d7e1ed9e1bd26e030323a93d8832b..d62902061e439124679c0b0a85c52a429cdf07e7 100755 --- a/cv/ocr/satrn/pytorch/base/basic_utils/lmdb_util.py +++ b/cv/ocr/satrn/pytorch/base/basic_utils/lmdb_util.py @@ -46,7 +46,3 @@ def lmdb_converter(img_list_file, output, batch_size=1000, coding='utf-8'): value = str(len(lines)).encode(coding) txn.put(key, value) print('done', flush=True) - - - - diff --git a/cv/ocr/satrn/pytorch/base/csrc/build.sh b/cv/ocr/satrn/pytorch/base/csrc/build.sh index cb72716d21a7a12b477cb50f5a142eabc1af19ae..f891e76cbb58669d811d074d6830c3b2a442199e 100755 --- a/cv/ocr/satrn/pytorch/base/csrc/build.sh +++ b/cv/ocr/satrn/pytorch/base/csrc/build.sh @@ -1,18 +1,4 @@ #!/bin/bash -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. MAX_JOBS=${MAX_JOBS:-$(nproc --all)} PYTHON_PATH=$(which python3) diff --git a/cv/ocr/satrn/pytorch/base/csrc/clean.sh b/cv/ocr/satrn/pytorch/base/csrc/clean.sh index 5d2ddf3e698c425a3d3f8162db824ba8a6979857..2b2cd07bbf714a1783845d9b27f0e9eec6138676 100755 --- a/cv/ocr/satrn/pytorch/base/csrc/clean.sh +++ b/cv/ocr/satrn/pytorch/base/csrc/clean.sh @@ -1,17 +1,3 @@ -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. #!/bin/bash PYTHON_PATH=$(which pip3) diff --git a/cv/ocr/satrn/pytorch/base/csrc/install.sh b/cv/ocr/satrn/pytorch/base/csrc/install.sh index c0ddeb3f0ee983bfa4a96cc59dc99c07e80c8177..017388ad9d46c19b67e4e60936f9f8ed42edf0df 100755 --- a/cv/ocr/satrn/pytorch/base/csrc/install.sh +++ b/cv/ocr/satrn/pytorch/base/csrc/install.sh @@ -1,17 +1,3 @@ -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. #!/bin/bash TARGET_DIR=${TARGET_DIR:-} diff --git a/cv/ocr/satrn/pytorch/base/csrc/satrn/__init__.py b/cv/ocr/satrn/pytorch/base/csrc/satrn/__init__.py index dbce4e59b7307446cb079512c1169570acf7a4d9..16281fe0b66dbac563229823d656ef173736e306 100755 --- a/cv/ocr/satrn/pytorch/base/csrc/satrn/__init__.py +++ b/cv/ocr/satrn/pytorch/base/csrc/satrn/__init__.py @@ -1,15 +1 @@ -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. from .utils import * diff --git a/cv/ocr/satrn/pytorch/base/ocrcv/__init__.py b/cv/ocr/satrn/pytorch/base/ocrcv/__init__.py index 01fa080e4a2cafeca9da8aebe4d8c09c4ce9e90c..461b113b0f23e16cf7d2e1e2de43e9ab7de79c57 100755 --- a/cv/ocr/satrn/pytorch/base/ocrcv/__init__.py +++ b/cv/ocr/satrn/pytorch/base/ocrcv/__init__.py @@ -1,7 +1,4 @@ # Copyright (c) Open-MMLab. All rights reserved. -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. - from .fileio import * from .image import * from .utils import * diff --git a/cv/ocr/satrn/pytorch/base/ocrcv/runner/epoch_based_runner.py b/cv/ocr/satrn/pytorch/base/ocrcv/runner/epoch_based_runner.py index 71458c840b940fb3a7496b18dabeb6ae8355f61d..5cb5cebc784da8723135329fcbf91c7e705298f2 100755 --- a/cv/ocr/satrn/pytorch/base/ocrcv/runner/epoch_based_runner.py +++ b/cv/ocr/satrn/pytorch/base/ocrcv/runner/epoch_based_runner.py @@ -1,5 +1,3 @@ -# Copyright (c) 2023-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. # Copyright (c) Open-MMLab. All rights reserved. import os.path as osp import platform diff --git a/cv/semantic_segmentation/unet3d/pytorch/common_utils/dist.py b/cv/semantic_segmentation/unet3d/pytorch/common_utils/dist.py index ce1f87807a72f661763ccbe0dd59c8a0fdcb8858..1d5cb4b162c8828fcb14285d67af4837b3e7a34a 100644 --- a/cv/semantic_segmentation/unet3d/pytorch/common_utils/dist.py +++ b/cv/semantic_segmentation/unet3d/pytorch/common_utils/dist.py @@ -1,6 +1,6 @@ +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. + from collections import defaultdict, deque import datetime diff --git a/cv/semantic_segmentation/unet3d/pytorch/common_utils/metric_logger.py b/cv/semantic_segmentation/unet3d/pytorch/common_utils/metric_logger.py index 2c70e32fc8833e435b34184e15cbf2475f06f4fe..960641c4da4a8c94aa418c44a22ef5ded8908392 100644 --- a/cv/semantic_segmentation/unet3d/pytorch/common_utils/metric_logger.py +++ b/cv/semantic_segmentation/unet3d/pytorch/common_utils/metric_logger.py @@ -1,6 +1,6 @@ +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. + from collections import defaultdict import datetime diff --git a/cv/semantic_segmentation/unet3d/pytorch/common_utils/smooth_value.py b/cv/semantic_segmentation/unet3d/pytorch/common_utils/smooth_value.py index 32c7e6337564b05051ab14570e7ce0b494b57a90..30cb89d6001999bcad91ba784cc8f871080a1ff8 100644 --- a/cv/semantic_segmentation/unet3d/pytorch/common_utils/smooth_value.py +++ b/cv/semantic_segmentation/unet3d/pytorch/common_utils/smooth_value.py @@ -1,6 +1,6 @@ +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. + from collections import defaultdict, deque import datetime diff --git a/cv/semantic_segmentation/unet3d/pytorch/prepare.sh b/cv/semantic_segmentation/unet3d/pytorch/prepare.sh index 10d1829c07ba07482ec1c95dea4af80e297612d5..f7e5389e4a3680f4ae404369880bfcd225980f16 100644 --- a/cv/semantic_segmentation/unet3d/pytorch/prepare.sh +++ b/cv/semantic_segmentation/unet3d/pytorch/prepare.sh @@ -1,18 +1,4 @@ #!/bin/bash -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. apt update -y apt install -y numactl git wget diff --git a/cv/tracking/fairmot/pytorch/src/lib/logger.py b/cv/tracking/fairmot/pytorch/src/lib/logger.py index 628d3fff0b6e7e0304343cd2289e9c943e9baf8c..b74f2e565b8110f0ba08dcfac232263c2dd711f9 100644 --- a/cv/tracking/fairmot/pytorch/src/lib/logger.py +++ b/cv/tracking/fairmot/pytorch/src/lib/logger.py @@ -1,17 +1,3 @@ -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. from __future__ import absolute_import from __future__ import division from __future__ import print_function diff --git a/cv/tracking/fairmot/pytorch/src/lib/opts.py b/cv/tracking/fairmot/pytorch/src/lib/opts.py index 78280575bc3ab68456e0a063bd904d3d0c536a52..2110427170d1b1eccb6332debe95a16ecacc1ccc 100644 --- a/cv/tracking/fairmot/pytorch/src/lib/opts.py +++ b/cv/tracking/fairmot/pytorch/src/lib/opts.py @@ -1,17 +1,3 @@ -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. # Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) ifzhang. All Rights Reserved. diff --git a/cv/tracking/fairmot/pytorch/src/lib/trains/base_trainer.py b/cv/tracking/fairmot/pytorch/src/lib/trains/base_trainer.py index e8ec9d38542d1cccf0baa5959622c8078aafec6a..cae8d41b0808e8b5968585be03fa9c645400c055 100644 --- a/cv/tracking/fairmot/pytorch/src/lib/trains/base_trainer.py +++ b/cv/tracking/fairmot/pytorch/src/lib/trains/base_trainer.py @@ -1,17 +1,3 @@ -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. from __future__ import absolute_import from __future__ import division from __future__ import print_function diff --git a/cv/tracking/fairmot/pytorch/src/track.py b/cv/tracking/fairmot/pytorch/src/track.py index 03b7e71ad143b0ad299ed1286ea1c39f4e4cca4a..a6f50c86a5a9616c1c20785dad52ccf045f8f1d7 100644 --- a/cv/tracking/fairmot/pytorch/src/track.py +++ b/cv/tracking/fairmot/pytorch/src/track.py @@ -1,5 +1,3 @@ -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. from __future__ import absolute_import from __future__ import division from __future__ import print_function diff --git a/cv/tracking/fairmot/pytorch/src/train.py b/cv/tracking/fairmot/pytorch/src/train.py index ac2876ec3781bb2c48268a55823de12f92c93d25..86549f9367b76f0119bd16f7cd1126b435af80f2 100644 --- a/cv/tracking/fairmot/pytorch/src/train.py +++ b/cv/tracking/fairmot/pytorch/src/train.py @@ -1,17 +1,3 @@ -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. # Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) ifzhang. All Rights Reserved. diff --git a/cv/tracking/fairmot/pytorch/train_dla34_mot17.sh b/cv/tracking/fairmot/pytorch/train_dla34_mot17.sh index e26dcf5c1c1fd81fe91f2befe22d67fda2211e08..c4f644e90bade2b284af8bb4e1bea52312a1bcac 100644 --- a/cv/tracking/fairmot/pytorch/train_dla34_mot17.sh +++ b/cv/tracking/fairmot/pytorch/train_dla34_mot17.sh @@ -1,18 +1,4 @@ -#!/bin/bash -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. +#!/usr/bin/env bash python3 src/train.py mot --exp_id mot17_dla34 --data_cfg './src/lib/cfg/mot17.json' "$@" exit $? diff --git a/cv/tracking/fairmot/pytorch/train_hrnet18_mot17.sh b/cv/tracking/fairmot/pytorch/train_hrnet18_mot17.sh index 73925f21bc1dd758b91148bfd47ea17291bfd9e8..7db4338b4ca6c7887df6712d7dbb660a93b21ef7 100644 --- a/cv/tracking/fairmot/pytorch/train_hrnet18_mot17.sh +++ b/cv/tracking/fairmot/pytorch/train_hrnet18_mot17.sh @@ -1,18 +1,4 @@ -#!/bin/bash -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. +#!/usr/bin/env bash python3 ./src/train.py mot --exp_id mot17_hrnet18 --arch 'hrnet_18' \ --data_cfg './src/lib/cfg/mot17.json' \ diff --git a/cv/tracking/fairmot/pytorch/train_hrnet32_mot17.sh b/cv/tracking/fairmot/pytorch/train_hrnet32_mot17.sh index 80f979dcdfa21d411c73a3d97dfe1151ba2c9d7e..8fb2b61808138d1f372e045c4e423694cddd3161 100644 --- a/cv/tracking/fairmot/pytorch/train_hrnet32_mot17.sh +++ b/cv/tracking/fairmot/pytorch/train_hrnet32_mot17.sh @@ -1,18 +1,4 @@ -#!/bin/bash -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. +#!/usr/bin/env bash python3 ./src/train.py mot --exp_id mot17_hrnet32 --arch 'hrnet_32' \ --data_cfg './src/lib/cfg/mot17.json' \ diff --git a/nlp/language_model/bert/pytorch/fwd_loss_bwd_trainer.py b/nlp/language_model/bert/pytorch/fwd_loss_bwd_trainer.py index edf734fb447616dc2e91d81725e5ce3fdefcf04a..eb20925d01214385efbc352bdeb86dbf3e5eb960 100644 --- a/nlp/language_model/bert/pytorch/fwd_loss_bwd_trainer.py +++ b/nlp/language_model/bert/pytorch/fwd_loss_bwd_trainer.py @@ -1,8 +1,7 @@ # coding=utf-8 +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) 2019-2021 NVIDIA CORPORATION. All rights reserved. # Copyright 2020 MLBenchmark Group. All rights reserved. -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/nlp/language_model/bert/pytorch/run_pretraining.py b/nlp/language_model/bert/pytorch/run_pretraining.py index 6336fdc77c5fc626384f887d9e89aa67857abef7..bcb01e477e2595f75e103efb2f8beae6272b4974 100644 --- a/nlp/language_model/bert/pytorch/run_pretraining.py +++ b/nlp/language_model/bert/pytorch/run_pretraining.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright (c) 2022, Shanghai Iluvatar CoreX Semiconductor Co., Ltd +# Copyright (c) 2022 Iluvatar CoreX. All rights reserved. # Copyright (c) 2019-2021 NVIDIA CORPORATION. All rights reserved. # Copyright 2020 MLBenchmark Group. All rights reserved. diff --git a/nlp/language_model/bert/pytorch/train_bert_pretraining_amp_dist.sh b/nlp/language_model/bert/pytorch/train_bert_pretraining_amp_dist.sh index e2d69cd36a690d131bf55ebc7b267a9a0a63f4a0..771c5021c074c09374b1285269429dd841f3199b 100644 --- a/nlp/language_model/bert/pytorch/train_bert_pretraining_amp_dist.sh +++ b/nlp/language_model/bert/pytorch/train_bert_pretraining_amp_dist.sh @@ -1,18 +1,3 @@ -#!/bin/bash -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. : ${DATA:="/home/datasets/nlp/bert"} @@ -50,4 +35,4 @@ run_pretraining.py --init_checkpoint ${DATA}/model.ckpt-28252.apex.pt \ --seed=17103 --skip_checkpoint \ --train_batch_size 81 --learning_rate=3.6e-4 \ --max_steps 7400 --eval_batch_size 52 \ ---gradient_accumulation_steps=3 "$@" +--gradient_accumulation_steps=3 "$@" \ No newline at end of file diff --git a/recommendation/ctr/dlrm/pytorch/dlrm/dist_model.py b/recommendation/ctr/dlrm/pytorch/dlrm/dist_model.py index d5c4f9184b9a5404949fe38a83327b6fabb7060d..467fb9ba21990af68f642343f78efff6b33d2eaa 100644 --- a/recommendation/ctr/dlrm/pytorch/dlrm/dist_model.py +++ b/recommendation/ctr/dlrm/pytorch/dlrm/dist_model.py @@ -1,17 +1,3 @@ -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. """Distributed version of DLRM model In order to code the hybrid decomposition, the model code needs to be restructured. I don't know a clean enough diff --git a/recommendation/ctr/dlrm/pytorch/scripts/dist_train.py b/recommendation/ctr/dlrm/pytorch/scripts/dist_train.py index 1e9879c90d53def9db0bfae5e8cb5a1f7323bfd9..bf915d111ea681f956e49924a62290786fc793c1 100644 --- a/recommendation/ctr/dlrm/pytorch/scripts/dist_train.py +++ b/recommendation/ctr/dlrm/pytorch/scripts/dist_train.py @@ -1,17 +1,3 @@ -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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 datetime import json import itertools diff --git a/recommendation/ctr/dlrm/pytorch/scripts/train.py b/recommendation/ctr/dlrm/pytorch/scripts/train.py index 1f91b22c4312eff857ab63439144dcadee29c3bb..51fe8d218835a01d4a28519e45f6be02dc51cf9a 100644 --- a/recommendation/ctr/dlrm/pytorch/scripts/train.py +++ b/recommendation/ctr/dlrm/pytorch/scripts/train.py @@ -1,17 +1,3 @@ -# Copyright (c) 2022-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. """Reference training script Only Criteo data is supported at the moment, one hot embedding. """ diff --git a/speech/speech_synthesis/tacotron2/pytorch/loss_scaler.py b/speech/speech_synthesis/tacotron2/pytorch/loss_scaler.py index 0662a60e2a719e4405748c68eb516f3bd3622348..88cc9cf29d3ce122d7582020b73be4f4a5641fcd 100644 --- a/speech/speech_synthesis/tacotron2/pytorch/loss_scaler.py +++ b/speech/speech_synthesis/tacotron2/pytorch/loss_scaler.py @@ -1,131 +1,131 @@ -import torch - -class LossScaler: - - def __init__(self, scale=1): - self.cur_scale = scale - - # `params` is a list / generator of torch.Variable - def has_overflow(self, params): - return False - - # `x` is a torch.Tensor - def _has_inf_or_nan(x): - return False - - # `overflow` is boolean indicating whether we overflowed in gradient - def update_scale(self, overflow): - pass - - @property - def loss_scale(self): - return self.cur_scale - - def scale_gradient(self, module, grad_in, grad_out): - return tuple(self.loss_scale * g for g in grad_in) - - def backward(self, loss): - scaled_loss = loss*self.loss_scale - scaled_loss.backward() - -class DynamicLossScaler: - - def __init__(self, - init_scale=2**32, - scale_factor=2., - scale_window=1000): - self.cur_scale = init_scale - self.cur_iter = 0 - self.last_overflow_iter = -1 - self.scale_factor = scale_factor - self.scale_window = scale_window - - # `params` is a list / generator of torch.Variable - def has_overflow(self, params): -# return False - for p in params: - if p.grad is not None and DynamicLossScaler._has_inf_or_nan(p.grad.data): - return True - - return False - - # `x` is a torch.Tensor - def _has_inf_or_nan(x): - cpu_sum = float(x.float().sum()) - if cpu_sum == float('inf') or cpu_sum == -float('inf') or cpu_sum != cpu_sum: - return True - return False - - # `overflow` is boolean indicating whether we overflowed in gradient - def update_scale(self, overflow): - if overflow: - #self.cur_scale /= self.scale_factor - self.cur_scale = max(self.cur_scale/self.scale_factor, 1) - self.last_overflow_iter = self.cur_iter - else: - if (self.cur_iter - self.last_overflow_iter) % self.scale_window == 0: - self.cur_scale *= self.scale_factor -# self.cur_scale = 1 - self.cur_iter += 1 - - @property - def loss_scale(self): - return self.cur_scale - - def scale_gradient(self, module, grad_in, grad_out): - return tuple(self.loss_scale * g for g in grad_in) - - def backward(self, loss): - scaled_loss = loss*self.loss_scale - scaled_loss.backward() - -############################################################## -# Example usage below here -- assuming it's in a separate file -############################################################## -if __name__ == "__main__": - import torch - from torch.autograd import Variable - from dynamic_loss_scaler import DynamicLossScaler - - # N is batch size; D_in is input dimension; - # H is hidden dimension; D_out is output dimension. - N, D_in, H, D_out = 64, 1000, 100, 10 - - # Create random Tensors to hold inputs and outputs, and wrap them in Variables. - x = Variable(torch.randn(N, D_in), requires_grad=False) - y = Variable(torch.randn(N, D_out), requires_grad=False) - - w1 = Variable(torch.randn(D_in, H), requires_grad=True) - w2 = Variable(torch.randn(H, D_out), requires_grad=True) - parameters = [w1, w2] - - learning_rate = 1e-6 - optimizer = torch.optim.SGD(parameters, lr=learning_rate) - loss_scaler = DynamicLossScaler() - - for t in range(500): - y_pred = x.mm(w1).clamp(min=0).mm(w2) - loss = (y_pred - y).pow(2).sum() * loss_scaler.loss_scale - print('Iter {} loss scale: {}'.format(t, loss_scaler.loss_scale)) - print('Iter {} scaled loss: {}'.format(t, loss.data[0])) - print('Iter {} unscaled loss: {}'.format(t, loss.data[0] / loss_scaler.loss_scale)) - - # Run backprop - optimizer.zero_grad() - loss.backward() - - # Check for overflow - has_overflow = DynamicLossScaler.has_overflow(parameters) - - # If no overflow, unscale grad and update as usual - if not has_overflow: - for param in parameters: - param.grad.data.mul_(1. / loss_scaler.loss_scale) - optimizer.step() - # Otherwise, don't do anything -- ie, skip iteration - else: - print('OVERFLOW!') - - # Update loss scale for next iteration - loss_scaler.update_scale(has_overflow) - +import torch + +class LossScaler: + + def __init__(self, scale=1): + self.cur_scale = scale + + # `params` is a list / generator of torch.Variable + def has_overflow(self, params): + return False + + # `x` is a torch.Tensor + def _has_inf_or_nan(x): + return False + + # `overflow` is boolean indicating whether we overflowed in gradient + def update_scale(self, overflow): + pass + + @property + def loss_scale(self): + return self.cur_scale + + def scale_gradient(self, module, grad_in, grad_out): + return tuple(self.loss_scale * g for g in grad_in) + + def backward(self, loss): + scaled_loss = loss*self.loss_scale + scaled_loss.backward() + +class DynamicLossScaler: + + def __init__(self, + init_scale=2**32, + scale_factor=2., + scale_window=1000): + self.cur_scale = init_scale + self.cur_iter = 0 + self.last_overflow_iter = -1 + self.scale_factor = scale_factor + self.scale_window = scale_window + + # `params` is a list / generator of torch.Variable + def has_overflow(self, params): +# return False + for p in params: + if p.grad is not None and DynamicLossScaler._has_inf_or_nan(p.grad.data): + return True + + return False + + # `x` is a torch.Tensor + def _has_inf_or_nan(x): + cpu_sum = float(x.float().sum()) + if cpu_sum == float('inf') or cpu_sum == -float('inf') or cpu_sum != cpu_sum: + return True + return False + + # `overflow` is boolean indicating whether we overflowed in gradient + def update_scale(self, overflow): + if overflow: + #self.cur_scale /= self.scale_factor + self.cur_scale = max(self.cur_scale/self.scale_factor, 1) + self.last_overflow_iter = self.cur_iter + else: + if (self.cur_iter - self.last_overflow_iter) % self.scale_window == 0: + self.cur_scale *= self.scale_factor +# self.cur_scale = 1 + self.cur_iter += 1 + + @property + def loss_scale(self): + return self.cur_scale + + def scale_gradient(self, module, grad_in, grad_out): + return tuple(self.loss_scale * g for g in grad_in) + + def backward(self, loss): + scaled_loss = loss*self.loss_scale + scaled_loss.backward() + +############################################################## +# Example usage below here -- assuming it's in a separate file +############################################################## +if __name__ == "__main__": + import torch + from torch.autograd import Variable + from dynamic_loss_scaler import DynamicLossScaler + + # N is batch size; D_in is input dimension; + # H is hidden dimension; D_out is output dimension. + N, D_in, H, D_out = 64, 1000, 100, 10 + + # Create random Tensors to hold inputs and outputs, and wrap them in Variables. + x = Variable(torch.randn(N, D_in), requires_grad=False) + y = Variable(torch.randn(N, D_out), requires_grad=False) + + w1 = Variable(torch.randn(D_in, H), requires_grad=True) + w2 = Variable(torch.randn(H, D_out), requires_grad=True) + parameters = [w1, w2] + + learning_rate = 1e-6 + optimizer = torch.optim.SGD(parameters, lr=learning_rate) + loss_scaler = DynamicLossScaler() + + for t in range(500): + y_pred = x.mm(w1).clamp(min=0).mm(w2) + loss = (y_pred - y).pow(2).sum() * loss_scaler.loss_scale + print('Iter {} loss scale: {}'.format(t, loss_scaler.loss_scale)) + print('Iter {} scaled loss: {}'.format(t, loss.data[0])) + print('Iter {} unscaled loss: {}'.format(t, loss.data[0] / loss_scaler.loss_scale)) + + # Run backprop + optimizer.zero_grad() + loss.backward() + + # Check for overflow + has_overflow = DynamicLossScaler.has_overflow(parameters) + + # If no overflow, unscale grad and update as usual + if not has_overflow: + for param in parameters: + param.grad.data.mul_(1. / loss_scaler.loss_scale) + optimizer.step() + # Otherwise, don't do anything -- ie, skip iteration + else: + print('OVERFLOW!') + + # Update loss scale for next iteration + loss_scaler.update_scale(has_overflow) + diff --git a/speech/speech_synthesis/tacotron2/pytorch/train.py b/speech/speech_synthesis/tacotron2/pytorch/train.py index 36e7bb9be6bb0f1b3b02de45b7c50954201f8552..c7091460bee24cd289a7754ecd49b88ffb6bfda4 100644 --- a/speech/speech_synthesis/tacotron2/pytorch/train.py +++ b/speech/speech_synthesis/tacotron2/pytorch/train.py @@ -1,5 +1,3 @@ -# Copyright (c) 2023-2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. import os import sys import time