diff --git a/src/axolotl/utils/bench.py b/src/axolotl/utils/bench.py index d19e81ecdc..30f0985e75 100644 --- a/src/axolotl/utils/bench.py +++ b/src/axolotl/utils/bench.py @@ -28,7 +28,7 @@ def gpu_memory_usage_smi(device=0): def log_gpu_memory_usage(log, msg, device): - if not torch.cuda.is_available(): + if not torch.cuda.is_available() or device == "auto": return (0, 0, 0) usage, cache, misc = gpu_memory_usage_all(device) diff --git a/src/axolotl/utils/config.py b/src/axolotl/utils/config.py index 6de807eab9..a1fe85d597 100644 --- a/src/axolotl/utils/config.py +++ b/src/axolotl/utils/config.py @@ -25,7 +25,9 @@ def get_device(): return "cpu" cfg.device = get_device() - if cfg.device_map != "auto": + if cfg.world_size == 1: + cfg.device_map = "auto" + else: if cfg.device.startswith("cuda"): cfg.device_map = {"": cfg.local_rank} else: