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

ImportError with language and style_or_domain arguments and huggingface-hub 0.26 #135

Closed
carschno opened this issue Oct 18, 2024 · 2 comments · Fixed by #136
Closed

ImportError with language and style_or_domain arguments and huggingface-hub 0.26 #135

carschno opened this issue Oct 18, 2024 · 2 comments · Fixed by #136

Comments

@carschno
Copy link
Contributor

I get an ImportError when I use the language and style_or_domain parameters upon initializing a SaT model when using the most recent version huggingface-hub version (0.26.x), which is installed by default:

% pip install -U wtpsplit
[...]
Successfully installed wtpsplit-2.1.0
>>> import wtpsplit
>>> wtpsplit.SaT("sat-3l-sm", language="en", style_or_domain="-")
[...]
ImportError: cannot import name 'url_to_filename' from 'huggingface_hub.file_download' (.../.venv/lib/python3.11/site-packages/huggingface_hub/file_download.py)

The initialization does work without the additional arguments:

>>> wtpsplit.SaT("sat-3l-sm")
<wtpsplit.SaT at 0x103111b90>

The error does not appear with older huggingface-hub versions (<= 0.25):

% pip install huggingface-hub==0.25
[...]
Successfully installed huggingface-hub-0.25.0
>>> import wtpsplit
>>> wtpsplit.SaT("sat-3l-sm", language="en", style_or_domain="-")
LoRA -/en not found, using base model...
<wtpsplit.SaT at 0x174abc450>

This is on Mac Os with Python 3.11, but seems to occur across OS's and Python versions.

% python --version
Python 3.11.2
@carschno
Copy link
Contributor Author

carschno commented Oct 21, 2024

See e.g. this run for failing build.

The fix in #136 makes the build pass again.

@markus583
Copy link
Collaborator

Thanks for catching this! Indeed, I can reproduce this issue. This comes from the adapters library which we use for loading LoRA modules, and there also exists an issue for their library: #750

It could take some time until the fix will end up in their pypi version, so I will go ahead and merge your PR. Thanks for contributing!
Once their fix ended up in pypi, we should remove fixing the huggingface-hub version again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants