Skip to content

Commit d8771f8

Browse files
authored
make a WA in case Bert model do not have safetensor file (#515)
Signed-off-by: Liu, Kaixuan <kaixuan.liu@intel.com>
1 parent b645118 commit d8771f8

File tree

1 file changed

+9
-1
lines changed
  • backends/python/server/text_embeddings_server/models

1 file changed

+9
-1
lines changed

backends/python/server/text_embeddings_server/models/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,15 @@ def get_model(model_path: Path, dtype: Optional[str], pool: str):
6464
return DefaultModel(
6565
model_path, device, datatype, pool, trust_remote=TRUST_REMOTE_CODE
6666
)
67-
return FlashBert(model_path, device, datatype)
67+
try:
68+
return FlashBert(model_path, device, datatype)
69+
except FileNotFoundError as e:
70+
logger.info(
71+
"Do not have safetensors file for this model, use default transformers model path instead"
72+
)
73+
return DefaultModel(
74+
model_path, device, datatype, pool, trust_remote=TRUST_REMOTE_CODE
75+
)
6876
if config.architectures[0].endswith("Classification"):
6977
return ClassificationModel(
7078
model_path, device, datatype, trust_remote=TRUST_REMOTE_CODE

0 commit comments

Comments
 (0)