noamaanMulla-03/transformers-issues huggingface dataset:
Fix DETR segmentation postprocessing output
Author: alaradirik
Pull request: yes

# What does this PR do?
Ensures post_process_instance_segmentation and post_process_panoptic_segmentation methods return a tensor of shape (target_height, target_width) filled with -1 values if no segment with score > threshold is found.

Applies the same changes as the MaskFormer postprocessing fix [PR](https://github.com/huggingface/transformers/pull/19354).


## 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?
- [ 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.
- [ ] 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:
_The documentation is not available anymore as the PR was closed or merged._
Fix MaskFormer failing postprocess tests
Author: alaradirik
Pull request: yes

# What does this PR do?
Ensures post_process_instance_segmentation and post_process_panoptic_segmentation methods return a tensor of shape (target_height, target_width) filled with -1 values if no segment with score > threshold is found.


## 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:
_The documentation is not available anymore as the PR was closed or merged._

Looks like there is still a problem with the test.
Improve DETR post-processing methods
Author: alaradirik
Pull request: yes

# What does this PR do?
- Adds `post_process_object_detection`, `post_process_semantic_segmentation`, `post_process_instance_segmentation` and `post_process_panoptic_segmentation` methods with optional resizing and thresholding to filter out low probability predictions.

This PR is part of a larger effort to ensure post-processing methods have consistent naming, input arguments and output. Deprecation warnings are added to existing post-processing methods.

## 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.
- [ 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).
- [ ] Did you write any new necessary tests?



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

@amyeroberts @sgugger thank you both for the feedback! Could you take a final look at the PR? If everything looks fine, I'll apply the same changes to MaskFormer and update the model cards.

> Thanks for working on this. As mentioned internally, don't hesitate to separate PRs in focused bits: here there could have been:
> 
> * one PR to quickly fix the comments
> * one PR to add the post processing to DETR
> * one PR for the deprecation warnings

Makes sense, I'll split my future PRs into smaller, issue-specific ones.

> Also wondering if we should target a lower version than v5 for the removal of the methods, since this is all a bit of an experimental API.

I agree, we can target a lower version for the removal of deprecated methods.
fix owlvit tests, update docstring examples
Author: alaradirik
Pull request: yes

# What does this PR do?
- Fixes the `OwlViTModelIntegrationTest` failures due to recently merged [PR](https://github.com/huggingface/transformers/pull/18573) that fixed a resizing bug in `OwlViTFeatureExtractor`
- Updates the outputs shown in OwlViT docstring examples


## 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.
- [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).
- [ ] Did you write any new necessary tests?





Comments:
_The documentation is not available anymore as the PR was closed or merged._
Fix resizing bug in OWL-ViT
Author: alaradirik
Pull request: yes

# What does this PR do?
Fixes a resizing issue in `OwlViTFeatureExtractor` that lead to the image/s getting resized along only one dimension and getting cropped along the other dimension later on in the preprocessing pipeline. The issue was due to defining the size as a single value instead of a tuple (768 instead of (768, 768)). 

The configuration files are updated and the `OwlViTProcessor `can correctly resize the input images now. This PR changes the default target `size` and sets default `do_center_crop` argument as False.

Fixes # 18553

## 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?

@NielsRogge could you take a look?





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

> Thanks for fixing! However, all "owlvit" checkpoints on the hub have `"do_center_crop": true` in their preprocessor_config.json.
> 
> Should we update them after this PR is merged?

Good point, yes, we should update them after the merge
remove RobertaConfig inheritance from MarkupLMConfig
Author: D3xter1922
Pull request: yes

# What does this PR do?
Related to #19303

Removes `RobertaConfig` and `BertConfig` dependency from `MarkupLMConfig`. Even though `RobertaConfig` inherits from `BertConfig`, I have changed `MarkupLMConfig` to directly inherit from `PretrainedConfig`.

Added the following arguments in `__init__`:

- `bos_token_id = 0`
- `eos_token_id = 2`
- `position_embedding_type="absolute"`
- `use_cache=True`
- `classifier_dropout=None`

## 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?
- [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.
- [ ] 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?
@sgugger 


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

> Great work, thanks a lot! There is a typo in the docstring that is responsible for the failing test. I believe my suggestion should fix it :-)

Thank you for your suggestion.

Thanks for your work on this!
Original image from Trocr Processor
Author: dranreb1660
Pull request: no

Hi [@NielsRogge, I am following your TrOCR finetuning with PyTorch but I have two questions: The processor resizes the image from 1700 x 134 to 384 x384, 1) is there a way to maintain the height of the original image or even use a custom dimension for training, eg. 512 x 134. and 2) is there a way to get the original image back for logging purposes as the processed image is unrecognizable after those basic augmentations. Thanks

Comments:
Hi,

This question is answered on our forum: https://discuss.huggingface.co/t/get-original-image-from-trocr-processor/24224/2
DeformableDetrForObjectDetection is not supported
Author: Eggwardhan
Pull request: no

### System Info

when I use
`conda create -n hug numpy matplotlib transformers python=3.8` and activated hug env, or just use `pip install transformers` ,I got the same result

```
(hug) root@e:/# python
Python 3.8.13 (default, Mar 28 2022, 11:38:47) 
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from transformers import AutoFeatureExtractor, DeformableDetrForObjectDetection
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'DeformableDetrForObjectDetection' from 'transformers' (/opt/miniconda3/envs/hug/lib/python3.8/site-packages/transformers/__init__.py)
```


### Who can help?

_No response_

### Information

- [X] The official example scripts
- [ ] My own modified scripts

### Tasks

- [x] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

1.conda create -n hug numpy matplotlib transformers python=3.8
2.conda activate hug
3.from transformers import AutoFeatureExtractor, DeformableDetrForObjectDetection


### Expected behavior

Can any one tell me why?

Comments:
Hi,

Deformable DETR is not yet available in a PyPi release. For now, you have to install the library from source:

```
pip install -q git+https://github.com/huggingface/transformers.git
```
Fix typo in image-classification/README.md
Author: zhawe01
Pull request: yes

Fix link typo of the following content.
PyTorch version, Trainer
PyTorch version, no Trainer

# What does this PR do?
Fixes a typo

## Who can review?
@sgugger @NielsRogge 
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.



Comments:
_The documentation is not available anymore as the PR was closed or merged._
[ViTMAE] Renamed variable name
Author: ariG23498
Pull request: yes

The `sequence_masked` variable is actually the part of the sequence that is kept **unmasked** for the encoder to consume. This commit renames the variable accordingly.

CC: @sayakpaul 

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

Tagging @NielsRogge, as he's the vision master 👨‍🏫 

Just a reminder here!

(Niels it currently off, he'll be back in a few days :) )

FYI, I took this from the original repository: https://github.com/facebookresearch/mae/blob/efb2a8062c206524e35e47d04501ed4f544c0ae8/models_mae.py#L140

Do you think an issue in the original repository would be a good approach to move forward? @NielsRogge 

Yes indeed, to make the authors confirm!

Thanks for leading the effort. Good work! 

@sgugger and @NielsRogge thanks for the reviews and actions.
Add TF whisper
Author: amyeroberts
Pull request: yes

# What does this PR do?

Adds TF Whisper port of PyTorch implementation


## 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).
- [x] Did you write any new necessary tests?


Comments:
_The documentation is not available anymore as the PR was closed or merged._
corrected not woking link.
Author: YOGENDERSS
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 # (issue)


## 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),



Comments:
@sgugger sir could you review this up. 

@julien-c if u could check this up then please check it once.


@amyeroberts mam if u r free then please u check. or anyone who is free please check.

Hi @YOGENDERSS , I think this PR is a duplicate from mine https://github.com/huggingface/transformers/pull/19434

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

sorry i did'nt knew it was open already.

@MikailINTech thanks buddy

@YOGENDERSS No worries
Fix TF batch norm momentum and epsilon values
Author: amyeroberts
Pull request: yes

# What does this PR do?

Updates momentum values for TF batch norm layers to match the pytorch models'. 

The momentum value for PyTorch and TensorFlow batch normalization layers is not equivalent, as pointed out by @mathieujouffroy [here](https://github.com/huggingface/transformers/pull/18597#issuecomment-1263381794)

The TensorFlow value should be (1 - pytorch_momentum) in order to ensure the correct updates are applied to the running mean and running variance calculations. We wouldn't observe a difference loading a pretrained model and performing inference, but evaluation outputs would change after some training steps.


## 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:
_The documentation is not available anymore as the PR was closed or merged._
Incorrect type hint of "exponential_decay_length_penalty" in function "generate"
Author: pohunghuang-nctu
Pull request: no

Hi, 
   Please check below line, 
https://github.com/huggingface/transformers/blob/7e7f62bfa72ca03e9f16285dad182f7c57cd8cab/src/transformers/generation_utils.py#L956
   According to doc string, "exponential_decay_length_penalty (`tuple(int, float)`, *optional*, defaults to `model.config.exponential_decay_length_penalty`):" (https://github.com/huggingface/transformers/blob/main/src/transformers/generation_utils.py#L1114)

the correct type hint should be "Optional[Tuple[int, float]]", the number of tuple elements should be 2, and must be "int" in position 0, and "float" in position 1. 

Comments:
Misspelled docstring for ensure_valid_input function
Author: Bearnardd
Pull request: no

### System Info

- `transformers` version: 4.23.0.dev0
- Platform: Linux-5.4.0-126-generic-x86_64-with-glibc2.29
- Python version: 3.8.10
- Huggingface_hub version: 0.10.0
- PyTorch version (GPU?): 1.12.1+cu102 (False)
- Tensorflow version (GPU?): 2.10.0 (False)
- Flax version (CPU?/GPU?/TPU?): 0.6.0 (cpu)
- Jax version: 0.3.6
- JaxLib version: 0.3.5
- Using GPU in script?: No
- Using distributed or parallel set-up in script?: No

### Who can help?

@sgugger

### Information

- [ ] 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

```{code}
def ensure_valid_input(model, tokens, input_names):
    """
    Ensure input are presented in the correct order, without any Non

    Args:
        model: The model used to forward the input data
        tokens: BatchEncoding holding the input data
        input_names: The name of the inputs

    Returns: Tuple

    """
```

### Expected behavior

It is a really tiny tiny detail but when I was going through `convert_graph_to_onnx.py` file I noticed that there is a misspelled docstring for `ensure_valid_input` function. Namely, I believe that `"Ensure input are ..."` should be `"Ensure inputs are ...`.

Comments:
Looks wrong indeed. Would you like to open a PR to fix it?

@sgugger sure, I will take care of that tomorrow.
Fixed a non-working hyperlink in the README.md file
Author: MikailINTech
Pull request: yes

The hyperlink to the community notebooks was outdated.

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

@MikailINTech will close this then. sorry buddy

> The link is just a missing double slash, could you please just fix that? Your fix includes some metadata that is not useful.

Sorry ! fixed
Wrap FlauBERT integration test forward passes with torch.no_grad()
Author: daspartho
Pull request: yes

# What does this PR do?
This PR wraps forward passes in FlauBERT integration tests with `torch.no_grad()`, as proposed in issue #14642. This avoids the computation of unnecessary gradients during inference.

## Before submitting
- [ ] This PR fixes a typo or improves the docs.
- [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/)?
- [ ] Did you make sure to update the documentation with your changes?
- [ ] Did you write any new necessary tests?


## Who can review?
@LysandreJik could you please take a look at it?
Thanks :)

Comments:
Wrap FNet integration test forward passes with torch.no_grad()
Author: daspartho
Pull request: yes

# What does this PR do?
As proposed in issue #14642, this PR wraps forward passes in FNet integration tests with torch.no_grad(). This way, no unnecessary gradients are computed during inference.


## Before submitting
- [ ] This PR fixes a typo or improves the docs.
- [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/)?
- [ ] Did you make sure to update the documentation with your changes?
- [ ] Did you write any new necessary tests?


## Who can review?
@LysandreJik could you please take a look at it?
Thanks :)

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Wrap ImageGPT integration test forward passes with torch.no_grad()
Author: daspartho
Pull request: yes

# What does this PR do?
As proposed in issue #14642, this PR wraps forward passes in ImageGPT integration tests with torch.no_grad(). This way, no unnecessary gradients are computed during inference.


## Before submitting
- [ ] This PR fixes a typo or improves the docs.
- [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/)?
- [ ] Did you make sure to update the documentation with your changes?
- [ ] Did you write any new necessary tests?


## Who can review?
@LysandreJik could you please take a look at it?
Thanks :)

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Wrap TAPAS integration test forward passes with torch.no_grad()
Author: daspartho
Pull request: yes

# What does this PR do?
This PR wraps forward passes in TAPAS integration tests with `torch.no_grad()`, as proposed in issue #14642. This avoids the computation of unnecessary gradients during inference.

## Before submitting
- [ ] This PR fixes a typo or improves the docs.
- [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/)?
- [ ] Did you make sure to update the documentation with your changes?
- [ ] Did you write any new necessary tests?


## Who can review?
@LysandreJik could you please check it?
Thanks :)

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