huggingface / transformers

🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.
https://huggingface.co/transformers
Apache License 2.0
131.93k stars 26.27k forks source link

ImportError: cannot import name 'CommitOperationAdd' from 'huggingface_hub' #20471

Closed wccccp closed 1 year ago

wccccp commented 1 year ago

System Info

PS C:\Users\46213> transformers-cli env Traceback (most recent call last): File "C:\Users\46213\anaconda3\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\46213\anaconda3\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\46213\anaconda3\Scripts\transformers-cli.exe__main.py", line 4, in File "C:\Users\46213\anaconda3\lib\site-packages\transformers__init__.py", line 30, in from . import dependency_versions_check File "C:\Users\46213\anaconda3\lib\site-packages\transformers\dependency_versions_check.py", line 17, in from .utils.versions import require_version, require_version_core File "C:\Users\46213\anaconda3\lib\site-packages\transformers\utils__init__.py", line 48, in from .hub import ( File "C:\Users\46213\anaconda3\lib\site-packages\transformers\utils\hub.py", line 32, in from huggingface_hub import ( ImportError: cannot import name 'CommitOperationAdd' from 'huggingface_hub' (C:\Users\46213\anaconda3\lib\site-packages\huggingface_hub\init__.py)

Who can help?

@LysandreJik @sgugger

Information

Tasks

Reproduction

PS C:\Users\46213> pip show huggingface_hub Name: huggingface-hub Version: 0.10.1 Summary: Client library to download and publish models, datasets and other repos on the huggingface.co hub Home-page: https://github.com/huggingface/huggingface_hub Author: Hugging Face, Inc. Author-email: julien@huggingface.co License: Apache Location: c:\users\46213\anaconda3\lib\site-packages Requires: requests, typing-extensions, tqdm, pyyaml, packaging, filelock Required-by: transformers, ltp, evaluate, datasets

Expected behavior

my transformer don‘t run ,please help me

sgugger commented 1 year ago

There seems to be an installation problem with huggingface_hub. You should try to uninstall and re-install it in your environment.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

mausch commented 8 months ago

Just ran into this issue. I looked up the commit adding CommitOperationAdd, it's https://github.com/huggingface/huggingface_hub/commit/b6145e74b73bbd4a74dc00562e2b3f5e331066f4 . Which means you need huggingface_hub >= 0.9.0

PawKanarek commented 5 months ago

I have the same problem and i have version 0.22.2

    from huggingface_hub import CommitOperationAdd, SpaceHardware, SpaceStage
ImportError: cannot import name 'CommitOperationAdd' from 'huggingface_hub' (/home/raix/miniconda3/envs/bittensor/lib/python3.10/site-packages/huggingface_hub/__init__.py)
(bittensor) raix@raix-pc:~/git/fain$ python 
Python 3.10.13 (main, Sep 11 2023, 13:44:35) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import huggingface_hub
>>> print(huggingface_hub.__version__)
0.22.2
>>>