Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable or disable bf16 support based on availability #1116

Merged
merged 4 commits into from
Jan 14, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/axolotl/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ def normalize_config(cfg):
cfg.device_map = {"": int(os.environ.get("LOCAL_RANK", 0))}
cfg.batch_size = cfg.batch_size * cfg.world_size

if cfg.bf16 == "auto":
if is_torch_bf16_gpu_available():
LOG.info("bf16 support detected, enabling for this configuration.")
simhallq marked this conversation as resolved.
Show resolved Hide resolved
cfg.bf16 = True
else:
LOG.info("bf16 support not detected, disabling for this configuration.")
cfg.bf16 = False

if cfg.device == "mps":
cfg.load_in_8bit = False
cfg.tf32 = False
Expand Down