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

add bf16 check #587

Merged
merged 4 commits into from
Sep 17, 2023
Merged
Changes from 1 commit
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
9 changes: 9 additions & 0 deletions src/axolotl/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os

import torch
from transformers.utils import is_torch_bf16_gpu_available
winglian marked this conversation as resolved.
Show resolved Hide resolved

from axolotl.utils.bench import log_gpu_memory_usage
from axolotl.utils.models import load_model_config
Expand Down Expand Up @@ -88,6 +89,14 @@ def normalize_config(cfg):


def validate_config(cfg):
if is_torch_bf16_gpu_available():
if not cfg.bf16 and not cfg.bfloat16:
LOG.info("bf16 support detected, but not enabled for this configuration.")
else:
if cfg.bf16 or cfg.bfloat16:
raise ValueError(
"bf16 requested, but not available on this GPU. Requires 30XX series or above."
winglian marked this conversation as resolved.
Show resolved Hide resolved
)
if cfg.max_packed_sequence_len and cfg.sample_packing:
raise ValueError(
"please set only one of max_packed_sequence_len (deprecated soon) or sample_packing"
Expand Down
Loading