Import error because no actual libraries, as far as I can tell.
### System Info

Copy-and-paste the text below in your GitHub issue.                                                                                                                      
                                                                                                                                                                         
- huggingface_hub version: 0.11.1                                                                                                                                        
- Platform: Windows-10-10.0.19044-SP0                                                                                                                                    
- Python version: 3.10.5                                                                                                                                                 
- Running in iPython ?: No                                                                                                                                               
- Running in notebook ?: No                                                                                                                                              
- Running in Google Colab ?: No                                                                                                                                          
- Token path ?: C:\Users\name\.huggingface\token                                                                                                                       
- Has saved token ?: False                                                                                                                                               
- Configured git credential helpers: manager-core                                                                                                                        
- FastAI: N/A                                                                                                                                                            
- Tensorflow: 2.9.1                                                                                                                                                      
- Torch: 1.12.1+cu116                                                                                                                                                    
- Jinja2: 3.0.2                                                                                                                                                          
- Graphviz: N/A                                                                                                                                                          
- Pydot: N/A  

Copy-and-paste the text below in your GitHub issue and FILL OUT the two last points.                                                                                     
                                                                                                                                                                         
- `transformers` version: 4.25.1                                                                                                                                         
- Platform: Windows-10-10.0.19044-SP0                                                                                                                                    
- Python version: 3.10.5                                                                                                                                                 
- Huggingface_hub version: 0.11.1                                                                                                                                        
- PyTorch version (GPU?): 1.12.1+cu116 (True)                                                                                                                            
- Tensorflow version (GPU?): 2.9.1 (True)                                                                                                                                
- Flax version (CPU?/GPU?/TPU?): not installed (NA)                                                                                                                      
- Jax version: not installed                                                                                                                                             
- JaxLib version: not installed                                                                                                                                          
- Using GPU in script?: want to yes                                                                                                                                        
- Using distributed or parallel set-up in script?: maybe?... If my understanding of deepspeed is right than I think so.

### Who can help?

@pacman100
@sgugger

### Information

- [ ] The official example scripts
- [X] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [X] My own task or dataset (give details below)

### Reproduction

accelerate config                                             
Traceback (most recent call last):                                                                                                                                       
  File "/home/user/anaconda3/bin/accelerate", line 5, in <module>                                                                                               
    from accelerate.commands.accelerate_cli import main                                                                                                                  
  File "/home/user/anaconda3/lib/python3.6/site-packages/accelerate/__init__.py", line 7, in <module>                                                           
    from .accelerator import Accelerator                                                                                                                                 
  File "/home/user/anaconda3/lib/python3.6/site-packages/accelerate/accelerator.py", line 27, in <module>                                                       
    from .checkpointing import load_accelerator_state, load_custom_state, save_accelerator_state, save_custom_state                                                      
  File "/home/user/anaconda3/lib/python3.6/site-packages/accelerate/checkpointing.py", line 24, in <module>                                                     
    from .utils import (                                                                                                                                                 
  File "/home/user/anaconda3/lib/python3.6/site-packages/accelerate/utils/__init__.py", line 101, in <module>                                                   
    from .megatron_lm import (                                                                                                                                           
  File "/home/user/anaconda3/lib/python3.6/site-packages/accelerate/utils/megatron_lm.py", line 32, in <module>                                                 
    from transformers.modeling_outputs import (                                                                                                                          
  File "/home/user/anaconda3/lib/python3.6/site-packages/transformers/__init__.py", line 30, in <module>                                                        
    from . import dependency_versions_check                                                                                                                              
  File "/home/user/anaconda3/lib/python3.6/site-packages/transformers/dependency_versions_check.py", line 17, in <module>                                       
    from .utils.versions import require_version, require_version_core                                                                                                    
  File "/home/user/anaconda3/lib/python3.6/site-packages/transformers/utils/__init__.py", line 59, in <module>                                                  
    from .hub import (                                                                                                                                                   
  File "/home/user/anaconda3/lib/python3.6/site-packages/transformers/utils/hub.py", line 32, in <module>                                                       
    from huggingface_hub import (                                                                                                                                        
ImportError: cannot import name 'CommitOperationAdd'

The transformers library has in the utils folder, __init__, in this file it has:

      from huggingface_hub import (
          CommitOperationAdd,
          HfFolder,
          create_commit,
          create_repo,
          get_hf_file_metadata,
          hf_hub_download,
          hf_hub_url,
          whoami,
      )

however huggingface_hub doesn't have these files, so am I missing something or is that transformers needs to be updated? I have the latest version and the version from github locally for both huggingface_hub and transformers. Now that I'm looking at it, there seems to be another import mistake that'll be flagged once I get past this one:

      from huggingface_hub.utils import (
          EntryNotFoundError,
          LocalEntryNotFoundError,
          RepositoryNotFoundError,
          RevisionNotFoundError,
          hf_raise_for_status,
      )

Would appreciate any assistance with this, and since Idk if this could be considered a Huggingface_hub error or a transformers error I'll post it on both.

### Expected behavior

I guess I expect to run into the next bug until I've solved all the bugs and can use accelerate and deepspeed, (fingers crossed, knock on wood). For a non tongue and cheek answer I think that according to the code at least it should import from these different libraries and files that is described in the hub.py script, pulled from the huggingface_hub library. Obviously, I could be mistaken, but python isn't having it and I haven't be able to find where, what hub.py wants.
I'm not sure where you are looking but `huggingface_hub` init does have a `CommitOperationAdd` object [here](https://github.com/huggingface/huggingface_hub/blob/ccdfd33ede1500b364d3561ccd6d4b2cc76fe9b2/src/huggingface_hub/__init__.py#L106) and it's been there since 0.10.0 which is the minimal version of huggingface_hub required.<|||||>Is there a way to fix this easily or do I have to go through all of the modules and replace the ones that will try and call huggingface_hub with the modules it should be calling?<|||||>I have no idea what you mean here. The code you mention does not match what is actually in the libraries, so it looks like you should just update them to the latest versions and check that your Python environment is actually using those (and not some random older versions).<|||||>I guess I'm just a little confused because I have transformers version 4.25.1 and huggingface_hub version 0.11.1, I don't have any different versions whether it be Ubuntu or Windows. When I look on Github and go to src/transformers/utils there is a hub.py, and in it as far as I can see has the code that I have shown it wishes to import. When I go to the huggingface_hub __init__ it has the lines in a submodule function that tries to import it as strings.

 Trouble is, why is it going to the __init__, should it not just go to the modules to find the classes it is looking for? Or does __init__ actually serve more of a purpose for that code. After all I've never found Python likes going indirectly through several different messagers, say it calls CommitOperationAdd in hub.py. This goes to __init__ in huggingface_hub, which then goes to .hf_api, which calls from ._commit_api.

 I'd think it'd be easier for hub.py to just call from huggingface_hub import _commit_api. Unless what you're saying is huggingface has a library that doesn't match what is on Github or what you can pip install which in that case, may I have that library?

 I feel like it's more confusing to write out a paragraph about this than it is to just look at the code snippet I provided, however, I can show you the exact code starting from hub.py and maybe even a picture of where I found it located, and do each of these steps all the way to _commit_api. My environment does not want to go any farther until I figure out a way for it to import the class 'CommitOperationAdd'. I just don't know if I told it to grab directly from _commit_api if it'd break the entire program.

I do appreciate you being patient with me and trying to help me figure this out though, don't get me wrong, and whenever you have suggested something I have looked into it. Like today I updated my Ubuntu, Pip, Transformers and Huggingface_hub, although besides Ubuntu everything was up to date.

I may end up having to try and not use DeepSpeed because it just seems to have some pretty big bugs, maybe I'll try DeepSparse.<|||||>Hi @Shikamaru5, sorry not getting back to you before. `huggingface_hub` expose most of its top-level attributes in the `__init__.py` module (`create_commit`, `create_repo`, `CommitOperationAdd`,...). You can see the complete list [here](https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/__init__.py#L310). This is by design so that users don't have to know in which submodule they can find the methods they need. It also guarantees some flexibility for us: as`huggingface_hub._commit_api` should not be imported directly by users (it is "private"), we can make changes to it without caring about backward compatibility as long as the top-level attributes are still in `huggingface_hub/__init__.py`.

What can be confusing when reading the code is that we are doing "lazy-loading". When doing `from huggingface_hub import something`, you are only importing `something` and the modules needed to make it work. This speed-up initialization by a lot since it is very rare that you require all modules at once. If you are interested in reading more about it, please have a look at [this PR](https://github.com/huggingface/huggingface_hub/pull/874).

Now, back to your problem. As @sgugger mentionned that can be caused by a broken environment with older versions of the libs. For example here it seems that you are using Python 3.10 (which is good) but the anaconda path seems to be referring to Python 3.6 (`"/home/user/anaconda3/lib/python3.6/site-packages/transformers/utils/hub.py"`). Could that be the cause of your issue?

In any case, I guarantee you that once you have a clean environment both lines should load correctly in your Python interpreter:
```py
from huggingface_hub import CommitOperationAdd
from transformers.utils.hub import CommitOperationAdd
```<|||||>I'm doing this all locally but before, when my wsl was working, I had got it working by just directly importing from the places I needed to import from. You are correct about the python 3.6 because once I got past that issue it said python 3.6 was bad so I tried to get python fixed, broke all of it, uninstalled wsl and Ubuntu, and now for some reason after a few days of trying and even having someone who used to work on Ubuntu for wsl, on Twitter trying to help me fix it, I haven't been able to do it. My next thought is I've found a program called Colossal AI and I'm going to see if that'll work instead of trying DeepSpeed or DeepSparse. Thank you for taking the time to check out my issue and see how you can help it's really appreciated.<|||||>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](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.