Skip to content

Commit

Permalink
modify
Browse files Browse the repository at this point in the history
  • Loading branch information
ivy-lv11 committed Jun 3, 2024
1 parent 64449ad commit 3e1dd3c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions libs/community/langchain_community/llms/ipex_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,15 @@ def _load_model(

_tokenizer_id = tokenizer_id or model_id
# Set "cpu" as default device
if "device" not in model_kwargs:
model_kwargs["device"] = "cpu"
if "device" not in _model_kwargs:
_model_kwargs["device"] = "cpu"

if model_kwargs["device"] not in ["cpu", "xpu"]:
if _model_kwargs["device"] not in ["cpu", "xpu"]:
raise ValueError(
"IpexLLMBgeEmbeddings currently only supports device to be "
f"'cpu' or 'xpu', but you have: {model_kwargs['device']}."
f"'cpu' or 'xpu', but you have: {_model_kwargs['device']}."
)
device = model_kwargs.pop("device")
device = _model_kwargs.pop("device")

try:
tokenizer = AutoTokenizer.from_pretrained(_tokenizer_id, **_model_kwargs)
Expand Down

0 comments on commit 3e1dd3c

Please sign in to comment.