noamaanMulla-03/transformers-issues huggingface dataset:
Fix tf shared embedding
Author: ArthurZucker
Pull request: yes

# What does this PR do?
A hack was used to properly import the shared embedding weights, but it can be removed (removing it also is convenient for the sharding PR) 

Found this while testing #17713. In HF's `save_pretrained` and  `load_pretrained` the layer name is changed using ` name = "/".join(weight_name.split("/")[1:])`. This was breaking for OPT as the layer name was ` 'decoder.embed_tokens/model.decoder.embed_tokens/weight:0'` instead of `'tfopt_model/model/decoder/embed_tokens/weight:0'`. The naming is strange and had to use a scope hack. The hack comes from `BART`

Comments:
All the TF weights of OPT will need to be updated if this is approved. I think I can handle that along with #17713. 


_The documentation is not available anymore as the PR was closed or merged._
Added option to modify config parameter used by Tesseract in LayoutLMV2/LayoutXLM Processor
Author: kelvinAI
Pull request: yes

# What does this PR do?

Giving user option to set config parameter used by Tesseract when performing feature extraction. Eg. to change psm levels while performing transcription by passing in '--psm 10' to config parameter while invoking image_to_data

It is shown that changing the psm values greatly influences the end result of LayoutLMV2/XLM, and the specific psm value is different depending on the document formatting. Refer : [PSM](https://github.com/tesseract-ocr/tesseract/issues/434)

```python
pytesseract.image_to_data(image, lang=lang, output_type="dict", config="--psm 10") 
``` 

Users can now set the tesseract config parameter during Processor initialization, like so:
```python
processor = LayoutLMv2Processor.from_pretrained("microsoft/layoutlmv2-base-uncased", ocr_lang="eng", tesseract_config="--psm 5")
```


## Before submitting
- [❌] 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#start-contributing-pull-requests),
      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?


Feel free to modify as needed.
Thanks

@NielsRogge @LysandreJik 



Comments:
_The documentation is not available anymore as the PR was closed or merged._

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.

Hi,

Sorry for the late reply. I'll review now.

LayoutLMv2FeatureExtractor constructor must be modified to accept tesseract_config instead of tess_config for this change. Hang on, I'll work on it.

Tried to rebase and merge with upstream but it is now changing too many files. I've created a fresh new PR here https://github.com/huggingface/transformers/pull/17733
changing Encoder's embedding table in MarianEncoder
Author: bariluz93
Pull request: no

Hi,
i am trying to change the Encoder's (MarianEncoder) embedding table (self.embed_tokens) during inference.
i tried adding the following lines 

num_tokens, embedding_dim = self.embed_tokens.weight.size()
new_embeddings = nn.Embedding(num_tokens, embedding_dim)
new_embeddings.to(self.embed_tokens.weight.device, dtype=self.embed_tokens.weight.dtype)
self._init_weights(new_embeddings)
new_embeddings.weight.data = Parameter(torch.rand(num_tokens, embedding_dim))
self.set_input_embeddings(new_embeddings)


to MarianEncoder init funcrition
i expect the Bleu of the translations to decrease since i replaced the embedding table with random matrix
but it seems that it doesn't affect the results

can someone explain to me how to change the embedding table?
thanks,
Bar

Comments:
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.
MarianTokenizerFast requested
Author: HuihuiChyan
Pull request: no

### Feature request

Hello I want a MarianTokenizerFast. I am a soldier from Ukrain and we are using the Pretrained MarianMT Models to help translate Russian commands. Currently the tokenizer is too slow so we need a faster one to translate faster! Sometimes it takes 1 second and the missile is already launch so FAST IS NEEDED!

### Motivation

Yesterday Russian launch a missile to attach a hospital in my hometown. We hindered the information and use MarianMT to translate it. But the tokenization is too slow, and we failed to stop the missile, and a lot of people die.

### Your contribution

We can give you a Medal of Honor after we won the war.

Comments:
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.
Test DataLoader never uses multiple workers
Author: greg2451
Pull request: no

### Feature request / Bug Fix

I realized that in the `get_test_dataloader` method of the `Trainer` class, for datasets that are not instances of `torch.utils.data.IterableDataset`, the `num_workers` argument is not given to the `DataLoader` init call.


https://github.com/huggingface/transformers/blob/edb672ac5edcd92fadb15d3172a115eb5fe6f663/src/transformers/trainer.py#L936-L943

Whereas it is the case juste above if `test_dataset` is an instance of `torch.utils.data.IterableDataset`:

https://github.com/huggingface/transformers/blob/edb672ac5edcd92fadb15d3172a115eb5fe6f663/src/transformers/trainer.py#L925-L931

Moreover, the DataLoader outputted in `get_eval_dataloader` is initialized with the num_workers argument

https://github.com/huggingface/transformers/blob/edb672ac5edcd92fadb15d3172a115eb5fe6f663/src/transformers/trainer.py#L888-L896

I know this is not really a feature request, but I do not think it is not a bug either, sorry if I have posted at the wrong place. I read that when talking about the trainer class, @sgugger was generally the one to ping.

### Motivation

Adding a line with `num_workers=self.args.dataloader_num_workers,` in the `DataLoader` init call of the `get_test_dataloader` method could fasten the prediction steps by using multiple workers to load the data.

https://github.com/huggingface/transformers/blob/edb672ac5edcd92fadb15d3172a115eb5fe6f663/src/transformers/trainer.py#L936-L943

### Your contribution

I have submitted #17751 

Comments:
BLOOM enhance alibi creation
Author: younesbelkada
Pull request: yes

# What does this PR do?

Thanks to @justheuristic 's contribution alibi tensor is better created/communicated during the forward pass. The tests seem to pass but still stays as an experimental feature. 

cc @justheuristic 

This probably will break with accelerate offloading but not sure.. 

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_17758). All of your documentation changes will be reflected on that endpoint.
issues in `generate()`
Author: ydshieh
Pull request: no
Labels: name: WIP

## A collection of issues for `generate()` method that we need to address

(**I don't assign these issues to anyone yet. I might work on some of these later. The purpose here is to make these issues transparent to the community, and to serve as a TODO list so we won't forget.**)

As an extension to the model equivalence tests across framework, I prepared a list of potential issues for `generate()` which gives different results across frameworks.

- Currently only look at the type and shape, not the values inside the tensors
- We might need to wait the current **`generate()` refactorization PR(s) merged** before starting address these issues.
- Here is the [Colab notebook](
https://colab.research.google.com/drive/1294oyVDrwvnuw_P3QtFE_CZ7DoMdthyq?usp=sharing) which demonstrates the issues.

Summary of issues (also included as comments in the above notebook)

- Flax's `generate()` doesn't support `return_dict_in_generate` (gives errors), `output_scores`, `output_attentions`, while PT/TF accept them
- PT/TF/Flax `BeamSearchEncoderDecoderOutput` outputs have different keys
- `scores` have different types: PT -> `tuple` , TF/Flax -> `tensor` 
- `scores` have different shape: PT -> (15, 4, 50257), TF -> (1, 4, 50257), Flax -> (1,)
- `sequences_scores` have different types: PT -> tensor , TF -> None , Flax -> no such attribute 
- `PT.sequences_scores` seems to be `Flax.scores`
- TF's `sequences` has a shorter length by 1 than PT's `sequences` 

Comments:
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.
implement onnx config for SqueezeBert
Author: artemisep
Pull request: no

### Feature request

see https://github.com/huggingface/transformers/issues/16308

### Motivation

see https://github.com/huggingface/transformers/issues/16308

### Your contribution

added onnx config for SqueezeBert

Comments:
Hi @lewtun , @LysandreJik   here are a few things about the testing results
1. pytest test_onnx_v2.py:
    3 passes, 204 skipped, 8 warnings, no errors

2.  RUN_SLOW=1 pytest tests/onnx/test_onnx_v2.py -s -k "squeezebert"  
    gave warning "No GPU/TPU found, falling back to CPU"
    then complained "Could not load dynamic library 'libcuda.so.1' "
    and final message: "7 failed, 200 deselected, 7 warnings"
    
system info: ubuntu 20.04, pytorch: 1.11.0+cu102


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.
Bump notebook from 6.4.10 to 6.4.12 in /examples/research_projects/visual_bert
Author: dependabot[bot]
Pull request: yes
Labels: name: dependencies

Bumps [notebook](http://jupyter.org) from 6.4.10 to 6.4.12.


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=notebook&package-manager=pip&previous-version=6.4.10&new-version=6.4.12)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language

You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/huggingface/transformers/network/alerts).

</details>

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Bump notebook from 6.4.10 to 6.4.12 in /examples/research_projects/lxmert
Author: dependabot[bot]
Pull request: yes
Labels: name: dependencies

Bumps [notebook](http://jupyter.org) from 6.4.10 to 6.4.12.


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=notebook&package-manager=pip&previous-version=6.4.10&new-version=6.4.12)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language

You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/huggingface/transformers/network/alerts).

</details>

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Add Flax implementation for BLOOM
Author: haileyschoelkopf
Pull request: no
Labels: name: New model

### Model description

I'm interested in adding an implementation of BLOOM in Flax. 

The implementation shouldn't be too bad since the pytorch implementation can serve as a guide and a way to check correctness. 



### Open source status

- [X] The model implementation is available
- [X] The model weights are available

### Provide useful links for the implementation

@younesbelkada @stas00 @patrickvonplaten 

If someone is already planning to work on this then no worries, but if not I will start on this as soon as I have time!

Comments:
Hi!
Thank you very much for the contribution!
On my side it's a green light since I am not working on it, and it is not on my plans for now. Therefore, I'll be happy to review it! Let us know if you want to work on that :)

Thanks! I will open a WIP PR soon and tag you there once I do.

Very cool idea - think this can also be a flagship project where we can showcase how to fine-tune BLOOM with Flax cc @patil-suraj @sanchit-gandhi 

Awesome!  Would be very happy to help with it :) 

Great idea! Would also be interested in getting involved, this would be a super cool model addition!

Thanks everyone for the interest! I'd love to collaborate with you all.

I'm hoping to push a rough draft of modeling code by the end of the weekend (earlier if I have time), and will tag you all when I open the PR with that. Does that sound alright?

I've opened a PR (and documented the state of the in-progress code I'm still working on) at #17761 ! We can discuss further in that PR how to collaborate / proceed.
Migrate HFDeepSpeedConfig from trfrs to accelerate
Author: pacman100
Pull request: yes

### What does this PR do?
1. Migrates HFDeepSpeedConfig from transformers repo to accelerate repo as it is generic enough and specific bits remain in transformers.

## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#start-contributing-pull-requests),
      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?


Comments:
We discussed offline with Sourab on adding a few wrappers as static methods of `AcceleratorState` to make this code easier to read on the Transformers side :-)

My apologies @stas00 I was (wrongly) thinking the DeepSpeed API was still marked as experimental and therefore was okay with some small breaking changes, but it's not so we shouldn't break things.

So let's limit the changes to the move of the config inside Accelerate, with the rest of the code the exact same indeed (in particular leave the weakref as it was).

That sounds great, Sylvain. Thank you!


_The documentation is not available anymore as the PR was closed or merged._

Thanks for all the work on this, good to merge on my side!

Good to merge, @pacman100 - thank you for bearing with me!
[Request] Add Wav2Vec support for onnx conversion
Author: limapedro
Pull request: no

Hi, I'd like to request support for Wav2Vec on the transformers-onnx library.
Thank you in advance.

Comments:
I believe @lewtun is working on that.

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.

Is it still to do ?
I would be interested too or is it something for the optimum library now ?
Added translation of index.mdx to Portuguese Issue #16824
Author: rzimmerdev
Pull request: yes

# What does this PR do?

Creates folder pt in docs/source for translating documentation to Portuguese
Currently, only the index.mdx file was translated as of this PR.

Fixes issue #16824

## Before submitting
- [X] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [X] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [X] 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.
- [X] 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).
- [X] Did you write any new necessary tests?



Comments:
_The documentation is not available anymore as the PR was closed or merged._

Thank you again @rzimmerdev for the translation of `index.mdx` and for correcting mistakes in `training.mdx`!

@sgugger looks good to me :). If possible, this would be a good addition to the next release.
Missing sentencepiece model for remBert
Author: Bachstelze
Pull request: no
Labels: name: bug

The code from https://huggingface.co/docs/transformers/main/en/model_doc/rembert#overview yields this error:
```
transformers.utils.hub.RepositoryNotFoundError: 404 Client Error: Repository Not Found for url: https://huggingface.co/rembert/resolve/main/sentencepiece.model
```


### Who can help?

_No response_

### Information

- [X] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

from transformers import RemBertTokenizer, RemBertModel

import torch

tokenizer = RemBertTokenizer.from_pretrained("rembert")

model = RemBertModel.from_pretrained("rembert")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")

outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state

### Expected behavior

```shell
load the model from the hub
```


Comments:
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.

Some links in the rembert documentation point to high-level `rembert` on the model hub, whereas the correct identifier is `google/rembert`. 

I can update the documentation :)

Issue was fixed with #17641 , so I'm closing it :)