Skip to content

Commit

Permalink
[Bugfix] Add logs for all model dtype casting (vllm-project#4717)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgoin authored and tjohnson31415 committed May 16, 2024
1 parent df54be8 commit 475b9a0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions vllm/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,7 @@ def _get_and_verify_dtype(
if config_dtype == torch.float32:
# Following the common practice, we use float16 for float32
# models.
logger.info("Casting torch.float32 to torch.float16.")
torch_dtype = torch.float16
else:
torch_dtype = config_dtype
Expand All @@ -1087,9 +1088,11 @@ def _get_and_verify_dtype(
if torch_dtype != config_dtype:
if torch_dtype == torch.float32:
# Upcasting to float32 is allowed.
logger.info("Upcasting %s to %s.", config_dtype, torch_dtype)
pass
elif config_dtype == torch.float32:
# Downcasting from float32 to float16 or bfloat16 is allowed.
logger.info("Downcasting %s to %s.", config_dtype, torch_dtype)
pass
else:
# Casting between float16 and bfloat16 is allowed with a warning.
Expand Down

0 comments on commit 475b9a0

Please sign in to comment.