diff --git a/.gitignore b/.gitignore index b9f7b62bc..499d72bac 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,11 @@ -# Byte-compiled / optimized / DLL files + __pycache__/ *.py[cod] *$py.class # C extensions *.so -# Distribution / packaging + .Python build/ develop-eggs/ diff --git a/setup.py b/setup.py index 29cf213c0..c0bae295a 100644 --- a/setup.py +++ b/setup.py @@ -1,16 +1,4 @@ -# Copyright 2021 Huawei Technologies Co., Ltd -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# 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. + """ setup packpage """ diff --git a/tests/engine/test_trainer.py b/tests/engine/test_trainer.py index fcfd158b2..593df9356 100644 --- a/tests/engine/test_trainer.py +++ b/tests/engine/test_trainer.py @@ -1,17 +1,4 @@ -# coding=utf-8 -# Copyright 2018 the HuggingFace Inc. team. -# -# 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 dataclasses import gc @@ -49,9 +36,7 @@ from mindnlp.utils import is_mindspore_available, logging from mindnlp.core.serialization import safe_load_file, safe_save_file, load_checkpoint from mindnlp.utils.testing_utils import ( - # ENDPOINT_STAGING, - # TOKEN, - # USER, + CaptureLogger, LoggingLevel, TestCasePlus, diff --git a/tools/auto_gen.py b/tools/auto_gen.py index 80ba77a4f..b1187bde9 100644 --- a/tools/auto_gen.py +++ b/tools/auto_gen.py @@ -38,9 +38,9 @@ def generate_global_variables(file_path): new_lines = lines[:] offset = 0 for func_name, line_no in sorted(function_positions.items(), key=lambda x: x[1]): - # Test if the function exists in mindspore.mint + if hasattr(mindspore.mint, func_name): - # Insert global variable if not already present + variable_declaration = f"has_{func_name} = hasattr(mindspore.mint, '{func_name}')" if variable_declaration not in existing_globals: new_lines.insert(line_no + offset, variable_declaration + "\n")