From f782c5728f7b1b0acb76e606c43ed6083b3b200e Mon Sep 17 00:00:00 2001 From: Tom Aarsen Date: Tue, 3 Dec 2024 11:20:00 +0100 Subject: [PATCH] Fix breaking change in PyLate when loading modules --- sentence_transformers/SentenceTransformer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sentence_transformers/SentenceTransformer.py b/sentence_transformers/SentenceTransformer.py index 830564a57..ba02f8bfa 100644 --- a/sentence_transformers/SentenceTransformer.py +++ b/sentence_transformers/SentenceTransformer.py @@ -1559,8 +1559,8 @@ def _load_module_class_from_ref( revision=revision, code_revision=code_revision, ) - except OSError: - # Ignore the error if the file does not exist, and fall back to the default import + except (OSError, ValueError): + # Ignore the error if 1) the file does not exist, or 2) the class_ref is not correctly formatted/found pass return import_from_string(class_ref)