From b5d5673052db52ffa91fffa0d39ee93fc84afac8 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Thu, 22 Feb 2024 09:58:57 +0800 Subject: [PATCH] add windows test (#135) * add windows test * add new line Signed-off-by: Wenxin Zhang --- .../scripts/prepare_env_with_conda.bat | 34 ++++++++++++++ .github/workflows/windows-test.yml | 45 +++++++++++++++++++ scripts/convert.py | 2 +- scripts/run.py | 2 +- 4 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/scripts/prepare_env_with_conda.bat create mode 100644 .github/workflows/windows-test.yml diff --git a/.github/workflows/scripts/prepare_env_with_conda.bat b/.github/workflows/scripts/prepare_env_with_conda.bat new file mode 100644 index 000000000..8d077ed64 --- /dev/null +++ b/.github/workflows/scripts/prepare_env_with_conda.bat @@ -0,0 +1,34 @@ +SET conda_env_name=windows_build_ns +SET python_version=3.10 +cd ../../.. + +FOR /F %%i IN ('conda info -e ^| find /c "%conda_env_name%"') do SET CONDA_COUNT=%%i +if %CONDA_COUNT% EQU 0 ( + CALL conda create python=%python_version% -y -n %conda_env_name% +) + +IF %ERRORLEVEL% NEQ 0 ( + echo "Could not create new conda environment." + exit 1 +) +CALL conda activate %conda_env_name% +CALL pip uninstall neural-speed -y +echo "pip list all the components------------->" +CALL pip list +CALL pip install -U pip +echo "Installing requirements for validation scripts..." +CALL pip install -r requirements.txt +echo "pip list all the components------------->" +CALL pip list +echo "------------------------------------------" +IF %ERRORLEVEL% NEQ 0 ( + echo "Could not install requirements." + exit 1 +) + +git submodule update --init --recursive +python setup.py sdist bdist_wheel +IF %ERRORLEVEL% NEQ 0 ( + echo "Could not build binary." + exit 1 +) diff --git a/.github/workflows/windows-test.yml b/.github/workflows/windows-test.yml new file mode 100644 index 000000000..26c846b74 --- /dev/null +++ b/.github/workflows/windows-test.yml @@ -0,0 +1,45 @@ +name: Windows Binary Test + +on: + pull_request: + branches: [main] + paths: + - ".github/workflows/windows-test.yml" + - "requirements.txt" + - "setup.py" + - "neural_speed/**" + - "bestla/**" + - '!bestla/ut/**' + - '!bestla/xbyak/**' + - '!bestla/xbyak/*.md' + - '!neural_speed/*.md' + + workflow_dispatch: + +# If there is a new commit, the previous jobs will be canceled +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +env: + SCRIPT_PATH: ${{ github.workspace }}\.github\workflows\script + WORKING_DIR: ${{ github.workspace }} + +jobs: + Windows-Binary-Test: + runs-on: 'Windows' + steps: + - name: Checkout out Repo + uses: actions/checkout@v4 + with: + submodules: "recursive" + fetch-tags: true + path: "a" + + - name: Binary build + shell: cmd + run: | + SET HTTP_PROXY=${{ vars.HTTP_PROXY_WINDOWS }} + SET HTTPS_PROXY=${{ vars.HTTP_PROXY_WINDOWS }} + cd ${{ github.workspace }}\a\.github\workflows\scripts + prepare_env_with_conda.bat diff --git a/scripts/convert.py b/scripts/convert.py index 5e97eead0..ef8c5a780 100644 --- a/scripts/convert.py +++ b/scripts/convert.py @@ -44,7 +44,7 @@ def main(args_in: Optional[List[str]] = None) -> None: dir_model = snapshot_download(repo_id=str(args.model), resume_download=True, token=args.token) except Exception as e: if e.response.status_code == 401: - print("You are required to input an acccess token ID for {}, please add it in option --token or download model weights locally".format(args.model)) + print("You are required to input an access token ID for {}, please add it in option --token or download model weights locally".format(args.model)) sys.exit(f"{e}") convert_model(dir_model, args.outfile, args.outtype, use_quantized_model=args.use_quantized_model) diff --git a/scripts/run.py b/scripts/run.py index 501999cc1..d823edb05 100644 --- a/scripts/run.py +++ b/scripts/run.py @@ -163,7 +163,7 @@ def main(args_in: Optional[List[str]] = None) -> None: # Handles Missing token ID for gated models except Exception as e: if e.response.status_code == 401: - print("You are required to input an acccess token ID for {}, please add it in option --token or download model weights locally".format(args.model)) + print("You are required to input an access token ID for {}, please add it in option --token or download model weights locally".format(args.model)) sys.exit(f"{e}") parent_path = Path(__file__).parent.absolute()