Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
Lmdeploy
Commits
0a017e5c
You need to sign in or sign up before continuing.
Commit
0a017e5c
authored
Nov 22, 2023
by
xiabo
Browse files
版本号修改
parent
40e07381
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
4 deletions
+63
-4
lmdeploy/__init__.py
lmdeploy/__init__.py
+1
-0
lmdeploy/version.py
lmdeploy/version.py
+2
-2
setup.py
setup.py
+60
-2
No files found.
lmdeploy/__init__.py
View file @
0a017e5c
# Copyright (c) OpenMMLab. All rights reserved.
# Copyright (c) OpenMMLab. All rights reserved.
from
.version
import
*
def
bootstrap
():
def
bootstrap
():
import
os
import
os
import
sys
import
sys
...
...
lmdeploy/version.py
View file @
0a017e5c
# Copyright (c) OpenMMLab. All rights reserved.
# Copyright (c) OpenMMLab. All rights reserved.
from
typing
import
Tuple
from
typing
import
Tuple
__dcu_version__
=
'0.0.13'
__version__
=
'0.0.13'
__version__
=
'0.0.13'
short_version
=
__version__
short_version
=
__version__
...
@@ -27,4 +27,4 @@ def parse_version_info(version_str: str) -> Tuple:
...
@@ -27,4 +27,4 @@ def parse_version_info(version_str: str) -> Tuple:
version_info
=
parse_version_info
(
__version__
)
version_info
=
parse_version_info
(
__version__
)
__all__
=
[
'__version__'
,
'version_info'
,
'parse_version_info'
]
__all__
=
[
'__version__'
,
'__dcu_version__'
,
'version_info'
,
'parse_version_info'
]
setup.py
View file @
0a017e5c
...
@@ -4,6 +4,11 @@ import sys
...
@@ -4,6 +4,11 @@ import sys
from
setuptools
import
find_packages
,
setup
from
setuptools
import
find_packages
,
setup
import
subprocess
from
typing
import
Optional
,
Union
from
pathlib
import
Path
import
torch
pwd
=
os
.
path
.
dirname
(
__file__
)
pwd
=
os
.
path
.
dirname
(
__file__
)
version_file
=
'lmdeploy/version.py'
version_file
=
'lmdeploy/version.py'
...
@@ -14,10 +19,63 @@ def readme():
...
@@ -14,10 +19,63 @@ def readme():
return
content
return
content
def
get_sha
(
pytorch_root
:
Union
[
str
,
Path
])
->
str
:
try
:
return
subprocess
.
check_output
([
'git'
,
'rev-parse'
,
'HEAD'
],
cwd
=
pytorch_root
).
decode
(
'ascii'
).
strip
()
except
Exception
:
return
'Unknown'
def
get_abi
():
try
:
command
=
"echo '#include <string>' | gcc -x c++ -E -dM - | fgrep _GLIBCXX_USE_CXX11_ABI"
result
=
subprocess
.
run
(
command
,
shell
=
True
,
capture_output
=
True
,
text
=
True
)
output
=
result
.
stdout
.
strip
()
abi
=
"abi"
+
output
.
split
(
" "
)[
-
1
]
return
abi
except
Exception
:
return
'abiUnknown'
def
get_version_add
(
sha
:
Optional
[
str
]
=
None
)
->
str
:
version
=
''
lmdeploy_root
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
add_version_path
=
os
.
path
.
join
(
os
.
path
.
join
(
lmdeploy_root
,
"lmdeploy"
),
"version.py"
)
if
sha
!=
'Unknown'
:
if
sha
is
None
:
sha
=
get_sha
(
lmdeploy_root
)
version
=
'git'
+
sha
[:
7
]
# abi
version
+=
"."
+
get_abi
()
# dtk version
if
os
.
getenv
(
"ROCM_PATH"
):
rocm_path
=
os
.
getenv
(
'ROCM_PATH'
,
""
)
rocm_version_path
=
os
.
path
.
join
(
rocm_path
,
'.info'
,
"rocm_version"
)
with
open
(
rocm_version_path
,
'r'
,
encoding
=
'utf-8'
)
as
file
:
lines
=
file
.
readlines
()
rocm_version
=
lines
[
0
][:
-
2
].
replace
(
"."
,
""
)
version
+=
".dtk"
+
rocm_version
# torch version
version
+=
".torch"
+
torch
.
__version__
[:
4
]
lines
=
[]
with
open
(
add_version_path
,
'r'
,
encoding
=
'utf-8'
)
as
file
:
lines
=
file
.
readlines
()
lines
[
2
]
=
"__dcu_version__ = '0.0.13+{}'
\n
"
.
format
(
version
)
with
open
(
add_version_path
,
encoding
=
"utf-8"
,
mode
=
"w"
)
as
file
:
file
.
writelines
(
lines
)
file
.
close
()
def
get_version
():
def
get_version
():
with
open
(
os
.
path
.
join
(
pwd
,
version_file
),
'r'
)
as
f
:
get_version_add
()
version_file
=
'lmdeploy/version.py'
with
open
(
version_file
,
encoding
=
'utf-8'
)
as
f
:
exec
(
compile
(
f
.
read
(),
version_file
,
'exec'
))
exec
(
compile
(
f
.
read
(),
version_file
,
'exec'
))
return
locals
()[
'__version__'
]
return
locals
()[
'__
dcu_
version__'
]
def
check_ext_modules
():
def
check_ext_modules
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment