Skip to content

Commit 2ca6898

Browse files
committed
deploy: 527594f
1 parent fde120d commit 2ca6898

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

onnx.sh

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -87,27 +87,19 @@ function makeOnnxFiles () {
8787
if [ ! -d "${WORK_DIR}/onnx" ]; then
8888
git clone https://github.com/onnx/onnx.git "${WORK_DIR}/onnx"
8989
fi
90-
export PYENV_ROOT="${WORK_DIR}/.pyenv"
91-
PYENV="${PYENV_ROOT}/bin/pyenv"
92-
PYENV_PYTHON_VERSION=3.12.9
93-
if [ ! -d "${PYENV_ROOT}" ]; then
94-
git clone https://github.com/pyenv/pyenv.git "${PYENV_ROOT}"
95-
pushd "${PYENV_ROOT}"
96-
src/configure && make -C src
97-
popd
98-
99-
sudo apt update
100-
sudo apt -y install build-essential libssl-dev zlib1g-dev \
101-
libbz2-dev libreadline-dev libsqlite3-dev curl \
102-
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
103-
"$PYENV" install "$PYENV_PYTHON_VERSION"
90+
UV_PROJECT_NAME=onnx_test_create
91+
PYTHON_VERSION=3.13.9
92+
if ! command -v uv >/dev/null 2>&1; then
93+
curl -LsSf https://astral.sh/uv/install.sh | sh
10494
fi
105-
eval "$(${PYENV} init --path)"
106-
"$PYENV" local "$PYENV_PYTHON_VERSION"
107-
pip install --upgrade pip
108-
pip install --no-cache black numpy onnx
109-
pip install --no-cache torch --index-url https://download.pytorch.org/whl/cpu
110-
black "${TEST_ONNX_DIR}"
95+
if [ ! -d "${WORK_DIR}/${UV_PROJECT_NAME}" ]; then
96+
uv init -p ${PYTHON_VERSION} ${UV_PROJECT_NAME}
97+
fi
98+
cd "${WORK_DIR}/${UV_PROJECT_NAME}"
99+
uv add --index https://download.pytorch.org/whl/cpu torch
100+
uv add numpy onnx onnxscript ruff
101+
uv run ruff check --fix "${TEST_ONNX_DIR}"
102+
uv run ruff format "${TEST_ONNX_DIR}"
111103

112104
rm -f "${TEST_ONNX_DIR}"/**/*.onnx
113105
rm -f "${TEST_ONNX_DIR}"/*.onnx
@@ -151,7 +143,7 @@ if len(failed_scripts) > 0:
151143
sys.exit(1)
152144
EOS
153145

154-
python "${WORK_DIR}/create_onnx.py"
146+
uv run "${WORK_DIR}/create_onnx.py"
155147
}
156148

157149
if [ $TEST_MODE -eq 0 ]; then

0 commit comments

Comments
 (0)