snapshot_download() got an unexpected keyword argument 'allow_regex'
Author: gnmarten
Pull request: no

## Environment info
<!-- You can run the command `transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->

- `transformers` version: 4.16.0
- Platform: Linux-3.10.0-1160.24.1.el7.ug.x86_64-x86_64-with-glibc2.2.5
- Python version: 3.8.6
- PyTorch version (GPU?): 1.10.1+cu102 (False)
- Tensorflow version (GPU?): 2.7.0 (False)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: not yet (testing)
- Using distributed or parallel set-up in script?: no (but on HPC)
### Who can help
@patrickvonplaten (loading ASR model with kenlm and pyctcdecode)
<!-- Your issue will be replied to more quickly if you can figure out the right person to tag with @
 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.

Models:

- ALBERT, BERT, XLM, DeBERTa, DeBERTa-v2, ELECTRA, MobileBert, SqueezeBert: @LysandreJik
- T5, BART, Marian, Pegasus, EncoderDecoder: @patrickvonplaten
- Blenderbot, MBART: @patil-suraj
- Longformer, Reformer, TransfoXL, XLNet, FNet, BigBird: @patrickvonplaten
- FSMT: @stas00
- Funnel: @sgugger
- GPT-2, GPT: @patrickvonplaten, @LysandreJik
- RAG, DPR: @patrickvonplaten, @lhoestq
- TensorFlow: @Rocketknight1
- JAX/Flax: @patil-suraj
- TAPAS, LayoutLM, LayoutLMv2, LUKE, ViT, BEiT, DEiT, DETR, CANINE: @NielsRogge
- GPT-Neo, GPT-J, CLIP: @patil-suraj
- Wav2Vec2, HuBERT, SpeechEncoderDecoder, UniSpeech, UniSpeechSAT, SEW, SEW-D, Speech2Text: @patrickvonplaten, @anton-l

If the model isn't in the list, ping @LysandreJik who will redirect you to the correct contributor.

Library:

- Benchmarks: @patrickvonplaten
- Deepspeed: @stas00
- Ray/raytune: @richardliaw, @amogkam
- Text generation: @patrickvonplaten @narsil
- Tokenizers: @SaulLu
- Trainer: @sgugger
- Pipelines: @Narsil
- Speech: @patrickvonplaten, @anton-l
- Vision: @NielsRogge, @sgugger

Documentation: @sgugger

Model hub:

- for issues with a model, report at https://discuss.huggingface.co/ and tag the model's creator.

HF projects:

- datasets: [different repo](https://github.com/huggingface/datasets)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Examples:

- maintained examples (not research project or legacy): @sgugger, @patil-suraj

For research projetcs, please ping the contributor directly. For example, on the following projects:

- research_projects/bert-loses-patience: @JetRunner
- research_projects/distillation: @VictorSanh

 -->

## Information

Model I am using (Bert, XLNet ...): 

```
>>> processor = AutoProcessor.from_pretrained("flozi00/wav2vec2-large-xlsr-53-german-with-lm")    
Traceback (most recent call last):    
  File "<stdin>", line 1, in <module>    
  File "/kyukon/scratch/gent/427/vsc42730/hftransformers/transformers_env/lib/python3.8/site-packages/transformers/models/auto/processing_auto.py", line 161, in from_pretrained
    return processor_class.from_pretrained(pretrained_model_name_or_path, **kwargs)
  File "/kyukon/scratch/gent/427/vsc42730/hftransformers/transformers_env/lib/python3.8/site-packages/transformers/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.py", line 174, in from_pretrained
    decoder = BeamSearchDecoderCTC.load_from_hf_hub(
  File "/kyukon/scratch/gent/427/vsc42730/hftransformers/transformers_env/lib/python3.8/site-packages/pyctcdecode/decoder.py", line 757, in load_from_hf_hub
    cached_directory = snapshot_download(model_id, cache_dir=cache_dir, **kwargs)
TypeError: snapshot_download() got an unexpected keyword argument 'allow_regex'
```

The problem arises when using:
* [x] the official example scripts: (give details below)
* [ ] my own modified scripts: (give details below)

```
from transformers import AutoModelForCTC, AutoProcessor
model = AutoModelForCTC.from_pretrained(model_id)
processor = AutoProcessor.from_pretrained(model_id)
```

## To reproduce

Steps to reproduce the behavior:

1. pip install transformers
2. pip install pyctcdecode
3.  pip install https://github.com/kpu/kenlm/archive/master.zip

Possibly related to recent bugfix https://github.com/huggingface/transformers/pull/14881#discussion_r773823212

Similar result with
```
processor = Wav2Vec2ProcessorWithLM.from_pretrained
```
May also result in the following error when trying Wav2Vec2CTCTokenizer as intermediate step
```
TypeError: from_pretrained() takes 2 positional arguments but 3 were given
```
<!-- If you have code snippets, error messages, stack traces please provide them here as well.
     Important! Use code tags to correctly format your code. See https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks#syntax-highlighting
     Do not use screenshots, as they are hard to read and (more importantly) don't allow others to copy-and-paste your code.-->

## Expected behavior

load processor

The current behaviour seems inherited from 
```
from pyctcdecode import BeamSearchDecoderCTC
```
and in accordance with https://github.com/huggingface/transformers/blob/master/src/transformers/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.py



I hope this is the right place to ask after the integration, thanks in advance and keep up the good work
<!-- A clear and concise description of what you would expect to happen. -->


Comments:
Hey @gnmarten,

Could you copy-paste this command and state your` output here: 
```bash
python -c "import huggingface_hub; print(huggingface_hub.__version__)"
```

If your version is lower than 0.4.0 it would be nice if you could upgrade `huggingface_hub`

yes, it was <0.4.0, and after upgrade the download works (with remark "Loading the LM will be faster if you build a binary file.")


Thanks a lot for the fast reaction

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/master/CONTRIBUTING.md) are likely to be ignored.

Hi everyone,
   My huggingface_hub is 0.11.1, and the error 
```
   TypeError: snapshot_download() got an unexpected keyword argument 'local_dir_use_symlinks'
   snapshot_download() got an unexpected keyword argument 'local_dir_use_symlinks'
   snapshot_download() got an unexpected keyword argument 'local_dir'
```
which version should I update to?

Could you upgrade `huggingface_hub` to the newest version? 

Hi everyone,

I got the same error:

[/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_validators.py](https://localhost:8080/#) in _inner_fn(*args, **kwargs)
    116             kwargs = smoothly_deprecate_use_auth_token(fn_name=fn.__name__, has_token=has_token, kwargs=kwargs)
    117 
--> 118         return fn(*args, **kwargs)
    119 
    120     return _inner_fn  # type: ignore

**TypeError: snapshot_download() got an unexpected keyword argument 'allow_regex'**

WIth huggingface_hub being upgraded to the latest version: 0.16.4 
I'm using original version of the colab-tutorial "Boosting Wav2Vec2 with n-grams" (https://huggingface.co/blog/wav2vec2-with-ngram).

Update 03.09.2023: Problem was solved actually by downgrading hugging_face and loading it with a huggingface_hub version of similar age:
!pip install huggingface_hub==0.5.1

I'm getting the same error:

    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
TypeError: snapshot_download() got an unexpected keyword argument 'ignore_files'

I'm on the latest version too