From 294fec68f788ace8aea8a2b1b189c0f0d1a9139e Mon Sep 17 00:00:00 2001 From: Tom Aarsen Date: Wed, 4 Dec 2024 12:17:34 +0100 Subject: [PATCH] Also try to load a 'dynamic module' if not trust-remote, but local model --- sentence_transformers/SentenceTransformer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sentence_transformers/SentenceTransformer.py b/sentence_transformers/SentenceTransformer.py index 15cf36cba..f2d38cc31 100644 --- a/sentence_transformers/SentenceTransformer.py +++ b/sentence_transformers/SentenceTransformer.py @@ -1554,7 +1554,7 @@ def _load_module_class_from_ref( if class_ref.startswith("sentence_transformers."): return import_from_string(class_ref) - if trust_remote_code: + if trust_remote_code or os.path.exists(model_name_or_path): code_revision = model_kwargs.pop("code_revision", None) if model_kwargs else None try: return get_class_from_dynamic_module(