Fix device_map bug by raise an error when using device_map=xpu (#10340)
* Fix device_map bug by raise an error when using device_map=xpu * Fix sync error * Fix python style * Use invalidInputError instead of invalidOperationError
This commit is contained in:
parent
db00e79cdf
commit
7a621a4db0
1 changed files with 4 additions and 0 deletions
|
|
@ -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":
|
||||
|
|
|
|||
Loading…
Reference in a new issue