Fix import error for Huggingface-hub version >=0.26.0 & Update Notebooks #750
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR solves an import error, which causes Adapters to not work with huggingface_hub version >= 0.26. This import error comes from HuggingFace removing deprecated functions.
Additionally, I updated all our example notebooks because they were outdated and used the
use_auth_token
parameter that isn't used by Hugging Face anymore.Context for Why This Error Occurred
To download files from repositories, we have the
download_cached(...)
andget_from_cache(...)
functions in src/adapters/utils.py. Hugging Face has used similar methods in the past, too - our get_from_cache is copied from them. Now, Hugging Face uses a new method:hf_hub_download(...)
(huggingface_hub/file_download.py)However, we can't use the new
hf_hub_download(...)
function because it has the validate_hf_hub_args decorator that checks if the arguments are valid. This includes checking if the URL is a Hugging Face repo. Our function, however, also needs to download files from GitHub since we have the mapping between the old AdapterHub adapter paths to the new Hugging Face Hub paths in files that are in GitHub. Therefore, we cannot use the new method and have these methods still copied.