mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-09-27 12:52:29 +08:00
[Fix] Fix version function (#3076)
* [Fix] Fix version function * Fix commit * Fix commit * fix code sync * Update coverage_run.sh --------- Co-authored-by: Jiang-Jia-Jun <jiangjiajun@baidu.com>
This commit is contained in:
@@ -24,8 +24,9 @@ os.environ["GLOG_minloglevel"] = "2"
|
||||
os.environ["AISTUDIO_LOG"] = "critical"
|
||||
from fastdeploy.engine.sampling_params import SamplingParams
|
||||
from fastdeploy.entrypoints.llm import LLM
|
||||
from fastdeploy.utils import version
|
||||
|
||||
__all__ = ["LLM", "SamplingParams"]
|
||||
__all__ = ["LLM", "SamplingParams", "version"]
|
||||
|
||||
try:
|
||||
import use_triton_in_paddle
|
||||
|
@@ -23,6 +23,7 @@ from typing import Literal, Optional
|
||||
|
||||
from paddleformers.transformers.configuration_utils import PretrainedConfig
|
||||
|
||||
import fastdeploy
|
||||
from fastdeploy import envs
|
||||
from fastdeploy.model_executor.layers.quantization.quant_base import QuantConfigBase
|
||||
from fastdeploy.utils import check_unified_ckpt, get_logger
|
||||
@@ -866,8 +867,10 @@ class CommitConfig:
|
||||
|
||||
self._load_from_version_file()
|
||||
|
||||
def _load_from_version_file(self, file_path: str = "fastdeploy/version.txt"):
|
||||
def _load_from_version_file(self, file_path: str = None):
|
||||
"""Internal method to load version info from file"""
|
||||
if file_path is None:
|
||||
file_path = os.path.join(fastdeploy.__path__[0], "version.txt")
|
||||
try:
|
||||
with open(file_path, "r") as f:
|
||||
for line in f:
|
||||
|
@@ -587,12 +587,13 @@ def version():
|
||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
version_file_path = os.path.join(current_dir, "version.txt")
|
||||
|
||||
content = "Unknown"
|
||||
try:
|
||||
with open(version_file_path, "r") as f:
|
||||
content = f.read()
|
||||
print(content)
|
||||
except FileNotFoundError:
|
||||
llm_logger.error("[version.txt] Not Found!")
|
||||
return content
|
||||
|
||||
|
||||
llm_logger = get_logger("fastdeploy", "fastdeploy.log")
|
||||
|
@@ -6,7 +6,7 @@ run_path="$DIR/../test/"
|
||||
cd ${run_path}
|
||||
ls
|
||||
|
||||
dirs=("layers" "operators" "worker")
|
||||
dirs=("layers" "operators" "worker" "utils")
|
||||
failed_tests_file="failed_tests.log"
|
||||
> "$failed_tests_file"
|
||||
disabled_tests=(
|
||||
|
13
test/utils/test_version.py
Normal file
13
test/utils/test_version.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import unittest
|
||||
|
||||
import fastdeploy
|
||||
|
||||
|
||||
class TestVersion(unittest.TestCase):
|
||||
def test_get_version(self):
|
||||
ver = fastdeploy.version()
|
||||
assert ver.count("COMMIT") > 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
Reference in New Issue
Block a user