fix from_pretrained when device_map=None (#10361)

* pr trigger

* fix error when device_map=None

* fix device_map=None
This commit is contained in:
Chen, Zhentao 2024-03-11 16:06:12 +08:00 committed by GitHub
parent d7b765fd3f
commit a425eaabfc
2 changed files with 2 additions and 2 deletions

View file

@ -185,7 +185,7 @@ jobs:
# set --limit if it's pr-triggered to accelerate pr action # set --limit if it's pr-triggered to accelerate pr action
if ${{github.event_name == 'pull_request'}}; then if ${{github.event_name == 'pull_request'}}; then
export LIMIT="--limit 4" export LIMIT="--limit 6"
fi fi
python run_llb.py \ python run_llb.py \

View file

@ -145,7 +145,7 @@ class _BaseAutoModelClass:
invalidInputError(model_hub in ["huggingface", "modelscope"], invalidInputError(model_hub in ["huggingface", "modelscope"],
"The parameter `model_hub` is supposed to be `huggingface` or " "The parameter `model_hub` is supposed to be `huggingface` or "
f"`modelscope`, but got {model_hub}.") f"`modelscope`, but got {model_hub}.")
invalidInputError(not ('device_map' in kwargs and 'xpu' in kwargs['device_map']), invalidInputError(not (kwargs.get('device_map') and 'xpu' in kwargs['device_map']),
"Please do not use `device_map` " "Please do not use `device_map` "
"with `xpu` value as an argument. " "with `xpu` value as an argument. "
"Use model.to('xpu') instead.") "Use model.to('xpu') instead.")