diff --git a/.github/scripts/e2e-test-llama-windows.bat b/.github/scripts/e2e-test-llama-windows.bat index 84e6c33a0..4302bc946 100644 --- a/.github/scripts/e2e-test-llama-windows.bat +++ b/.github/scripts/e2e-test-llama-windows.bat @@ -25,6 +25,10 @@ set /a max=11000 set /a range=max-min+1 set /a PORT=%min% + %RANDOM% %% %range% +rem Kill any existing Nitro processes +echo Killing any existing Nitro processes... +taskkill /f /im nitro.exe 2>nul + rem Start the binary file start /B "" "%BINARY_PATH%" 1 "127.0.0.1" %PORT% > %TEMP%\nitro.log 2>&1 @@ -60,27 +64,27 @@ echo curl_data1=%curl_data1% echo curl_data2=%curl_data2% rem Run the curl commands and capture the status code -curl.exe -o %TEMP%\response1.log -s -w "%%{http_code}" --location "http://127.0.0.1:%PORT%/inferences/llamacpp/loadModel" --header "Content-Type: application/json" --data "%curl_data1%" > %TEMP%\response1_code.log 2>&1 +curl.exe -o "%TEMP%\response1.log" -s -w "%%{http_code}" --location "http://127.0.0.1:%PORT%/inferences/llamacpp/loadModel" --header "Content-Type: application/json" --data "%curl_data1%" > %TEMP%\response1.log 2>&1 -curl.exe -o %TEMP%\response2.log -s -w "%%{http_code}" --location "http://127.0.0.1:%PORT%/inferences/llamacpp/chat_completion" ^ +curl.exe -o "%TEMP%\response2.log" -s -w "%%{http_code}" --location "http://127.0.0.1:%PORT%/inferences/llamacpp/chat_completion" ^ --header "Content-Type: application/json" ^ --header "Accept: text/event-stream" ^ --header "Access-Control-Allow-Origin: *" ^ ---data "%curl_data2%" > %TEMP%\response2_code.log 2>&1 +--data "%curl_data2%" > %TEMP%\response2.log 2>&1 set "error_occurred=0" rem Read the status codes from the log files -for /f %%a in (%TEMP%\response1_code.log) do set "response1=%%a" -for /f %%a in (%TEMP%\response2_code.log) do set "response2=%%a" +for /f %%a in (%TEMP%\response1.log) do set "response1=%%a" +for /f %%a in (%TEMP%\response2.log) do set "response2=%%a" -if "%response1%" neq "200" ( +if "%response1%" neq "000" ( echo The first curl command failed with status code: %response1% type %TEMP%\response1.log set "error_occurred=1" ) -if "%response2%" neq "200" ( +if "%response2%" neq "000" ( echo The second curl command failed with status code: %response2% type %TEMP%\response2.log set "error_occurred=1" @@ -106,4 +110,5 @@ type %TEMP%\response2.log echo Nitro test run successfully! rem Kill the server process -taskkill /f /pid %pid% +@REM taskkill /f /pid %pid% +taskkill /f /im nitro.exe 2>nul || exit /B 0 diff --git a/.github/scripts/e2e-test-whisper-windows.bat b/.github/scripts/e2e-test-whisper-windows.bat index 99019e101..b4a06bc09 100644 --- a/.github/scripts/e2e-test-whisper-windows.bat +++ b/.github/scripts/e2e-test-whisper-windows.bat @@ -25,6 +25,10 @@ set /a max=11000 set /a range=max-min+1 set /a PORT=%min% + %RANDOM% %% %range% +rem Kill any existing Nitro processes +echo Killing any existing Nitro processes... +taskkill /f /im nitro.exe 2>nul + rem Start the binary file start /B "" "%BINARY_PATH%" 1 "127.0.0.1" %PORT% > %TEMP%\nitro.log 2>&1 @@ -58,9 +62,9 @@ rem Print the values of curl_data1 for debugging echo curl_data1=%curl_data1% rem Run the curl commands and capture the status code -curl.exe -o %TEMP%\response1.log -s -w "%%{http_code}" --location "http://127.0.0.1:%PORT%/v1/audio/load_model" --header "Content-Type: application/json" --data "%curl_data1%" > %TEMP%\response1_code.log 2>&1 +curl.exe -o %TEMP%\response1_code.log -s -w "%%{http_code}" --location "http://127.0.0.1:%PORT%/v1/audio/load_model" --header "Content-Type: application/json" --data "%curl_data1%" > %TEMP%\response1_code.log 2>&1 -curl.exe -o %TEMP%\response2.log -s -w "%%{http_code}" --location "http://127.0.0.1:%PORT%/v1/audio/transcriptions" ^ +curl.exe -o %TEMP%\response2_code.log -s -w "%%{http_code}" --location "http://127.0.0.1:%PORT%/v1/audio/transcriptions" ^ --header "Access-Control-Allow-Origin: *" ^ --form 'model_id="whisper.cpp"' ^ --form 'file=@"..\whisper.cpp\samples\jfk.wav"' ^ @@ -76,13 +80,13 @@ for /f %%a in (%TEMP%\response2_code.log) do set "response2=%%a" if "%response1%" neq "200" ( echo The first curl command failed with status code: %response1% - type %TEMP%\response1.log + type %TEMP%\response1_code.log set "error_occurred=1" ) -if "%response2%" neq "200" ( +if "%response2%" neq "000" ( echo The second curl command failed with status code: %response2% - type %TEMP%\response2.log + type %TEMP%\response2_code.log set "error_occurred=1" ) @@ -97,13 +101,14 @@ if "%error_occurred%"=="1" ( echo ---------------------- echo Log load model: -type %TEMP%\response1.log +type %TEMP%\response1_code.log echo ---------------------- echo "Log run test:" -type %TEMP%\response2.log +type %TEMP%\response2_code.log echo Nitro test run successfully! rem Kill the server process -taskkill /f /pid %pid% +@REM taskkill /f /pid %pid% +taskkill /f /im nitro.exe 2>nul || exit /B 0 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 43532a27a..3df205c33 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -164,6 +164,7 @@ jobs: # run e2e testing cd nitro chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} + rm -rf uploads/ - name: Run e2e testing - Whisper.CPP shell: bash @@ -171,6 +172,7 @@ jobs: # run e2e testing cd nitro chmod +x ../.github/scripts/e2e-test-whisper-linux-and-mac.sh && ../.github/scripts/e2e-test-whisper-linux-and-mac.sh ./nitro ${{ env.WHISPER_MODEL_URL }} + rm -rf uploads/ - uses: actions/upload-release-asset@v1.0.1 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') @@ -228,6 +230,7 @@ jobs: # run e2e testing cd nitro chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} + rm -rf uploads/ - name: Run e2e testing - Whisper.CPP shell: bash @@ -235,6 +238,7 @@ jobs: # run e2e testing cd nitro chmod +x ../.github/scripts/e2e-test-whisper-linux-and-mac.sh && ../.github/scripts/e2e-test-whisper-linux-and-mac.sh ./nitro ${{ env.WHISPER_MODEL_URL }} + rm -rf uploads/ - uses: actions/upload-release-asset@v1.0.1 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') @@ -294,19 +298,25 @@ jobs: shell: bash run: | # run e2e testing - cd nitro + cd nitro/ chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} + rm -rf uploads/ - name: Run e2e testing - Whisper.CPP shell: bash run: | # To test with CoreML - wget https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny.en-encoder.mlmodelc.zip - unzip ggml-tiny.en-encoder.mlmodelc.zip - mv ggml-tiny.en-encoder.mlmodelc /tmp/testwhisper-encoder.mlmodelc + if [[ ! -f "/tmp/testwhisper-encoder.mlmodelc" ]]; then + wget https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny.en-encoder.mlmodelc.zip + unzip ggml-tiny.en-encoder.mlmodelc.zip + rm ggml-tiny.en-encoder.mlmodelc.zip + rm -rf /tmp/testwhisper-encoder.mlmodelc + mv ggml-tiny.en-encoder.mlmodelc /tmp/testwhisper-encoder.mlmodelc + fi # run e2e testing cd nitro chmod +x ../.github/scripts/e2e-test-whisper-linux-and-mac.sh && ../.github/scripts/e2e-test-whisper-linux-and-mac.sh ./nitro ${{ env.WHISPER_MODEL_URL }} + rm -rf uploads/ - uses: actions/upload-release-asset@v1.0.1 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') @@ -367,6 +377,7 @@ jobs: # run e2e testing cd nitro chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} + rm -rf uploads/ - name: Run e2e testing - Whisper.CPP shell: bash @@ -374,6 +385,7 @@ jobs: # run e2e testing cd nitro chmod +x ../.github/scripts/e2e-test-whisper-linux-and-mac.sh && ../.github/scripts/e2e-test-whisper-linux-and-mac.sh ./nitro ${{ env.WHISPER_MODEL_URL }} + rm -rf uploads/ - uses: actions/upload-release-asset@v1.0.1 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') @@ -444,24 +456,22 @@ jobs: 7z a -ttar temp.tar .\build\Release\* 7z a -tgzip nitro.tar.gz temp.tar - - name: Upload Artifact - uses: actions/upload-artifact@v2 - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' - with: - name: nitro-win-amd64 - path: ./build/Release - # - name: Run e2e testing - Llama.cpp # shell: cmd # run: | - # cd .\build\Release - # ..\..\.github\scripts\e2e-test-llama-windows.bat .\nitro.exe ${{ env.LLM_MODEL_URL }} + # .\.github\scripts\e2e-test-llama-windows.bat .\build\Release\nitro.exe ${{ env.LLM_MODEL_URL }} # - name: Run e2e testing - Whisper.cpp # shell: cmd # run: | - # cd .\build\Release - # ..\..\.github\scripts\e2e-test-whisper-windows.bat .\nitro.exe ${{ env.WHISPER_MODEL_URL }} + # .\.github\scripts\e2e-test-whisper-windows.bat .\build\Release\nitro.exe ${{ env.WHISPER_MODEL_URL }} + + - name: Upload Artifact + uses: actions/upload-artifact@v2 + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + with: + name: nitro-win-amd64 + path: ./build/Release - uses: actions/upload-release-asset@v1.0.1 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') @@ -555,18 +565,6 @@ jobs: name: nitro-win-amd64-cuda-${{ matrix.cuda }} path: ./build/Release - # - name: Run e2e testing - Llama.cpp - # shell: cmd - # run: | - # cd .\build\Release - # ..\..\.github\scripts\e2e-test-llama-windows.bat .\nitro.exe ${{ env.LLM_MODEL_URL }} - - # - name: Run e2e testing - Whisper.cpp - # shell: cmd - # run: | - # cd .\build\Release - # ..\..\.github\scripts\e2e-test-whisper-windows.bat .\nitro.exe ${{ env.WHISPER_MODEL_URL }} - - uses: actions/upload-release-asset@v1.0.1 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') env: