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
norm
vllm
Commits
c84e9242
Unverified
Commit
c84e9242
authored
May 06, 2023
by
Woosuk Kwon
Committed by
GitHub
May 06, 2023
Browse files
[Minor] Fix a dtype bug (#79)
parent
c9d5b6d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
cacheflow/models/model_utils.py
cacheflow/models/model_utils.py
+5
-1
No files found.
cacheflow/models/model_utils.py
View file @
c84e9242
...
@@ -37,7 +37,11 @@ _MEMORY_ANALYZERS = {
...
@@ -37,7 +37,11 @@ _MEMORY_ANALYZERS = {
def
_get_dtype
(
config
:
PretrainedConfig
,
dtype
:
str
)
->
torch
.
dtype
:
def
_get_dtype
(
config
:
PretrainedConfig
,
dtype
:
str
)
->
torch
.
dtype
:
config_dtype
:
torch
.
dtype
=
getattr
(
config
,
'torch_dtype'
,
torch
.
float32
)
# NOTE: getattr(config, 'torch_dtype', torch.float32) is not correct
# because config.torch_dtype can be None.
config_dtype
=
getattr
(
config
,
'torch_dtype'
,
None
)
if
config_dtype
is
None
:
config_dtype
=
torch
.
float32
if
dtype
==
'default'
:
if
dtype
==
'default'
:
if
config_dtype
==
torch
.
float32
:
if
config_dtype
==
torch
.
float32
:
# Following the common practice, we use float16 for float32 models.
# Following the common practice, we use float16 for float32 models.
...
...
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