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: cannot import name 'ModelFilter' from 'huggingface_hub' while importing from nemo.collections.asr.models import EncDecMultiTaskModel #9793

Closed
byColton opened this issue Jul 18, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@byColton
Copy link

I am attempting to use the tutorial code found on huggingface's ''. While importing from nemo.collections.asr.models import EncDecMultiTaskModel I produce the following code. ImportError: cannot import name 'ModelFilter' from 'huggingface_hub'. I have matched the HF package in the requirements documents.

File --------------------lib/python3.10/site-packages/nemo/core/classes/common.py:31
29 import torch
30 import wrapt
---> 31 from huggingface_hub import HfApi, HfFolder, ModelFilter, hf_hub_download
32 from huggingface_hub.hf_api import ModelInfo
33 from omegaconf import DictConfig, OmegaConf

ImportError: cannot import name 'ModelFilter' from 'huggingface_hub'

@byColton byColton added the bug Something isn't working label Jul 18, 2024
@rtaylo45
Copy link

NeMo is notorious for not pinning their versions (huggingface_hub>=0.20.3 in requirements.txt). huggingface_hub released an new version 2 days ago (release notes). That might be whats causing the issue, especially if you did a fresh install of the nemo-toolkit from pip. I recommend doing a forced reinstall of huggingface_hub to its previous version and see if that helps.

I am also running into this problem but at the time of writing this message, I have not tried out the recommended solution. Hope this helps!

@M-Usman-Dev
Copy link

This issue is likely caused by a version mismatch between the nemo_toolkit and the huggingface_hub package.

ModelFilter and DatasetFilter are completely removed

By matching the huggingface_hub version to 0.22.0, I was able to resolve the import error. If you are using nemo_toolkit==1.23.0, this version of huggingface_hub should work.

I hope this helps others facing the same issue!

@vygodisgreat
Copy link

vygodisgreat commented Aug 1, 2024

When I install huggingface-hub==0.22.0 it says

ImportError: huggingface-hub>=0.23.2,<1.0 is required for a normal functioning of this module, but found huggingface-hub==0.22.0.
Try: pip install transformers -U or pip install -e '.[dev]' if you're working with git main

I guess you could use huggingface-hub==0.23.2, so that it works

Cognitohazard added a commit to Cognitohazard/whisper-diarization that referenced this issue Aug 20, 2024
@mtanana
Copy link

mtanana commented Aug 21, 2024

Thanks @vygodisgreat - that fix worked for me (huggingface-hub==0.23.2)

@BierDav
Copy link

BierDav commented Oct 18, 2024

Again it doesn't work with the out of the box version (huggingface-hub==0.23.2) works though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants