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

@@ -78,13 +78,28 @@ class NormalizeConfigTestCase(unittest.TestCase):
normalize_config(cfg)
self.assertTrue(cfg.bf16)
self.assertFalse(cfg.fp16)
@patch("axolotl.utils.config.is_torch_bf16_gpu_available")
def test_bf16_auto_setter_not_available(self, mock_bf16_avail):
cfg = self._get_base_cfg()
cfg.bf16 = "auto"
cfg.fp16 = None
mock_bf16_avail.return_value = False
normalize_config(cfg)
self.assertFalse(cfg.bf16)
self.assertTrue(cfg.fp16)
@patch("axolotl.utils.config.is_torch_bf16_gpu_available")
def test_bf16_disables_fp16(self, mock_bf16_avail):
cfg = self._get_base_cfg()
cfg.bf16 = True
cfg.fp16 = False
mock_bf16_avail.return_value = True
normalize_config(cfg)
self.assertTrue(cfg.bf16)
self.assertFalse(cfg.fp16)