From 17c395448619535553f300fe0866451040d52bc6 Mon Sep 17 00:00:00 2001 From: Unbinilium <15633984+Unbinilium@users.noreply.github.com> Date: Fri, 7 Jul 2023 11:21:09 +0800 Subject: [PATCH] fix: ci related issues and import errors (#91) * fix: pip install deps error * ci: correct functional test names * ci: functional test script abstraction * ci: fix typos and echo env variables * fix: deprecate persistant workers and device in cli * ci: add timeout limit * docs: update train cli descriptions * ci: enable linting for PRs * refactor: deprecate loguru (team preference) * fix: format typo * fix: mim extension installation * ci: fix path error * ci: fix export error * ci: remove inner quotes * ci: tree outputs in export and inference * fix: import scope error * ci: add more files to watch * ci: flexible lint branch --- .github/workflows/code-lint.yml | 2 -- .github/workflows/functional-test.yml | 3 +++ scripts/test_functional.sh | 12 +++++++----- tools/export.py | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/code-lint.yml b/.github/workflows/code-lint.yml index b847ecde..2ebc381c 100644 --- a/.github/workflows/code-lint.yml +++ b/.github/workflows/code-lint.yml @@ -22,8 +22,6 @@ jobs: steps: - name: checkout repository uses: actions/checkout@v3 - with: - ref: 'dev' # should be main later - name: setup python uses: actions/setup-python@v4 diff --git a/.github/workflows/functional-test.yml b/.github/workflows/functional-test.yml index 7c0d8eff..6029a7a9 100644 --- a/.github/workflows/functional-test.yml +++ b/.github/workflows/functional-test.yml @@ -5,8 +5,11 @@ on: branches: - dev # should be 'main' later paths: + - 'configs/**' + - 'edgelab/**' - 'requirements/**' - 'scripts/**' + - 'tools/**' - 'environment.yml' - 'environment_cuda.yml' - 'requirements.txt' diff --git a/scripts/test_functional.sh b/scripts/test_functional.sh index e5682a52..de3ecc5b 100644 --- a/scripts/test_functional.sh +++ b/scripts/test_functional.sh @@ -45,8 +45,8 @@ functional_test_core() CONFIG_FILE="$2" DATASETS_URL="$3" - CONFIG_FILE_NAME="$(basename -- \"${CONFIG_FILE} \")" - DATASETS_PATH="datasets/$(basename -- \"${DATASETS_URL} \")" + CONFIG_FILE_NAME="$(basename -- ${CONFIG_FILE})" + DATASETS_PATH="datasets/$(basename -- ${DATASETS_URL})" DATASETS_DIR="${DATASETS_PATH%.*}" LAST_CHECKPOINT="work_dirs/${CONFIG_FILE_NAME%.*}/last_checkpoint" @@ -67,10 +67,11 @@ functional_test_core() --no-validate \ --cfg-options \ data_root="${DATASETS_DIR}" \ - epochs=1 + max_epochs=10 return $? ;; "export") + tree work_dirs python3 tools/export.py \ "${CONFIG_FILE}" \ "$(cat \"${LAST_CHECKPOINT} \")" \ @@ -81,15 +82,16 @@ functional_test_core() return $? ;; "inference") + tree work_dirs python3 tools/inference.py \ "${CONFIG_FILE}" \ - "$(cat \"${LAST_CHECKPOINT} \" | sed -e 's/.pth/_int8.tflite/g')" \ + "$(cat ${LAST_CHECKPOINT} | sed -e 's/.pth/_int8.tflite/g')" \ --cfg-options \ data_root="${DATASETS_DIR}" \ && \ python3 tools/inference.py \ "${CONFIG_FILE}" \ - "$(cat \"${LAST_CHECKPOINT} \" | sed -e 's/.pth/_float32.onnx/g')" \ + "$(cat ${LAST_CHECKPOINT} | sed -e 's/.pth/_float32.onnx/g')" \ --cfg-options \ data_root="${DATASETS_DIR}" return $? diff --git a/tools/export.py b/tools/export.py index c2295239..4ab65934 100644 --- a/tools/export.py +++ b/tools/export.py @@ -164,7 +164,7 @@ def verify_args(args): def build_config(args): from mmengine.config import Config - from tools.utils.config import load_config + from edgelab.tools.utils.config import load_config args.targets = [str(target).lower() for target in args.targets] args.precisions = [str(precision).lower() for precision in args.precisions]