Skip to content

enable flash mistral model for HPU device #594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions backends/python/server/text_embeddings_server/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from text_embeddings_server.models.masked_model import MaskedLanguageModel
from text_embeddings_server.models.default_model import DefaultModel
from text_embeddings_server.models.classification_model import ClassificationModel
from text_embeddings_server.models.flash_mistral import FlashMistral
from text_embeddings_server.utils.device import get_device, use_ipex

__all__ = ["Model"]
Expand Down Expand Up @@ -89,6 +90,22 @@ def get_model(model_path: Path, dtype: Optional[str], pool: str):
pool,
trust_remote=TRUST_REMOTE_CODE,
)
elif config.model_type == "mistral" and device.type == "hpu":
try:
return FlashMistral(
model_path,
device,
datatype,
pool,
)
except FileNotFoundError as e:
return DefaultModel(
model_path,
device,
datatype,
pool,
trust_remote=TRUST_REMOTE_CODE,
)
else:
if device.type == "hpu":
from habana_frameworks.torch.hpu import wrap_in_hpu_graph
Expand Down
Loading
Loading