Skip to content

Commit a5ae88d

Browse files
authored
[feature]add fd whl version info (#2698)
1 parent 87e6384 commit a5ae88d

File tree

5 files changed

+33
-201
lines changed

5 files changed

+33
-201
lines changed

build.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,21 @@ function build_and_install() {
176176
cd ..
177177
}
178178

179+
function version_info() {
180+
output_file="fastdeploy/version.txt"
181+
fastdeploy_git_commit_id=$(git rev-parse HEAD)
182+
paddle_version=$(${python} -c "import paddle; print(paddle.__version__)")
183+
paddle_git_commit_id=$(${python} -c "import paddle; print(paddle.version.show())" | grep -Po "(?<=commit: )[\da-f]+")
184+
cuda_version=$(nvcc -V | grep -Po "(?<=release )[\d.]+(?=, V)")
185+
cxx_version=$(g++ --version | head -n 1 | grep -Po "(?<=\) )[\d.]+")
186+
187+
echo "fastdeploy GIT COMMIT ID: $fastdeploy_git_commit_id" > $output_file
188+
echo "Paddle version: $paddle_version" >> $output_file
189+
echo "Paddle GIT COMMIT ID: $paddle_git_commit_id" >> $output_file
190+
echo "CUDA version: $cuda_version" >> $output_file
191+
echo "CXX compiler version: $cxx_version" >> $output_file
192+
}
193+
179194
function cleanup() {
180195
rm -rf $BUILD_DIR $EGG_DIR
181196
if [ `${python} -m pip list | grep fastdeploy | wc -l` -gt 0 ]; then
@@ -207,6 +222,7 @@ if [ "$BUILD_WHEEL" -eq 1 ]; then
207222
set -e
208223

209224
init
225+
version_info
210226
build_and_install_ops
211227
build_and_install
212228
cleanup
@@ -237,6 +253,7 @@ if [ "$BUILD_WHEEL" -eq 1 ]; then
237253
else
238254
init
239255
build_and_install_ops
256+
version_info
240257
rm -rf $BUILD_DIR $EGG_DIR $DIST_DIR
241258
rm -rf $OPS_SRC_DIR/$BUILD_DIR $OPS_SRC_DIR/$EGG_DIR
242259
fi

fastdeploy/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
os.environ["GLOG_minloglevel"] = "2"
2323
# suppress log from aistudio
2424
os.environ["AISTUDIO_LOG"] = "critical"
25+
from fastdeploy.utils import version
2526
from fastdeploy.engine.sampling_params import SamplingParams
2627
from fastdeploy.entrypoints.llm import LLM
2728

fastdeploy/utils.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,19 @@ def is_list_of(
562562

563563
assert_never(check)
564564

565+
def version():
566+
"""
567+
Prints the contents of the version.txt file located in the parent directory of this script.
568+
"""
569+
current_dir = os.path.dirname(os.path.abspath(__file__))
570+
version_file_path = os.path.join(current_dir, 'version.txt')
571+
572+
try:
573+
with open(version_file_path, 'r') as f:
574+
content = f.read()
575+
print(content)
576+
except FileNotFoundError:
577+
llm_logger.error("[version.txt] Not Found!")
565578

566579
llm_logger = get_logger("fastdeploy", "fastdeploy.log")
567580
data_processor_logger = get_logger("data_processor", "data_processor.log")

scripts/build_wheel_pipeline_cu123.sh

Lines changed: 0 additions & 200 deletions
This file was deleted.

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ def get_name():
189189
"model_executor/ops/xpu/libs/*",
190190
"model_executor/ops/npu/*", "model_executor/ops/base/*",
191191
"model_executor/models/*", "model_executor/layers/*",
192-
"input/mm_processor/utils/*"
192+
"input/mm_processor/utils/*",
193+
"version.txt"
193194
]
194195
},
195196
install_requires=load_requirements(),

0 commit comments

Comments
 (0)