set fp16 to false if bf16, update bf16: auto in example YAMLs (#1122) [skip ci]

* set fp16 to false if bf16, update bf16: auto in example YAMLs

* unset fp16 so that it fallsback properly if bf16 isn't available

* Update README.md [skip-ci]

Co-authored-by: NanoCode012 <kevinvong@rocketmail.com>

* test that bf16 disables fp16

---------

Co-authored-by: NanoCode012 <kevinvong@rocketmail.com>
This commit is contained in:
Wing Lian
2024-01-22 18:44:01 -05:00
committed by GitHub
parent eaaeefce55
commit 782b6a4216
38 changed files with 86 additions and 67 deletions

View File

@@ -70,6 +70,8 @@ def normalize_config(cfg):
else:
LOG.debug("bf16 support not detected, disabling for this configuration.")
cfg.bf16 = False
if cfg.fp16 is None:
cfg.fp16 = True
if cfg.device == "mps":
cfg.load_in_8bit = False
@@ -79,6 +81,8 @@ def normalize_config(cfg):
cfg.bf16 = False
else:
torch.backends.cuda.matmul.allow_tf32 = cfg.tf32 or False
if cfg.bf16:
cfg.fp16 = False
if cfg.bf16 or cfg.bfloat16:
cfg.torch_dtype = torch.bfloat16