From 1c160dd3a5c7042e120242a90b33080909fa26ff Mon Sep 17 00:00:00 2001 From: fenglui Date: Sun, 21 Jan 2024 05:01:53 +0800 Subject: [PATCH] fix torch_dtype check of export_model Former-commit-id: f7c5b2d105d7dfdb0ddee217e14fd695668f9c34 --- src/llmtuner/train/tuner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/llmtuner/train/tuner.py b/src/llmtuner/train/tuner.py index d61d9a01..2d57f448 100644 --- a/src/llmtuner/train/tuner.py +++ b/src/llmtuner/train/tuner.py @@ -57,7 +57,7 @@ def export_model(args: Optional[Dict[str, Any]] = None): raise ValueError("The model is not a `PreTrainedModel`, export aborted.") setattr(model.config, "use_cache", True) - if getattr(model.config, "torch_dtype", None) == "bfloat16": + if getattr(model.config, "torch_dtype", None) == torch.bfloat16: model = model.to(torch.bfloat16).to("cpu") else: model = model.to(torch.float16).to("cpu")