From 20b3a679e7befbe63e848655f901fafd721ca82e Mon Sep 17 00:00:00 2001 From: chenxujun Date: Thu, 2 Mar 2023 11:06:56 +0800 Subject: [PATCH] Fix some words (#141) --- .dev_scripts/build_image.sh | 6 +++--- docs/source/develop.md | 6 +++--- .../exporters/nlp/csanmt_for_translation_exporter.py | 4 ++-- modelscope/hub/api.py | 2 +- tests/utils/case_file_analyzer.py | 12 ++++++------ 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.dev_scripts/build_image.sh b/.dev_scripts/build_image.sh index 81bce38b..6bc8b5e4 100644 --- a/.dev_scripts/build_image.sh +++ b/.dev_scripts/build_image.sh @@ -45,7 +45,7 @@ for i in "$@"; do ;; --modelscope=*) modelscope_version="${i#*=}" - shift # cudatoolkit for pytorch + shift # modelscope version ;; --test) run_ci_test=True @@ -65,7 +65,7 @@ for i in "$@"; do ;; --push) is_push=True - shift # is dsw, will set dsw cache location + shift # option for push image to remote repo ;; --help) usage @@ -126,7 +126,7 @@ echo "$is_dsw" if [ "$is_dsw" == "False" ]; then echo "Not DSW image" else - echo "Building dsw image well need set ModelScope lib cache location." + echo "Building dsw image will need set ModelScope lib cache location." docker_file_content="${docker_file_content} \nENV MODELSCOPE_CACHE=/mnt/workspace/.cache/modelscope" fi if [ "$is_ci_test" == "True" ]; then diff --git a/docs/source/develop.md b/docs/source/develop.md index ddde5ed6..668bc9b4 100644 --- a/docs/source/develop.md +++ b/docs/source/develop.md @@ -10,7 +10,7 @@ We use the following toolsseed isortseed isortseed isort for linting and formatt Style configurations of yapf and isort can be found in [setup.cfg](../../setup.cfg). We use [pre-commit hook](https://pre-commit.com/) that checks and formats for `flake8`, `yapf`, `seed-isort-config`, `isort`, `trailing whitespaces`, -fixes `end-of-files`, sorts `requirments.txt` automatically on every commit. +fixes `end-of-files`, sorts `requirements.txt` automatically on every commit. The config for a pre-commit hook is stored in [.pre-commit-config](../../.pre-commit-config.yaml). After you clone the repository, you will need to install initialize pre-commit hook. ```bash @@ -81,7 +81,7 @@ exists in the environment and unset it. python tests/path/to/your_test.py ``` -2. Remember to run core tests in local environment before start a codereview, by default it will +2. Remember to run core tests in local environment before start a code review, by default it will only run test cases with level 0. ```bash make tests @@ -153,7 +153,7 @@ git pull origin branch_name git add . git commit -m "[to #42322933] my commit message" ``` - note: you may replace [to #42322933] with your own aone issue id (if any). + note: you may replace [to #42322933] with your own alone issue id (if any). 4. Push your change: ```shell git push --set-upstream origin dev/my-dev-branch diff --git a/modelscope/exporters/nlp/csanmt_for_translation_exporter.py b/modelscope/exporters/nlp/csanmt_for_translation_exporter.py index 95cb5bc9..f12d0b7d 100644 --- a/modelscope/exporters/nlp/csanmt_for_translation_exporter.py +++ b/modelscope/exporters/nlp/csanmt_for_translation_exporter.py @@ -68,7 +68,7 @@ class CsanmtForTranslationExporter(TfModelExporter): dummy_inputs = self.generate_dummy_inputs() with tf.Session(graph=tf.Graph()) as sess: - # Restore model from the saved_modle file, that is exported by TensorFlow estimator. + # Restore model from the saved_model file, that is exported by TensorFlow estimator. MetaGraphDef = tf.saved_model.loader.load(sess, ['serve'], output_dir) @@ -181,5 +181,5 @@ class CsanmtForTranslationExporter(TfModelExporter): def export_onnx(self, output_dir: str, opset=13, **kwargs): raise NotImplementedError( - 'csanmt model does not support onnx format, consider using savedmodel instead.' + 'csanmt model does not support onnx format, consider using saved model instead.' ) diff --git a/modelscope/hub/api.py b/modelscope/hub/api.py index f783222c..03dbe4bc 100644 --- a/modelscope/hub/api.py +++ b/modelscope/hub/api.py @@ -125,7 +125,7 @@ class HubApi: visibility: Optional[int] = ModelVisibility.PUBLIC, license: Optional[str] = Licenses.APACHE_V2, chinese_name: Optional[str] = None) -> str: - """Create model repo at ModelScopeHub. + """Create model repo at ModelScope Hub. Args: model_id (str): The model id diff --git a/tests/utils/case_file_analyzer.py b/tests/utils/case_file_analyzer.py index 64707340..82ae5563 100644 --- a/tests/utils/case_file_analyzer.py +++ b/tests/utils/case_file_analyzer.py @@ -8,7 +8,7 @@ from typing import Any from modelscope.utils.logger import get_logger logger = get_logger() -SYSTEM_TRAINER_BUILDER_FINCTION_NAME = 'build_trainer' +SYSTEM_TRAINER_BUILDER_FUNCTION_NAME = 'build_trainer' SYSTEM_TRAINER_BUILDER_PARAMETER_NAME = 'name' SYSTEM_PIPELINE_BUILDER_FUNCTION_NAME = 'pipeline' SYSTEM_PIPELINE_BUILDER_PARAMETER_NAME = 'task' @@ -263,12 +263,12 @@ def analysis_trainer_test_suite(test_file, modified_register_modules): # get test file global function and test class test_suite_root = ast.parse(src, test_file) test_suite_analyzer = AnalysisTestFile( - test_file, SYSTEM_TRAINER_BUILDER_FINCTION_NAME) + test_file, SYSTEM_TRAINER_BUILDER_FUNCTION_NAME) test_suite_analyzer.visit(test_suite_root) for test_class in test_suite_analyzer.test_classes: test_class_analyzer = AnalysisTestClass( - test_class, SYSTEM_TRAINER_BUILDER_FINCTION_NAME) + test_class, SYSTEM_TRAINER_BUILDER_FUNCTION_NAME) test_class_analyzer.visit(test_class) for test_method in test_class_analyzer.test_methods: for idx, custom_global_builder in enumerate( @@ -278,7 +278,7 @@ def analysis_trainer_test_suite(test_file, modified_register_modules): test_method, test_class_analyzer.setup_variables, custom_global_builder, test_suite_analyzer.custom_global_builder_calls[idx], - SYSTEM_TRAINER_BUILDER_FINCTION_NAME, + SYSTEM_TRAINER_BUILDER_FUNCTION_NAME, SYSTEM_TRAINER_BUILDER_PARAMETER_NAME) if trainer_name is not None: tested_trainers.append(trainer_name) @@ -289,14 +289,14 @@ def analysis_trainer_test_suite(test_file, modified_register_modules): test_method, test_class_analyzer.setup_variables, custom_class_method_builder, test_class_analyzer.custom_class_method_builder_calls[idx], - SYSTEM_TRAINER_BUILDER_FINCTION_NAME, + SYSTEM_TRAINER_BUILDER_FUNCTION_NAME, SYSTEM_TRAINER_BUILDER_PARAMETER_NAME) if trainer_name is not None: tested_trainers.append(trainer_name) trainer_name = get_builder_parameter_value( test_method, test_class_analyzer.setup_variables, None, None, - SYSTEM_TRAINER_BUILDER_FINCTION_NAME, + SYSTEM_TRAINER_BUILDER_FUNCTION_NAME, SYSTEM_TRAINER_BUILDER_PARAMETER_NAME ) # direct call the build_trainer if trainer_name is not None: