Skip to content

Commit 01b74cd

Browse files
committed
DRAFT upgrade to python 3.10
on-going draft to use upgrade to python 3.10. Signed-off-by: SaeHie Park <[email protected]>
1 parent 8b583ea commit 01b74cd

20 files changed

+196
-45
lines changed

.github/workflows/run-onecc-build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ jobs:
4949
include:
5050
- ubuntu_code: focal
5151
ubuntu_ver: 20.04
52+
python_exec: python3.10
5253
- ubuntu_code: jammy
5354
ubuntu_ver: 22.04
55+
python_exec: python3
5456
runs-on: one-x64-linux
5557
container:
5658
image: samsungonedev.azurecr.io/nnfw/one-devtools:${{ matrix.ubuntu_code }}

compiler/common-artifacts/CMakeLists.txt

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
#[[ Generate common python virtual enviornment ]]
2-
# NOTE find_package try to use at least python3.8 as follows depending on platform version
3-
# Ubuntu18.04; explictly installed python3.8 (default is python3.6)
4-
# Ubuntu20.04; default python3.8
2+
# NOTE find_package try to use at least python3.10 as follows depending on platform version
3+
# Ubuntu20.04; explictly installed python3.10 (default is python3.8)
54
# Ubuntu22.04; default python3.10
65
# Ubuntu24.04; default python3.12
76
# refer https://github.com/Samsung/ONE/issues/9962
8-
# find python 3.8 or above
9-
find_package(Python 3.8 EXACT COMPONENTS Interpreter QUIET)
7+
# refer https://github.com/Samsung/ONE/issues/15226
8+
# find python 3.10 or above
9+
find_package(Python 3.10 EXACT COMPONENTS Interpreter QUIET)
1010
if(NOT Python_FOUND)
11-
find_package(Python 3.8 COMPONENTS Interpreter QUIET)
11+
find_package(Python 3.10 COMPONENTS Interpreter QUIET)
1212
endif()
1313

1414
if(NOT Python_Interpreter_FOUND)
1515
message(STATUS "Build common-artifacts: FAILED (Python3 is missing)")
1616
return()
1717
endif()
1818

19-
# NOTE assume only use 3.8.x or 3.10.x or 3.12.x
20-
if((Python_VERSION VERSION_GREATER_EQUAL 3.8) AND (Python_VERSION VERSION_LESS 3.9))
21-
set(PYTHON_VERSION_MINOR 8)
22-
elseif((Python_VERSION VERSION_GREATER_EQUAL 3.10) AND (Python_VERSION VERSION_LESS 3.11))
19+
# NOTE assume only use 3.10.x or 3.12.x
20+
if((Python_VERSION VERSION_GREATER_EQUAL 3.10) AND (Python_VERSION VERSION_LESS 3.11))
2321
set(PYTHON_VERSION_MINOR 10)
2422
elseif((Python_VERSION VERSION_GREATER_EQUAL 3.12) AND (Python_VERSION VERSION_LESS 3.13))
2523
set(PYTHON_VERSION_MINOR 12)
@@ -48,8 +46,8 @@ set(REQUIREMENTS_FILE "requirements.txt")
4846
set(REQUIREMENTS_OVERLAY_PATH "${VIRTUALENV_OVERLAY}/${REQUIREMENTS_FILE}")
4947

5048
set(PYTHON_OVERLAY python3)
51-
if(PYTHON_EXECUTABLE MATCHES python3.8)
52-
set(PYTHON_OVERLAY python3.8)
49+
if(PYTHON_EXECUTABLE MATCHES python3.10)
50+
set(PYTHON_OVERLAY python3.10)
5351
endif()
5452

5553
# NOTE when using behind proxy with self signed certificate, need to set '--trusted-host' options

compiler/dalgona/CMakeLists.txt

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
# NOTE find_package will try to use at least python3.8 as follows depending on platform version
2-
# Ubuntu18.04; explictly installed python3.8 (default is python3.6)
3-
# Ubuntu20.04; default python3.8
1+
# NOTE find_package will try to use at least python3.10 as follows depending on platform version
2+
# Ubuntu20.04; explictly installed python3.10 (default is python3.8)
43
# Ubuntu22.04; default python3.10
54
# Ubuntu24.04; default python3.12
65
# refer https://github.com/Samsung/ONE/issues/9962
6+
# refer https://github.com/Samsung/ONE/issues/15226
77
# NOTE Require same python version of common-artifacts
8-
# find python 3.8 or above
9-
find_package(Python 3.8 EXACT COMPONENTS Interpreter Development QUIET)
8+
# find python 3.10 or above
9+
find_package(Python 3.10 EXACT COMPONENTS Interpreter Development QUIET)
1010
if(NOT Python_FOUND)
11-
find_package(Python 3.8 COMPONENTS Interpreter Development QUIET)
11+
find_package(Python 3.10 COMPONENTS Interpreter Development QUIET)
1212
endif()
1313

1414
if(NOT Python_Development_FOUND)
1515
message(STATUS "Build dalgona: FAILED (Python3 development package is missing)")
1616
return()
1717
endif()
1818

19-
# NOTE assume only use 3.8.x or 3.10.x or 3.12.x
20-
if((Python_VERSION VERSION_GREATER_EQUAL 3.8) AND (Python_VERSION VERSION_LESS 3.9))
21-
set(PYTHON_VERSION_MINOR 8)
22-
elseif((Python_VERSION VERSION_GREATER_EQUAL 3.10) AND (Python_VERSION VERSION_LESS 3.11))
19+
# NOTE assume only use 3.10.x or 3.12.x
20+
if((Python_VERSION VERSION_GREATER_EQUAL 3.10) AND (Python_VERSION VERSION_LESS 3.11))
2321
set(PYTHON_VERSION_MINOR 10)
2422
elseif((Python_VERSION VERSION_GREATER_EQUAL 3.12) AND (Python_VERSION VERSION_LESS 3.13))
2523
set(PYTHON_VERSION_MINOR 12)

compiler/one-cmds/CMakeLists.txt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
1-
# NOTE find_package try to use at least python3.8 as follows depending on platform version
2-
# Ubuntu18.04; explictly installed python3.8 (default is python3.6)
3-
# Ubuntu20.04; default python3.8
1+
# NOTE find_package will try to use at least python3.10 as follows depending on platform version
2+
# Ubuntu20.04; explictly installed python3.10 (default is python3.8)
43
# Ubuntu22.04; default python3.10
54
# Ubuntu24.04; explicitly installed python3.8 (default is python3.12)
65
# refer https://github.com/Samsung/ONE/issues/9962
7-
find_package(Python 3.8 EXACT COMPONENTS Interpreter QUIET)
6+
# refer https://github.com/Samsung/ONE/issues/15226
7+
find_package(Python 3.10 EXACT COMPONENTS Interpreter QUIET)
88
if(NOT Python_FOUND)
9-
find_package(Python 3.8 COMPONENTS Interpreter QUIET)
9+
find_package(Python 3.10 COMPONENTS Interpreter QUIET)
1010
endif()
1111

1212
if(NOT Python_Interpreter_FOUND)
1313
message(STATUS "Build one-cmds: FAILED (Python3 is missing)")
1414
return()
1515
endif()
1616

17-
# NOTE assume only use 3.8.x or 3.10.x or 3.12.x
17+
# NOTE assume only use 3.10.x or 3.12.x
1818
# NOTE PYTHON_VERSION_MINOR is not used but added for consistancy with common-artifacts and dalgona
19-
if((Python_VERSION VERSION_GREATER_EQUAL 3.8) AND (Python_VERSION VERSION_LESS 3.9))
20-
set(PYTHON_VERSION_MINOR 8)
21-
elseif((Python_VERSION VERSION_GREATER_EQUAL 3.10) AND (Python_VERSION VERSION_LESS 3.11))
19+
if((Python_VERSION VERSION_GREATER_EQUAL 3.10) AND (Python_VERSION VERSION_LESS 3.11))
2220
set(PYTHON_VERSION_MINOR 10)
2321
elseif((Python_VERSION VERSION_GREATER_EQUAL 3.12) AND (Python_VERSION VERSION_LESS 3.13))
2422
set(PYTHON_VERSION_MINOR 12)

compiler/one-cmds/one-prepare-venv

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,26 @@ VER_PROTOBUF=4.23.3
6969
VER_NUMPY=1.24.3
7070

7171
PYTHON_VER=$(${PYTHON3_EXEC} -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')" )
72-
echo "Setting package version for python $PYTHON_VER"
73-
if [[ "$PYTHON_VER" == "3.8" ]]; then
74-
: # use as is
75-
elif [[ "$PYTHON_VER" == "3.10" ]]; then
76-
: # TODO change vesions
72+
if [[ "$PYTHON_VER" == "3.10" ]]; then
73+
VER_TENSORFLOW=2.19.0
74+
VER_ONNX=1.18.0
75+
VER_ONNXRUNTIME=1.21.1
76+
VER_TORCH="2.7.0+cpu"
77+
VER_NUMPY="1.26.4"
78+
VER_PROTOBUF="5.29.4"
79+
VER_TF_PROB=0
80+
VER_TF_ADON=0
81+
VER_ONNX_TF=0
7782
elif [[ "$PYTHON_VER" == "3.12" ]]; then
78-
: # TODO change vesions
83+
VER_TENSORFLOW=2.19.0
84+
VER_ONNX=1.18.0
85+
VER_ONNXRUNTIME=1.21.1
86+
VER_TORCH="2.7.0+cpu"
87+
VER_NUMPY="1.26.4"
88+
VER_PROTOBUF="5.29.4"
89+
VER_TF_PROB=0
90+
VER_TF_ADON=0
91+
VER_ONNX_TF=0
7992
else
8093
echo "Error one-prepare-venv: Unsupported python $PYTHON_VER"
8194
exit 1
@@ -110,15 +123,22 @@ ${VENV_PYTHON} -m pip ${PIP_OPTIONS} install --upgrade pip setuptools
110123

111124
PYTHON_PACKAGES="tensorflow-cpu==${VER_TENSORFLOW} "
112125
PYTHON_PACKAGES+="Pillow "
113-
PYTHON_PACKAGES+="tensorflow_probability==${VER_TF_PROB} "
114-
PYTHON_PACKAGES+="tensorflow_addons==${VER_TF_ADON} "
115126
PYTHON_PACKAGES+="torch==${VER_TORCH} "
116127
PYTHON_PACKAGES+="onnx==${VER_ONNX} "
117128
PYTHON_PACKAGES+="onnxruntime==${VER_ONNXRUNTIME} "
118-
PYTHON_PACKAGES+="onnx-tf==${VER_ONNX_TF} "
119129
PYTHON_PACKAGES+="protobuf==${VER_PROTOBUF} "
120130
PYTHON_PACKAGES+="fsspec==2024.6.1 "
121131
PYTHON_PACKAGES+="pydot==${VER_PYDOT} "
122132
PYTHON_PACKAGES+="numpy==${VER_NUMPY} "
123133

134+
if [[ "${VER_TF_PROB}" != "0" ]]; then
135+
PYTHON_PACKAGES+="tensorflow_probability==${VER_TF_PROB} "
136+
fi
137+
if [[ "${VER_TF_ADON}" != "0" ]]; then
138+
PYTHON_PACKAGES+="tensorflow_addons==${VER_TF_ADON} "
139+
fi
140+
if [[ "${VER_ONNX_TF}" != "0" ]]; then
141+
PYTHON_PACKAGES+="onnx-tf==${VER_ONNX_TF} "
142+
fi
143+
124144
${VENV_PYTHON} -m pip ${PIP_OPTIONS} install --upgrade ${PYTHON_PACKAGES} ${TORCH_SOURCE_OPTION}

compiler/one-cmds/tests/one-import-bcq_neg_001.test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ trap_err_onexit()
2626
exit 0
2727
fi
2828

29+
# TF 2.9.0
30+
if grep -q "refers to a Tensor which does not exist" "${filename}.log"; then
31+
echo "${filename_ext} SUCCESS"
32+
exit 0
33+
fi
34+
2935
echo "${filename_ext} FAILED"
3036
exit 255
3137
}

compiler/one-cmds/tests/one-import-bcq_neg_002.test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ trap_err_onexit()
2626
exit 0
2727
fi
2828

29+
# TF 2.9.0
30+
if grep -q "refers to a Tensor which does not exist" "${filename}.log"; then
31+
echo "${filename_ext} SUCCESS"
32+
exit 0
33+
fi
34+
2935
echo "${filename_ext} FAILED"
3036
exit 255
3137
}

compiler/one-cmds/tests/one-import-bcq_neg_006.test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ trap_err_onexit()
2626
exit 0
2727
fi
2828

29+
# TF 2.9.0
30+
if grep -q "ValueError: Shapes must be equal rank" "${filename}.log"; then
31+
echo "${filename_ext} SUCCESS"
32+
exit 0
33+
fi
34+
2935
echo "${filename_ext} FAILED"
3036
exit 255
3137
}

compiler/one-cmds/tests/one-import-bcq_neg_007.test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ trap_err_onexit()
2626
exit 0
2727
fi
2828

29+
# TF 2.9.0
30+
if grep -q "ValueError: Dimension 0 in both shapes must be equal" "${filename}.log"; then
31+
echo "${filename_ext} SUCCESS"
32+
exit 0
33+
fi
34+
2935
echo "${filename_ext} FAILED"
3036
exit 255
3137
}

compiler/one-cmds/tests/one-import_neg_001.test

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ trap_err_onexit()
3030
echo "${filename_ext} SUCCESS"
3131
exit 0
3232
fi
33+
# TF 2.19.0: error report has changed
34+
if grep -q "Unable to parse input file" "${filename}.log"; then
35+
echo "${filename_ext} SUCCESS"
36+
exit 0
37+
fi
3338

3439
echo "${filename_ext} FAILED"
3540
exit 255

0 commit comments

Comments
 (0)