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
99f4156f
Unverified
Commit
99f4156f
authored
Dec 18, 2023
by
q.yao
Committed by
GitHub
Dec 18, 2023
Browse files
Fix cuda reinitialization in a multiprocessing setting (#862)
parent
20d8f47a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
+14
-8
lmdeploy/turbomind/deploy/target_model/base.py
lmdeploy/turbomind/deploy/target_model/base.py
+14
-8
No files found.
lmdeploy/turbomind/deploy/target_model/base.py
View file @
99f4156f
...
@@ -83,12 +83,18 @@ class TurbomindModelConfig:
...
@@ -83,12 +83,18 @@ class TurbomindModelConfig:
return
True
return
True
_WEIGHT_DTYPE_MAP
=
dict
(
def
_weight_dtype_map
(
weight_type
:
str
,
default
=
None
):
"""get weight dtype map."""
_WEIGHT_DTYPE_MAP
=
dict
(
int4
=
torch
.
float16
,
int4
=
torch
.
float16
,
fp16
=
torch
.
float16
,
fp16
=
torch
.
float16
,
fp32
=
torch
.
float16
,
fp32
=
torch
.
float16
,
bf16
=
torch
.
bfloat16
if
torch
.
cuda
.
is_bf16_supported
()
else
torch
.
float16
,
bf16
=
torch
.
bfloat16
)
if
torch
.
cuda
.
is_bf16_supported
()
else
torch
.
float16
,
)
return
_WEIGHT_DTYPE_MAP
.
get
(
weight_type
,
default
)
class
BaseOutputModel
(
ABC
):
class
BaseOutputModel
(
ABC
):
...
@@ -153,7 +159,7 @@ class BaseOutputModel(ABC):
...
@@ -153,7 +159,7 @@ class BaseOutputModel(ABC):
if
self
.
to_file
:
if
self
.
to_file
:
if
torch
.
is_floating_point
(
param
):
if
torch
.
is_floating_point
(
param
):
torch_type
=
_
WEIGHT_DTYPE_MAP
.
get
(
self
.
cfg
.
weight_type
,
torch_type
=
_
weight_dtype_map
(
self
.
cfg
.
weight_type
,
torch
.
float16
)
torch
.
float16
)
param
=
param
.
to
(
torch_type
)
param
=
param
.
to
(
torch_type
)
tprint
(
name
,
param
.
shape
)
tprint
(
name
,
param
.
shape
)
...
...
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