Skip to content

Commit

Permalink
BUG: fix custom embedding launch error (#2016)
Browse files Browse the repository at this point in the history
  • Loading branch information
amumu96 authored Aug 5, 2024
1 parent ec421ed commit 1112993
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions xinference/model/embedding/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ def to(self, *args, **kwargs):

patch_trust_remote_code()
if (
"gte-Qwen2" in self._model_spec.model_id
or "gte-Qwen2" in self._model_spec.model_name
"gte" in self._model_spec.model_name.lower()
and "qwen2" in self._model_spec.model_name.lower()
):
self._model = XSentenceTransformer(
self._model_path,
Expand Down Expand Up @@ -260,8 +260,8 @@ def encode(
device = model._target_device

if (
"gte-Qwen2" not in self._model_spec.model_id
and "gte-Qwen2" not in self._model_spec.model_name
"gte" in self._model_spec.model_name.lower()
and "qwen2" in self._model_spec.model_name.lower()
):
model.to(device)

Expand Down Expand Up @@ -342,8 +342,8 @@ def encode(
return all_embeddings, all_token_nums

if (
"gte-Qwen2" in self._model_spec.model_id
or "gte-Qwen2" in self._model_spec.model_name
"gte" in self._model_spec.model_name.lower()
and "qwen2" in self._model_spec.model_name.lower()
):
all_embeddings, all_token_nums = encode(
self._model,
Expand Down

0 comments on commit 1112993

Please sign in to comment.