noamaanMulla-03/transformers-issues huggingface dataset:
[`Docs`] fixed minor typo
Author: j-gc
Pull request: yes

# What does this PR do?
It fixes a minor typo in quantization.md

## Before submitting
- [x] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).


Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_29555). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
fixed ImportError: cannot import name 'hf_bucket_url' on convert_pytorch_checkpoint_to_tf2.py
Author: mohataher
Pull request: yes

So I installed the latest version of transformers on Google Colab 

    !pip install transformers 

When trying to invoke the conversion file using 

    !python /usr/local/lib/python3.6/dist-packages/transformers/convert_pytorch_checkpoint_to_tf2.py .py --help  

Or trying to use 

    from transformers.file_utils import hf_bucket_url.                                 // works 
    from transformers.convert_pytorch_checkpoint_to_tf2 import *.                      // fails

    convert_pytorch_checkpoint_to_tf("gpt2", pytorch_file, config_file, tf_file).      


I get this error

     ImportError                               Traceback (most recent call last)

    <ipython-input-3-dadaf83ecea0> in <module>()
          1 from transformers.file_utils import hf_bucket_url
    ----> 2 from transformers.convert_pytorch_checkpoint_to_tf2 import *
          3 
          4 convert_pytorch_checkpoint_to_tf("gpt2", pytorch_file, config_file, tf_file)
    /usr/local/lib/python3.6/dist-packages/transformers/convert_pytorch_checkpoint_to_tf2.py in <module>()
         20 import os
         21 
    ---> 22 from transformers import (
         23     ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
         24     BERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
    
    ImportError: cannot import name 'hf_bucket_url'


Turns out, there's a problem in the import of `hf_bucket_url`. Once fixed, the code ran properly. 

Comments:
`from transformers.file_utils import default_cache_path, hf_bucket_url`
I want to import hf_bucket_url on Colab, but I still got the error
"ImportError: cannot import name 'hf_bucket_url' from 'transformers.file_utils' (/usr/local/lib/python3.9/dist-packages/transformers/file_utils.py)"
Am I do something wrong?

from transformers.file_utils import default_cache_path, hf_bucket_url
I want to import hf_bucket_url on Colab, but I still got the error
"ImportError: cannot import name 'hf_bucket_url' from 'transformers.file_utils' (/usr/local/lib/python3.9/dist-packages/transformers/file_utils.py)"
Am I do something wrong?

@ther-0319 `hf_bucket_url` was removed in #18497 ~1.5 years ago. You can use `cached_file` instead
[Docs] Fix FastSpeech2Conformer model doc links
Author: khipp
Pull request: yes

# What does this PR do?
This PR fixes the links to the FastSpeech2 Conformer model documentation in the README files.

## Before submitting
- [x] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).


Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_29574). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Don't use a subset in test fetcher if on `main` branch
Author: ydshieh
Pull request: yes

# What does this PR do?

[I don't like surprise, like you do I guess] 😉 

Don't select a subset from the detected tests to run when they are many - if we are on the main branch.
This could detect any issue as early as at the merge time, not at the nightly run.


Comments:
Let me know if you want me to explore the option to block a PR being merged if the last commit message is not of the form 

> [no_filter] xxx yyy 

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_28816). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@ArthurZucker I think this PR is good to preventing the surprising failures on CircleCI.
Add missing localized READMEs to the copies check
Author: khipp
Pull request: yes

# What does this PR do?

This PR adds missing localized READMEs to the copies check and fixes inconsistencies in the lists of model architectures.

## Before submitting

- [x] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).


Comments:
Hi @khipp, thanks for opening this PR! 

This highlights a larger issue with `README_de.md` as all of these models should have been added to this page when the models were added. It's better to address this (why isn't the german readme being updated) than manually adding here. 

@amyeroberts Thank you for pointing out the utility script. I've added the missing checks and updated the PR accordingly.

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_29575). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Fixed broken link
Author: amritgupta98
Pull request: yes

# What does this PR do?

Fixed broken link in BERT documentation (bert.md): Resources -> Token Classification -> Finetuning BERT for named-entity


## Before submitting
- [x] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).


## Who can review?
@MKhalusova @stevhliu 

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_29558). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
TFBertModel: InvalidArgumentError.__init__() missing 2 required positional arguments: 'op' and 'message'
Author: tomigee
Pull request: no

### System Info

- `transformers` version: 4.38.2
- Platform: macOS-14.1.1-arm64-arm-64bit
- Python version: 3.10.13
- Huggingface_hub version: 0.20.2
- Safetensors version: 0.4.2
- Accelerate version: not installed
- Accelerate config: not found
- PyTorch version (GPU?): not installed (NA)
- Tensorflow version (GPU?): 2.15.0 (True)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: Yes, I'm on an M2 Mac
- Using distributed or parallel set-up in script?: Yes

### Who can help?

@ArthurZucker @younesbelkada 

### 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

Hi Hugging Face team,
First off thanks for the work you do. Here's my issue:
When I try to create a TFBertModel with a BertConfig object, it errors out on me

**Environment information**
Operating System: macOS Sonoma 14.1.1

```python
from transformers import TFBertModel, BertConfig
configuration = BertConfig(max_position_embeddings=2048)
bert = TFBertModel.from_pretrained("bert-base-uncased", config=configuration)
```

The returned error traceback is located in this [gist.](https://gist.github.com/tomigee/6c5b39629305463d9799b8ae5e5548b9)

### Expected behavior

A TFBertModel is created with no errors

**Additional context**
I reproduced this error on Google Colab, so it's not platform specific.

Comments:
Hi @tomigee, thanks for raising this issue! 

Three comments: 
* The canonical checkpoints have been deprecated, so all models should have an org identifier. In this case, it's advisable to use `google-bert/bert-base-uncased` instead of `bert-base-uncased` 
* To change a parameter of a pretrained model, you should pass that directly to the model's from_pretrained call. This will ensure the correct config is loaded for that checkpoint: the default values for `BertConfig` may not match those in `google-bert/bert-base-uncased` checkpoint. Doing it this way will avoid any unexpected behaviours e.g. some weights not loading.
* This is happening because you're modifying the default embedding size, by trying to load in the old weights which have a different shape. You need to set `ignore_mismatched_sizes=True`

The following works when I run on `main`:

```py
from transformers import TFBertModel
bert = TFBertModel.from_pretrained("bert-base-uncased", max_position_embeddings=2048, ignore_mismatched_sizes=True)
```





Hi @amyeroberts,

Thanks for resolving! I guessed the issue had something to do with the way I was instantiating the `TFBertModel`, but I had no clue where to start debugging as the error message wasn't particularly helpful 😅. Thanks again, issue resolved.
WARNING - __main__ -   Process rank: -1, device: cuda, n_gpu: 2, distributed training: False, 16-bits training: True
Author: keloemma
Pull request: no

I am trying to use the script run_glue to fintenue Flaubert for french data using huggingface's transformers and I am gettinh this error :

`

03/27/2020 11:54:48 - WARNING - __main__ -   Process rank: -1, device: cuda, n_gpu: 2, distributed training: False, 16-bits training: True
Traceback (most recent call last):
  File "/home/getalp/kelodjoe/transformers/examples/run_glue.py", line 693, in <module>
    main()
  File "/home/getalp/kelodjoe/transformers/examples/run_glue.py", line 613, in main
    config_class, model_class, tokenizer_class = MODEL_CLASSES[args.model_type]
KeyError: 'flaubert'

`

Could you help me find how to solve it ?


Comments:
？how to solve it

could you tell me how to solve this problem?
Fix Fuyu doc typos
Author: zucchini-nlp
Pull request: yes

# What does this PR do?

As the title says, it fixes a couple of typos in Fuyu docs

## Before submitting
- [X] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [ ] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#create-a-pull-request),
      Pull Request section?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


## Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@gante 

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_29601). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Fix minor typo: softare => software
Author: DriesVerachtert
Pull request: yes

No code is changed: just a minor typo fixed in a markdown file.


Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_29602). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Stop passing None to compile() in TF examples
Author: Rocketknight1
Pull request: yes

TensorFlow used to accept a value of `None` for the optimizer argument in `compile()`, as long as you didn't actually try to `fit()` the resulting model, but now it doesn't. This PR passes a dummy `sgd` optimizer instead to avoid that issue.

It also reworks the sample invocation given for `run_text_classification.py` to avoid confusion.

Fixes #29584


Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_29597). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Fix typo (determine)
Author: koayon
Pull request: yes

# What does this PR do?

No code changes: just a minor typo fixed in the configuration_mamba.py file

<!--
Congratulations! You've made it this far! You're not quite done yet though.

Once merged, your PR is going to appear in the release notes with the title you set, so make sure it's a great title that fully reflects the extent of your awesome contribution.

Then, please replace this with a description of the change and which issue is fixed (if applicable). Please also include relevant motivation and context. List any dependencies (if any) that are required for this change.

Once you're done, someone will review your PR shortly (see the section "Who can review?" below to tag some potential reviewers). They may suggest changes to make the code even better. If no one reviewed your PR after a week has passed, don't hesitate to post a new comment @-mentioning the same persons---sometimes notifications get lost.
-->

<!-- Remove if not applicable -->

## Before submitting
- [x] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).

## Who can review?

@ArthurZucker

<!-- Your PR 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:

- text models: @ArthurZucker and @younesbelkada
- vision models: @amyeroberts
- speech models: @sanchit-gandhi
- graph models: @clefourrier

Library:

- flax: @sanchit-gandhi
- generate: @gante
- pipelines: @Narsil
- tensorflow: @gante and @Rocketknight1
- tokenizers: @ArthurZucker
- trainer: @muellerzr and @pacman100

Integrations:

- deepspeed: HF Trainer/Accelerate: @pacman100
- ray/raytune: @richardliaw, @amogkam
- Big Model Inference: @SunMarc
- quantization (bitsandbytes, autogpt): @SunMarc and @younesbelkada

Documentation: @stevhliu and @MKhalusova

HF projects:

- accelerate: [different repo](https://github.com/huggingface/accelerate)
- datasets: [different repo](https://github.com/huggingface/datasets)
- diffusers: [different repo](https://github.com/huggingface/diffusers)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Maintained examples (not research project or legacy):

- Flax: @sanchit-gandhi
- PyTorch: See Models above and tag the person corresponding to the modality of the example.
- TensorFlow: @Rocketknight1

 -->


Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_29606). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Set env var to hold Keras at Keras 2
Author: Rocketknight1
Pull request: yes

Newer versions of TF use the environment variable `TF_USE_LEGACY_KERAS` to decide whether to use Keras 2 or Keras 3. We set this immediately in `modeling_tf_utils` to make sure that no Keras 3 objects sneak in - this should hopefully fix a lot of user scripts that are using `tf.keras` instead of `keras` or `tf-keras` as well.

Fixes #29470

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_29598). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Support for `add_pooling_layer` in transformers.TFBertModel
Author: tomigee
Pull request: no
Labels: name: Feature request

### Feature request

HuggingFace transformers currently support the `add_pooling_layer` argument in the initialization of a `transformers.BertModel` object [as shown here](https://huggingface.co/docs/transformers/model_doc/bert#transformers.BertModel), supported by PyTorch. My request is simply to extend this support to `transformers.BertModel`'s Tensorflow counterpart, `transformers.TFBertModel`.

### Motivation

I'm working on a model right now that leverages the pretrained `bert-base-uncased` model as an encoder to generate features, which are in turn fed into a decoder via cross-attention. As it currently stands, the TF implementation of `bert-base-uncased` available via HuggingFace has a pooling layer that condenses its output from shape `(batch, seq_length, hidden_dim)` to `(batch, 1, hidden_dim)`. While this is fine for simpler models that only attach an output head, it's problematic for more complex models in at least two ways:

1. The dimension reduction very likely leads to information loss within the model
2. When connecting this model to a decoder via cross-attention, it would be nice if the decoder could attend to individual tokens as it sees fit, as opposed to one, singular,  pooled token. In fact this was the implementation of the very first transformer from "Attention is All You Need", and is a rather important detail in the implementation in my opinion.

Given that `transformers.BertModel` already supports this, I'm hoping this is a rather easy implementation.

### Your contribution

Yes, I'm happy to help. Just let me know if this is a feature that you folks are willing to include, and if you'd like my help in doing so.

Comments:
Hi @tomigee, 

Sounds like a good idea - we want our TF and pytorch models to be as similar as possible. Feel free to open a PR and tag me and @Rocketknight1 for review! 

Yes, agreed! This is an oversight, and it's definitely worth fixing. Note that the `TFBertMainLayer` class already supports this argument, so all you need to do is ensure that it gets correctly passed from `TFBertModel`.

Done, see #29603
Add Keras Core (Keras 3.0) support
Author: Rocketknight1
Pull request: yes

This PR is a very-very-very work in progress effort to add Keras Core support, and to prepare for the transition to Keras 3.0. Because Keras Core is still a beta/preview, this PR is likely to be fairly slow and cautious, we don't want to lock ourselves into an API that may change under our feet!

The goal of this PR is to create a "minimum viable port(duct)" of our `tf.keras` code to `keras-core` to assess how difficult it will be to support Keras Core. Therefore, this port has the following properties:

- Only loading from `safetensors` will be supported for now, so I don't have to support every possible combination of (weights_format, model_framework)
- All mixins like `GenerationMixin` will be inherited directly from the framework that corresponds to the active `keras-core` framework. This means that `keras-core` classes will change their inheritance depending on which framework is live, which is risky but greatly reduces the amount of code I need to write.
- We will mainly be supporting TF and JAX as Keras Core frameworks. All of our models have PyTorch code already, which will probably be more stable and better-tested than using Keras Core + PyTorch, so I doubt we'd see much usage there. In addition, TF and JAX fit Keras Core's assumptions much more naturally than PyTorch does.

The plan for this PR is:
- [x] Create `modeling_keras_outputs.py` (ported from `modeling_tf_outputs.py`)
- [ ] Create `modeling_keras_utils.py` (ported from `modeling_tf_utils.py`)
- [ ] Port a single model to keras-core (probably BERT or DistilBERT)
- [ ] Add model tests to ensure that outputs match 
- [ ] Improve support for our data classes, like supporting BatchEncoding in `fit()` or auto-wrapping HF datasets in a Keras `PyDataset`

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_26224). All of your documentation changes will be reflected on that endpoint.

Don't stale yet!

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.

Hey @Rocketknight1 I would like to work on this. Is HF still looking forward to have Keras 3.0 integrated?
Update flava tests
Author: ydshieh
Pull request: yes

# What does this PR do?

#29446 causes some flava tests failing. I think it's just the difference between the contributor's machine and our CI runners.

This PR updates some expected values.

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_29611). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Implemented add_pooling_layer arg to TFBertModel
Author: tomigee
Pull request: yes

# What does this PR do?
This PR implements support for the `add_pooling_layer` argument in the initialization of transformers.TFBertModel. Rationale behind this is, not only is the exclusion of a pooling layer already supported for the PyTorch counterpart (`transformers.BertModel`), this provides the user access to an uncondensed output of dimension `(batch, seq_length, hidden_dim)` instead of the pooled output of dimension `(batch, 1, hidden_dim)` for more complex downstream use.

Fixes Issue [#29567](https://github.com/huggingface/transformers/issues/29567)


## Who can review?
@amyeroberts @Rocketknight1 


Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_29603). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Also @tomigee, there may be other models in the codebase where we're not exposing `add_pooling_layer` in TF even though it's available in Torch. You don't have to, but if you want to make a big PR to update all of them to match Torch, we'd definitely be interested! Maybe it'd be possible to find them with a script?

@Rocketknight1 I can look into it.

Btw, I tried following your [contribution guide](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) to the letter but some of the commands didn't work quite right (for example, `make repo-consistency` returns `IndexError: tuple index out of range`). Also the command you have on [your website](https://huggingface.co/docs/transformers/pr_checks) to run automatically collected tests (`python -m pytest -n 8 --dist=loadfile -rA -s $(cat test_list.txt)`) that are impacted by a PR didn't work for me either. I can create a separate issue for these, but just wanted to provide a heads up.

Thanks again for all the work you're doing!

Hm, `make repo-consistency` should work, we use it all the time! Have you tried `pip install transformers[quality]` to make sure you have the tools you need for it? If that still doesn't fix it, can you open an issue with the full error and trace you get, and we'll try to investigate?

> Have you tried `pip install transformers[quality]` to make sure you have the tools you need for it?

Yep, specifically I ran `pip install -e ".[quality]"` which I'm guessing does the same thing as `pip install transformers[quality]` but let me know if that's wrong.

Opened an issue, see #29613 . I'll tag you in it too.





That should work, yes! I'm not sure why it's failing for you.