Skip to content

Commit

Permalink
Merge CI Fix and Buffer Overrun Issue (#1013)
Browse files Browse the repository at this point in the history
Co-authored-by: Abhishek Jindal <[email protected]>
Co-authored-by: Ryan Hill <[email protected]>
  • Loading branch information
3 people authored Oct 25, 2024
1 parent dcd3c7f commit aa5d171
Show file tree
Hide file tree
Showing 19 changed files with 41 additions and 38 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/linux-cpu-x64-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ jobs:
- name: Install the python wheel and test dependencies
run: |
python3 -m pip install -r test/python/requirements.txt --user
python3 -m pip install -r test/python/requirements-cpu.txt --user
python3 -m pip install build/cpu/wheel/onnxruntime_genai*.whl --user --no-deps
python3 -m pip install -r test/python/cpu/torch/requirements.txt --user
python3 -m pip install -r test/python/cpu/ort/requirements.txt --user
python3 -m pip install --user --no-index --find-links build/cpu/wheel onnxruntime_genai
- name: Use Dummy HuggingFace Token
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/linux-cpu-x64-nightly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ jobs:
- name: Install the python wheel and test dependencies
run: |
python3 -m pip install -r test/python/requirements.txt --user
python3 -m pip install -r test/python/requirements-cpu.txt --user
python3 -m pip install -r test/python/cpu/torch/requirements.txt --user
python3 -m pip install -r test/python/cpu/ort/requirements.txt --user
python3 -m pip install build/cpu/wheel/onnxruntime_genai*.whl --no-deps
- name: Use Dummy HuggingFace Token
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/linux-gpu-x64-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ jobs:
-e HF_TOKEN=$HF_TOKEN \
-w /ort_genai_src onnxruntimecudabuildx64 bash -c " \
${{ env.PYTHON_EXECUTABLE }} -m pip install -r test/python/requirements.txt --user && \
${{ env.PYTHON_EXECUTABLE }} -m pip install -r test/python/requirements-cuda.txt --user && \
${{ env.PYTHON_EXECUTABLE }} -m pip install -r test/python/cuda/torch/requirements.txt --user && \
${{ env.PYTHON_EXECUTABLE }} -m pip install -r test/python/cuda/ort/requirements.txt --user && \
${{ env.PYTHON_EXECUTABLE }} -m pip install /ort_genai_src/build/cuda/wheel/onnxruntime_genai*manylinux*.whl --no-deps --user && \
${{ env.PYTHON_EXECUTABLE }} test/python/test_onnxruntime_genai.py --cwd test/python --test_models test/test_models --e2e"
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/mac-cpu-arm64-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ jobs:
python3 -m venv genai-macos-venv
source genai-macos-venv/bin/activate
python3 -m pip install -r test/python/requirements.txt
python3 -m pip install -r test/python/requirements-macos.txt
python3 -m pip install -r test/python/macos/torch/requirements.txt
python3 -m pip install -r test/python/macos/ort/requirements.txt
python3 -m pip install build/cpu/osx-arm64/wheel/onnxruntime_genai*.whl --no-deps
- name: Remove the ort lib and header files
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/win-cpu-x64-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ jobs:
- name: Install the python wheel and test dependencies
run: |
python3 -m pip install -r test\python\requirements.txt --user
python3 -m pip install -r test\python\requirements-cpu.txt --user
python3 -m pip install -r test\python\cpu\torch\requirements.txt --user
python3 -m pip install -r test\python\cpu\ort\requirements.txt --user
python3 -m pip install (Get-ChildItem ("$env:binaryDir\wheel\*.whl")) --no-deps
- name: Use Dummy HuggingFace Token
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/win-cuda-x64-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ jobs:
- name: Install the Python Wheel and Test Dependencies
run: |
python -m pip install -r test\python\requirements.txt
python -m pip install -r test\python\requirements-cuda.txt
python -m pip install -r test\python\cuda\torch\requirements.txt
python -m pip install -r test\python\cuda\ort\requirements.txt
python -m pip install (Get-ChildItem ("$env:binaryDir\wheel\*.whl")) --no-deps
- name: Use Dummy HuggingFace Token
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/win-directml-x64-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ jobs:
- name: Install the Python Wheel and Test Dependencies
run: |
python -m pip install -r test\python\requirements.txt
python -m pip install -r test\python\requirements-directml.txt
python -m pip install -r test\python\directml\torch\requirements.txt
python -m pip install -r test\python\directml\ort\requirements.txt
python -m pip install (Get-ChildItem ("$env:binaryDir\wheel\*.whl")) --no-deps
- name: Verify Build Artifacts
Expand Down
18 changes: 12 additions & 6 deletions .pipelines/stages/jobs/py-validation-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ jobs:
bash -c " \
export ORTGENAI_LOG_ORT_LIB=1 && \
$python_exe -m pip install -r /ort_genai_src/test/python/requirements.txt && \
$python_exe -m pip install -r /ort_genai_src/test/python/requirements-cuda.txt && \
$python_exe -m pip install -r /ort_genai_src/test/python/cuda/torch/requirements.txt && \
$python_exe -m pip install -r /ort_genai_src/test/python/cuda/ort/requirements.txt && \
cd /ort_genai_src/examples/python && \
$python_exe -m pip install --no-index --find-links=/ort_genai_binary/wheel $(pip_package_name) && \
$python_exe model-generate.py -m ./models/$(prebuild_phi3_mini_model_folder) --min_length 25 --max_length 50 --verbose"
Expand All @@ -200,10 +201,12 @@ jobs:
export ORTGENAI_LOG_ORT_LIB=1
python -m pip install -r test/python/requirements.txt
if [[ "$(os)" == "linux" ]]; then
python -m pip install -r test/python/requirements-cpu.txt
python -m pip install -r test/python/cpu/torch/requirements.txt
python -m pip install -r test/python/cpu/ort/requirements.txt
fi
if [[ "$(os)" == "osx" ]]; then
python -m pip install -r test/python/requirements-macos.txt
python -m pip install -r test/python/macos/torch/requirements.txt
python -m pip install -r test/python/macos/ort/requirements.txt
fi
cd examples/python
python -m pip install --no-index --find-links=$(Build.BinariesDirectory)/wheel $(pip_package_name)
Expand All @@ -224,13 +227,16 @@ jobs:
$env:CUDA_PATH = '$(Build.Repository.LocalPath)\cuda_sdk\v$(cuda_version)'
$env:PATH = "$env:CUDA_PATH\bin;$env:CUDA_PATH\extras\CUPTI\lib64;$env:PATH"
Write-Host $env:PATH
python -m pip install -r test/python/requirements-cuda.txt
python -m pip install -r test/python/cuda/torch/requirements.txt
python -m pip install -r test/python/cuda/ort/requirements.txt
}
elseif ("$(ep)" -eq "directml") {
python -m pip install -r test/python/requirements-directml.txt
python -m pip install -r test/python/requirements-torch-directml.txt
python -m pip install -r test/python/requirements-torch-directml.txt
}
else {
python -m pip install -r test/python/requirements-cpu.txt
python -m pip install -r test/python/cpu/torch/requirements.txt
python -m pip install -r test/python/cpu/ort/requirements.txt
}
cd examples\python
python -m pip install --no-index --find-links=$(Build.BinariesDirectory)/wheel $(pip_package_name)
Expand Down
14 changes: 2 additions & 12 deletions src/ort_genai_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,7 @@ OgaResult* OGA_API_CALL OgaTokenizerDecode(const OgaTokenizer* p, const int32_t*
auto string = tokenizer.Decode({tokens, token_count});
auto length = string.length() + 1;
auto cstr_buffer = std::make_unique<char[]>(length);
#if _MSC_VER
strcpy_s(cstr_buffer.get(), length, string.c_str());
#else
strncpy(cstr_buffer.get(), string.c_str(), length);
cstr_buffer[length] = 0;
#endif
memcpy(cstr_buffer.get(), string.c_str(), length);
*out_string = cstr_buffer.release();
return nullptr;
OGA_CATCH
Expand All @@ -390,12 +385,7 @@ OgaResult* OGA_API_CALL OgaProcessorDecode(const OgaMultiModalProcessor* p, cons
auto string = processor.tokenizer_->Decode({tokens, token_count});
auto length = string.length() + 1;
auto cstr_buffer = std::make_unique<char[]>(length);
#if _MSC_VER
strcpy_s(cstr_buffer.get(), length, string.c_str());
#else
strncpy(cstr_buffer.get(), string.c_str(), length);
cstr_buffer[length] = 0;
#endif
memcpy(cstr_buffer.get(), string.c_str(), length);
*out_string = cstr_buffer.release();
return nullptr;
OGA_CATCH
Expand Down
2 changes: 2 additions & 0 deletions test/python/cpu/ort/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-i https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/ORT-Nightly/pypi/simple/
onnxruntime==1.20.0.dev20241017001
2 changes: 2 additions & 0 deletions test/python/cpu/torch/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-f https://download.pytorch.org/whl/torch_stable.html
torch==2.2.1+cpu
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
-f https://download.pytorch.org/whl/torch_stable.html
-i https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/ORT-Nightly/pypi/simple/
torch==2.2.1+cu121
ort-nightly-gpu==1.20.0.dev20241007001
2 changes: 2 additions & 0 deletions test/python/cuda/torch/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-f https://download.pytorch.org/whl/torch_stable.html
torch==2.2.1+cu121
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
-f https://download.pytorch.org/whl/torch_stable.html
-i https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/ORT-Nightly/pypi/simple/
torch==2.2.1+cpu
ort-nightly-directml==1.20.0.dev20241006001
2 changes: 2 additions & 0 deletions test/python/directml/torch/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-f https://download.pytorch.org/whl/torch_stable.html
torch==2.2.1+cpu
2 changes: 2 additions & 0 deletions test/python/macos/ort/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-i https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/ORT-Nightly/pypi/simple/
onnxruntime==1.20.0.dev20241017001
2 changes: 2 additions & 0 deletions test/python/macos/torch/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-f https://download.pytorch.org/whl/torch_stable.html
torch==2.2.1
4 changes: 0 additions & 4 deletions test/python/requirements-cpu.txt

This file was deleted.

4 changes: 0 additions & 4 deletions test/python/requirements-macos.txt

This file was deleted.

0 comments on commit aa5d171

Please sign in to comment.