noamaanMulla-03/transformers-issues huggingface dataset:
typo in docstring
Author: JadeKim042386
Pull request: yes

# What does this PR do?

<!--
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 -->

Fixes # (#18721)


## 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).

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

@JadeKim042386 Thank you for the fix! I could find there are 15 same occurrences in `transformers`. Could you replace all of them by the correct one? Thank you!

@JadeKim042386 The commit history is now not clean - there are 35 files changed.
May I know if you use `git merge` or `git rebase` command? What's the exact command used?

Anyway, we need a clean status to review and approve the PR 🙏 .

@ydshieh sorry, I was looking for the build failed problem. I used `git commit --amend`. 
Now, I will make clean status.

No problem. Thank you :-)

@ydshieh
There were total 35 files of the same occurrences in `transformers`.
Can I get a review and approval now? 😄

Hi, we can't merge a PR in such status. Considering the change could be quickly replicated: search -> replace, could you maybe 

```bash
git checkout main
git pull upstream main
git checkout -b new_fix  # a new branch to work this
```

and open a new PR instead of this one. Sorry to see this happens.

@ydshieh No problem~ 😎 I quickly open new PR.
fixed docstring typos
Author: JadeKim042386
Pull request: yes

# What does this PR do?

<!--
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 -->

Fixes # (#18721)


## 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).

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_18735). All of your documentation changes will be reflected on that endpoint.
Confusing documentation for argument class_labels in MaskFormerForInstanceSegmentation.forward()
Author: morrisalp
Pull request: no

I'm trying to fine-tune MaskFormer for an instance segmentation problem. The documentation for MaskFormerForInstanceSegmentation.forward() lists the following optional parameters:

* mask_labels (List[torch.Tensor], optional) — List of mask labels of shape (num_labels, height, width) to be fed to a model
* class_labels (List[torch.LongTensor], optional) — list of target class labels of shape (num_labels, height, width) to be fed to a model. They identify the labels of mask_labels, e.g. the label of mask_labels[i][j] if class_labels[i][j].

The wording is confusing, especially at the end -- "the label of mask_labels[i][j] if class_labels[i][j]" is missing a verb.

Additionally, other MaskFormer classes in the API accept `class_labels` of shape (labels) - one class label for each mask -  e.g. the forward() method of MaskFormerLoss. It's not clear why this is different in this case.

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.
BLOOM fix module order
Author: younesbelkada
Pull request: yes

# What does this PR do

This PR addresses a small issue where the operations of `BloomMLP` are not displayed in the correct order. This is a bit confusing for users, see the related issue: https://huggingface.co/bigscience/bloom/discussions/64

cc @sgugger 

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Fix torch version comparisons (helps with +cu*** or +cpu official builds)
Author: LSinev
Pull request: yes

Comparisons like `version.parse(torch.__version__) > version.parse("1.6")`
are `True` for `torch==1.6.0+cu101` or `torch==1.6.0+cpu` (which is not intended, I suppose).

So `version.parse(version.parse(torch.__version__).base_version)` comparisons are preferred (and used in pytorch_utils.py but not in other places).

# What does this PR do?

* Updated all comparisons to failsafe (when used in copypasting inspiration) `version.parse(version.parse(torch.__version__).base_version)`
* added some often used patterns to `pytorch_utils.py`

Did not check if original version checks were eligible. Believe original authors just missed this version check caveat.
Only torch version check changed (not sure if other packages may be affected).

## 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?
- [ ] 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?

As it is touching many parts of code: @patrickvonplaten, @LysandreJik, @sgugger


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

Wow very cool @LSinev !
Progress bars shown despite disable_tqdm=True in Trainer
Author: rafael-wampfler
Pull request: no
Labels: name: bug

### System Info

- `transformers` version: 4.19.2
- Platform: CentOS Linux 7.9.2009
- Python version: 3.10.4
- Huggingface_hub version: 0.2.1
- PyTorch version (GPU?): 1.12.1 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: Yes
- Using distributed or parallel set-up in script?: Yes

### Who can help?

@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

I'm running HuggingFace Trainer with `TrainingArguments(disable_tqdm=True, ...)` for fine-tuning the EleutherAI/gpt-j-6B model but there are still progress bars displayed, see screenshot.

```
    training_args = TrainingArguments(
        disable_tqdm=True,
        output_dir='./checkpoints',
        save_total_limit=10,
        logging_dir='/content/logs',
        num_train_epochs=config["N_EPOCHS"],
        evaluation_strategy='epoch'
        save_strategy='steps',
        save_steps=30,
        logging_steps=10,
        overwrite_output_dir=True,
        per_device_train_batch_size=4,
        per_device_eval_batch_size=4,
        gradient_accumulation_steps=4,
        eval_accumulation_steps=4,
        gradient_checkpointing=True,
        max_grad_norm=0.5,
        lr_scheduler_type="cosine",
        learning_rate=1e-4,
        warmup_ratio=0.05,
        weight_decay=0.1,
        fp16_full_eval=True
        fp16=True,
        fp16_opt_level='O1',
        report_to=['tensorboard']
    )
```

![Untitled](https://user-images.githubusercontent.com/6844011/186213857-528e089b-1114-4490-a799-e2598604e1c3.png)

### Expected behavior

No progress bars displayed anymore.





Comments:
This question has been answered on the [forum](https://discuss.huggingface.co/t/progress-bars-shown-despite-disable-tqdm-true-in-trainer/22003/2?u=nielsr); therefore closing this issue.
Add minor doc-string change to include hp_name param in hyperparameter_search
Author: constantin-huetterer
Pull request: yes

This is a very minor change. It seems like one of the parameters of the hyperparameter_search method hasn't been documented yet. :slightly_smiling_face: 

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

Just noticed, that the kwargs- argument is also not displayed correctly. Probably because of the missing type-information:
![image](https://user-images.githubusercontent.com/60255589/185738973-076ed76d-c13a-4058-ab20-8f5c9c37ec0a.png)


Better, but still parsing issues. Maybe because of the missing white-space. 
![image](https://user-images.githubusercontent.com/60255589/185740453-94cd44cf-4a73-497f-b5b6-142813578df6.png)


Yes, that did the trick. Now it looks alright. 

![image](https://user-images.githubusercontent.com/60255589/185742902-cc653820-325c-4861-ac0f-ea6c5310cf87.png)
fix `pipeline_tutorial.mdx` doctest
Author: ydshieh
Pull request: yes

# What does this PR do?

Fix [doctest failure](https://github.com/huggingface/transformers/runs/7942633458?check_suite_focus=true) due to the incorrect expected values.

(It's probably just because the previous values are obtained in a different env. or hardware)

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_18717). All of your documentation changes will be reflected on that endpoint.
Add TF implementation of XGLM model
Author: stancld
Pull request: no
Labels: name: WIP

# 🚀 Feature request

Add TF implementation of XGLM model

## Motivation

Narrow the gap between PT and TF implementations.

## Your contribution

I'd like to work on this.

Comments:
Thanks a lot for willing to work on this, happy to help with it :) 

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.

Still active

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.

still active
fixed docstring typos
Author: JadeKim042386
Pull request: yes

# What does this PR do?

<!--
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 -->

Fixes # (#18721)


## 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).

@ydshieh 

Comments:
Hi, @JadeKim042386 . I am sorry that I was wrong - the 35 files changes comes from the fact you fixed more occurrences rather than just the initial ones!

I will review this PR now.

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

LGTM, but the change

from
```
kwargs: (*optional*) Remaining dictionary ...
```
to
```
kwargs (*optional*) Remaining dictionary ...
```
should be 
```
kwargs (*optional*): Remaining dictionary ...
```
in my opinion. WDYT?

@ydshieh
Oh, the colon was missing!
I think it would be better to put a colon~


@LysandreJik The number of changed files is large, but it just removes the extra `:` from some docstrings. 

change
```
encoder_layerdrop: (`float`, *optional*, defaults to 0.0):
```
to
```
encoder_layerdrop (`float`, *optional*, defaults to 0.0):
```

I checked on the documentation page, and indeed there are missing arguments due to this fact.
Typo in TrOCR documentation
Author: JadeKim042386
Pull request: no

decoder_layerdrop was hidden in [TrOCR documentation](https://huggingface.co/docs/transformers/v4.21.1/en/model_doc/trocr#transformers.TrOCRConfig). 😂

![image](https://user-images.githubusercontent.com/61103343/185959294-741f0f0d-999f-4073-a4b1-7ee7d5be2184.png)

I think it should be revised as follows.


- **init_std** (float, optional, defaults to 0.02) — The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
- **decoder_layerdrop** — (float, optional, defaults to 0.0): The LayerDrop probability for the decoder. See the [LayerDrop paper](see https://arxiv.org/abs/1909.11556) for more details.

Comments:
I found typo in TrOCRConfig docstring~

https://github.com/huggingface/transformers/blob/84beb8a49bf137a88d1b29ab3a85ba0a3cd097d5/src/transformers/models/trocr/configuration_trocr.py#L70

It revised as follows. (remove ':' ) #18721 

```python
decoder_layerdrop (`float`, *optional*, defaults to 0.0):
```
Cannot import ORTModelForSeq2SeqLM
Author: lyriccoder
Pull request: no
Labels: name: bug

### System Info

- `transformers` version: 4.21.1
- Platform: Linux-5.4.0-109-generic-x86_64-with-glibc2.31
- Python version: 3.9.5
- Huggingface_hub version: 0.4.0
- PyTorch version (GPU? no): 1.12.1+cu102 (False)
- Tensorflow version (GPU? no): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: No, only CPU. But it doesn't work even with GPU enabled
- Using distributed or parallel set-up in script?: No

@deepspeed

### 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

1. install python3.10
2. install `pip install optimum[onnxruntime]` (or `pip install optimum[deepspeed]`)
3. run any script with the foollowing import:
`from optimum.onnxruntime import ORTModelForSeq2SeqLM`
It fails with error:

```
from optimum.onnxruntime import ORTModelForSeq2SeqLM
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "CodeBERT/venv_3.9_onxx/lib/python3.9/site-packages/optimum/onnxruntime/__init__.py", line 62, in <module>
    from .trainer import ORTTrainer
  File "CodeBERT/venv_3.9_onxx/lib/python3.9/site-packages/optimum/onnxruntime/trainer.py", line 47, in <module>
    from transformers.deepspeed import deepspeed_init, deepspeed_reinit, is_deepspeed_zero3_enabled
ImportError: cannot import name 'deepspeed_reinit' from 'transformers.deepspeed' (CodeBERT/venv_3.9_onxx/lib/python3.9/site-packages/tr
ansformers/deepspeed.py)
```
4. Run 
```
model = ORTModelForSeq2SeqLM.from_pretrained(model_id, from_transformers=True)
```
It fails with the following error:

```
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'ORTModelForSeq2SeqLM' is not defined
```

### Expected behavior

Import should be done correctly and it is possible to use it

Comments:
Hi @lyriccoder! It looks like you are not using the latest release of Optimum. Could you try to upgrade it with `pip install --upgrade optimum[onnxruntime]` and let me know if it works?
`transformers.convert_graph_to_onnx.quantize` fails in unit tests
Author: rachthree
Pull request: no
Labels: name: bug

### System Info

- `transformers` version: 4.22.0.dev0
- Platform: Linux-5.10.60.1-microsoft-standard-WSL2-x86_64-with-glibc2.29
  * Used `tensorflow/tensorflow:latest` Docker image for this environment, then used `pip install -e '.[dev,onnx]'`
- Python version: 3.8.10
- Huggingface_hub version: 0.8.1
- PyTorch version (GPU?): 1.12.1+cu116 (True)
- Tensorflow version (GPU?): 2.9.1 (True)
- Flax version (CPU?/GPU?/TPU?): 0.5.3 (cpu)
- Jax version: 0.3.6
- JaxLib version: 0.3.5
- Using GPU in script?: Yes
- Using distributed or parallel set-up in script?: No

Other:
- `onnxruntime` version: 1.12.1

### Who can help?

_No response_

### Information

- [ ] The official example scripts
- [X] 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

Run `RUN_SLOW=true pytest tests/onnx/test_onnx.py`

Get failures:
```
FAILED tests/onnx/test_onnx.py::OnnxExportTestCase::test_quantize_pytorch - TypeError: 'module' object is not callable
FAILED tests/onnx/test_onnx.py::OnnxExportTestCase::test_quantize_tf - TypeError: 'module' object is not callable
```


### Expected behavior

The unit tests should pass.

I believe this failure is due to `onnxruntime.quantization.quantize` which is a module that contains functions `quantize_static` and `quantize_dynamic`. The API may have changed since the unit test was written. I'm not sure which is the one to use for the unit tests. Even after fixing, not sure how `transformers` should handle the different versions of `onnxruntime` or should the required version change in `setup.py`.

See https://github.com/microsoft/onnxruntime/blob/main/onnxruntime/python/tools/quantization/quantize.py

Comments:
cc @lewtun 

I have fixed this in https://github.com/huggingface/transformers/pull/18336, but still waiting for a review.

Looks like this has been fixed! Closing this.
Kindly provide a sample dataset used in layoutlmv3.
Author: abinash15th
Pull request: no

### Feature request

Need a dataset sample to explore and know how it's 
been prepared.

### Motivation

@NielsRogge 

### Your contribution

@NielsRogge 

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.

Hi,

Check this thread for more info: https://github.com/NielsRogge/Transformers-Tutorials/issues/123
What are the GPU RAM requirements of popular models?
Author: r0levrai
Pull request: no

# ❓ Questions & Help

What are the GPU RAM requirement of `gpt2`, `gpt2-medium`, `distilgpt2`, `bert-base-uncased` and/or `distilroberta-base`

* for training?
* for inference?

Additionally, how do you calculate or find this information for other models?

original StackOverflow question: https://stackoverflow.com/questions/61226569/what-are-the-gpu-ram-requirements-of-popular-huggingface-transformers-models
related: #1750

Comments:
Hi @r0levrai,

Good question! We are actually thinking about a good visualization for exactly that. Maybe in 2,3 weeks :-) 

We already have a very useful script to test RAM requirements which you can find here: 
`https://github.com/huggingface/transformers/blob/master/examples/benchmarks.py`

It should work with any model for a given `batch_size` and `sequence_length`. Let me know if you encounter problems with the script!

any updates on that visualization? 👀 

Also that link 404's now.

Hey @thesofakillers - note that we don't support benchmarking utils in Transformers anymore
Update perf_infer_gpu_many.mdx
Author: mishig25
Pull request: yes

Fixes doc link typo

related to https://github.com/huggingface/doc-builder/issues/282

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

link works as expected in https://moon-ci-docs.huggingface.co/docs/transformers/pr_18744/en/perf_infer_gpu_many