From 7db0f2e29af6e45d927faba00eaedc37edbd057c Mon Sep 17 00:00:00 2001 From: calpt Date: Mon, 15 Apr 2024 10:13:03 +0000 Subject: [PATCH] Switch resolving order if source not specified in `load_adapter()` --- src/adapters/utils.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/adapters/utils.py b/src/adapters/utils.py index 1dbe06cf24..2ba009e0e5 100644 --- a/src/adapters/utils.py +++ b/src/adapters/utils.py @@ -717,15 +717,15 @@ def resolve_adapter_path( return pull_from_hf_model_hub(adapter_name_or_path, version=version, **kwargs) elif source is None: try: - logger.info("Attempting to load adapter from source 'ah'...") - return pull_from_hub( - adapter_name_or_path, model_name, adapter_config=adapter_config, version=version, **kwargs - ) - except EnvironmentError as ex: - logger.info(ex) logger.info("Attempting to load adapter from source 'hf'...") + return pull_from_hf_model_hub(adapter_name_or_path, version=version, **kwargs) + except (EnvironmentError, ValueError) as ex: + logger.info(ex) + logger.info("Attempting to load adapter from source 'ah'...") try: - return pull_from_hf_model_hub(adapter_name_or_path, version=version, **kwargs) + return pull_from_hub( + adapter_name_or_path, model_name, adapter_config=adapter_config, version=version, **kwargs + ) except Exception as ex: logger.info(ex) raise EnvironmentError(