diff --git a/sentence_transformers/trainer.py b/sentence_transformers/trainer.py index b71d8f8bb..d8ba6710f 100644 --- a/sentence_transformers/trainer.py +++ b/sentence_transformers/trainer.py @@ -498,8 +498,8 @@ def _load_best_model(self) -> None: if not isinstance(self.model[0], Transformer): logger.info("Could not load best model, as the model is not a `transformers`-based model.") return - elif isinstance(self.model[0].auto_model, PeftAdapterMixin): - logger.info("Could not load best model, as the model is a `PeftAdapterMixin`-based model. Please wait for an update of the transformers library to enable this feature.") + elif len(self.model[0].auto_model.active_adapters()): + logger.info("Could not load best model, as the model has at least one adapter set. Please wait for an update of the transformers library to enable this feature.") return try: