Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch resolving order if source not specified in load_adapter() #681

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/adapters/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading