Skip to content

Commit

Permalink
fix: dont change quant storage dtype in case of fsdp (#1837)
Browse files Browse the repository at this point in the history
* fix: dont change quant storage dtype in case of fsdp

* fix black

---------

Co-authored-by: Gal Cohen <[email protected]>
  • Loading branch information
xgal and Gal Cohen authored Aug 20, 2024
1 parent e299312 commit 5aac4bc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/axolotl/utils/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,9 @@ def load_model(
"bnb_4bit_quant_type": "nf4",
"bnb_4bit_quant_storage": torch.bfloat16,
}
if cfg.model_config_type in ["jamba", "qwen2_moe"] and not cfg.deepspeed:
if cfg.model_config_type in ["jamba", "qwen2_moe"] and not (
cfg.deepspeed or cfg.fsdp
):
# for some reason, this causes the loss to be off by an order of magnitude
# but deepspeed needs this still in bfloat16
bnb_config["bnb_4bit_quant_storage"] = torch.float32
Expand Down

0 comments on commit 5aac4bc

Please sign in to comment.