diff --git a/python/llm/src/bigdl/llm/transformers/model.py b/python/llm/src/bigdl/llm/transformers/model.py index daa420ce..248d61a9 100644 --- a/python/llm/src/bigdl/llm/transformers/model.py +++ b/python/llm/src/bigdl/llm/transformers/model.py @@ -145,6 +145,10 @@ class _BaseAutoModelClass: invalidInputError(model_hub in ["huggingface", "modelscope"], "The parameter `model_hub` is supposed to be `huggingface` or " f"`modelscope`, but got {model_hub}.") + invalidInputError(not ('device_map' in kwargs and 'xpu' in kwargs['device_map']), + "Please do not use `device_map` " + "with `xpu` value as an argument. " + "Use model.to('xpu') instead.") if model_hub == "huggingface": config_dict, _ = PretrainedConfig.get_config_dict(pretrained_model_name_or_path) elif model_hub == "modelscope":