noamaanMulla-03/transformers-issues huggingface dataset:
removing XLMConfig inheritance from FlaubertConfig
Author: D3xter1922
Pull request: yes

# What does this PR do?
related to  #19303
Removes `XLMConfig` dependency from `FlaubertConfig`

the `__init__` from `FlaubertConfig` differs from `XLMConfig` in the following ways:

- `pre_norm` and `layerdrop` are specific to `FlaubertConfig`. So, I have not added and `#Copied from ...`


## 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._

Can you just put the PR as ready for review and remove WIP from the title? I can't merge draft PRs :-)

> Can you just put the PR as ready for review and remove WIP from the title? I can't merge draft PRs :-)

Done. Thanks:)

Thanks for your contribution!
TFSequenceClassifierOutput can't return loss batch_size when num_labels=1
Author: goreng2
Pull request: no

### System Info

[**Colab Env**](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification-tf.ipynb)
- `transformers` version: 4.22.2
- Platform: Linux-5.10.133+-x86_64-with-Ubuntu-18.04-bionic
- Python version: 3.7.14
- Huggingface_hub version: 0.10.0
- PyTorch version (GPU?): 1.12.1+cu113 (False)
- Tensorflow version (GPU?): 2.8.2 (False)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: <fill in>
- Using distributed or parallel set-up in script?: No

### Who can help?

@Rocketknight1 @sgugger @stevhliu

### 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

https://colab.research.google.com/drive/1lTxUPTa0XPRXJRV1NDYzwvzcMOY-fqJf?usp=sharing

### Expected behavior

`STS-B` task can train with `model.fit()`

Comments:
Verified the issue, making a patch now!

@goreng2 I've submitted a fix at #19316. I'll let you know when this is merged to main.

@goreng2 The fix should now be merged, but you'll have to install from `main` to use it until the next official release. To do that, replace `pip install transformers` with `pip install --upgrade git+https://github.com/huggingface/transformers.git`. After our next release you can change your code back to just `pip install transformers`.

If this doesn't resolve your problem, feel free to comment and re-open this issue!

@Rocketknight1 It works! Thanks :) you save me!
T5 model predict <UNK>
Author: moseshu
Pull request: no

config = T5Config(num_layers=12,
num_decoder_layers=12,
pad_token_id=0,
es_token_id=VOCAB_SIZE + 2,
model_parallel=True,
vocab_size=VOCAB_SIZE,
num_heads=12,
d_model=1024,
d_kv=64,
d_ff=3072,
decoder_start_token_id= VOCAB_SIZE + 1,
)
model = T5ForConditionalGeneration(config)
this is my T5 model config.
epoch is 200 .I use it to train a translation model, 
but the results of prediction is <UNK>.

How can I use T5ForConditionalGeneration to train my custom model?
my config is right?



Comments:
Hi @moseshu 👋 As per our [issues guidelines](https://github.com/huggingface/transformers/blob/main/ISSUES.md), we reserve GitHub issues for bugs in the repository and/or feature requests. For any other matters, we'd like to invite you to use our [forum](https://discuss.huggingface.co/) 🤗
Maskformer post-processing fixes and improvements
Author: alaradirik
Pull request: yes

# What does this PR do?
- Improves MaskFormer docs, corrects minor typos
- Restructures `MaskFormerFeatureExtractor.post_process_panoptic_segmentation` for better readability, adds target_sizes argument for optional resizing
- Adds `post_process_semantic_segmentation` and `post_process_instance_segmentation` methods.
- Adds a deprecation warning to `post_process_segmentation` method in favour of `post_process_instance_segmentation` 

Notes:
This PR is part of a larger effort to ensure consistency of post-processing methods across segmentation models, to define common arguments and outputs, and get ImageSegmentationPipeline working with all available models.
- `post_process_semantic_segmentation` returns segmentations as tensors of shape (height, width), which is consistent with the COCO format
- `post_process_instance_segmentation` returns segmentations either in the same format as the panoptic method or optionally in run-length encoded format (if return_coco_format is set to True).
- `post_process_semantic_segmentation` currently has an inconsistent input argument (target_size instead of target_sizes) and output (3D tensor instead of list of 2D tensors)




## 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._

@sgugger @amyeroberts @NielsRogge all comments are addressed, could you approve the PR if everything looks good?
Removed interdependency of BERT's Tokenizer in tokenization of prophetnet
Author: divyanshugit
Pull request: yes

# What does this PR do?
Removes BERT dependency from the ProphetNet tokenizer file.

Fixes a part of [#19303](https://github.com/huggingface/transformers/issues/19303)

## 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.
- [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?


## Who can review?
@sgugger 
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._
[WIP]remove XLMTokenizer inheritance from FlaubertTokenizer
Author: D3xter1922
Pull request: yes

# What does this PR do?
Related to #19303

Removes `XLMTokenizer` inheritance from `FlaubertTokenizer`
## 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._
Adding type hints for TF TransfoXL
Author: thliang01
Pull request: yes

Based on Issue #16059

As the title suggests, this PR adds type hints to the TF TransfoXL model classes.

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_19350). All of your documentation changes will be reflected on that endpoint.
Making `Camembert` independent from `Roberta`, clean
Author: Mustapha-AJEGHRIR
Pull request: yes

This pull request is a clean version of #19312 


# What does this PR do?

related to  #19303 

Making the Camembert model (pytorch version) independent from Roberta

I have changed all the classes of camembert by copy paste from Roberta. I have done the litte necessary changes for every thing to work.

I'm still wondering how to change blocks like those, I have to  add a specific checkpoint for Camembert ? :
```python
    @add_code_sample_docstrings(
        processor_class=_TOKENIZER_FOR_DOC,
        checkpoint="deepset/roberta-base-squad2",
        output_type=QuestionAnsweringModelOutput,
        config_class=_CONFIG_FOR_DOC,
        expected_output="' puppet'",
        expected_loss=0.86,
    )
```
For testing, the following test works well :
```bash
$ RUN_SLOW=1 pytest tests/models/camembert/test_modeling_camembert.py
```

However, I have noticed the tests are only for the `CamembertModel` but not other classes like `CamembertForCausalLM` ...

## 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 related to  #19303 

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Frees LongformerTokenizer of the Roberta dependency
Author: srhrshr
Pull request: yes

# What does this PR do?

@sgugger , 

Per the issue #19303, the Roberta tokenizer dependency has been removed from `LongformerTokenizer`.   

Thanks for reviewing the PR :)  

## 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.
- [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 docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_19346). All of your documentation changes will be reflected on that endpoint.
Change `BloomConfig` docstring
Author: younesbelkada
Pull request: yes

# What does this PR do?

This PR addresses small changes on the `BloomConfig` docstring that might be slightly confusing.
Original discussion from: https://huggingface.co/bigscience/bloom/discussions/120 

Thanks! 
cc @sgugger @VictorSanh @SaulLu 

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_19336). All of your documentation changes will be reflected on that endpoint.
Call _set_save_spec() when creating TF models
Author: Rocketknight1
Pull request: yes

Much like confused ducklings, subclassed Keras models tend to imprint on the first concrete input shapes they see unless we explicitly `build()` them with more general shapes. However, the default `tf.keras.Model.build()` makes several restrictive assumptions and doesn't work for us.

The solution is to directly call `model._set_save_spec()` with the shapes we want. We do this in the `__init__` to make sure that it happens before the model is built or called with any inputs. We can also now remove the override on `model.save()`, which is no longer necessary now that we're fixing this properly.

Fixes #19231

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Removes Roberta and Bert config dependencies from Longformer
Author: srhrshr
Pull request: yes

# What does this PR do?

@sgugger , 

Per the issue #19303, the Roberta and Bert config dependencies are removed from `LongformerConfig` and it now directly inherits from `PretrainedConfig`.  

- `LongformerConfig` depends on `RobertaConfig` and `RobertaConfig` in turn inherits from `BertConfig`. 
-  So I've copied over the defaults (`pad_token_id`, `bos_token_id`, `eos_token_id`) from RobertaConfig and the rest of the defaults from BertConfig that are not conflicting with roberta.  
- The docstrings from BertConfig are copied over as well. 


## 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.
- [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._

Done! Thanks for bearing with me @sgugger :)
T5 Masked LM -- pre-trained model import?
Author: moscow25
Pull request: no
Labels: name: wontfix

## ❓ Questions & Help

Hi, thanks for merging the T5 model! However it is not clear to me how to use the pretrained model for masked language modeling. It appears that the model example only returns a hidden state, or `T5WithLMHeadModel` which is not clear what this is doing -- it tends to return the same token for me in all locations. 

My understanding of the T5 paper was that one could add input tags like `<extra_id_0>` and receive multi-token masked responses in the decoder. Has this functionality been replicated in the codebase? And if not, do you think it possible to add it -- or do you have pointers to the community to try to add this ourselves?

Unfortunately, the T5 documentation for this use case is also not great. Which is too bad because multi-token masked responses seems like a great feature of the T5 model. Testing and inference for masked language modeling is simple for BERT and variants, but does not support multi-token responses. 


Comments:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.


I found a solution https://github.com/huggingface/transformers/issues/3985#issue-606998741
Docker image nightly torch job
Author: LysandreJik
Pull request: yes

Converts the nightly job to use the updated notification service.

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

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.

This will be superseded by a PR on which @ydshieh is working.

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.

Close as this is already done.
Feature Extractor: correctly pass **kwargs upon creation
Author: FrancescoSaverioZuppichini
Pull request: yes

# What does this PR do?

This PR correctly passes over the `**kwargs` parameter to the feature extractor class upon creation in the `.from_dict` method 

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

Then it will only work on parameters that are not used at `__init__` time, I am not sure if this is what we want. Assume we check a parameter and that parameter is not in the serialized config, the code will fail even if we pass it in `**kwargs`

The check should thus be done outside of the init, at the first use. But this is a big change in the logic of feature extractor that, as you can see, makes a lot of tests fail.

So, a user is allowed to instantiate a ***extractor with missing/wrong parameters?

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.
ResNetD
Author: FrancescoSaverioZuppichini
Pull request: yes

# What does this PR do?
This WIP PR adds ResNetD proposed in [Bag of Tricks for Image Classification with Convolutional Neural Networks](https://arxiv.org/abs/1812.01187). 

Currently, the model can be used as follows

```python
import requests
from io import BytesIO
res = requests.get('https://github.com/huggingface/transformers/blob/master/tests/fixtures/tests_samples/COCO/000000039769.png?raw=true')
image = Image.open(BytesIO(res.content))

feature_extractor = AutoFeatureExtractor.from_pretrained("zuppif/resnet-d-50")
model = ResNetForImageClassification.from_pretrained("zuppif/resnet-d-50").eval()

inputs = feature_extractor(image, return_tensors="pt")
outputs = model(**inputs)
print(model.config.id2label[torch.argmax(outputs.logits).item()])
# tiger cat
```

## TODO
- [ ] Transfer weights to amazon

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

> Thanks for adding this. I wonder if the ResNet-D architecture shouldn't have switches in its architecture to allow all modifications (A, B, C) independently, since they were all defined in the same paper.
> 
> Apart from that, LGTM! The model outputs just need to refactored in one model output in a separate PR.

So the `d` variant is the only one used in practice because it's the combination of all the empirical improvements they show in the paper (so variant b + c = d). 

I'm aware, but since the paper explores B and C independently too, it might make sense to enable them via config flags (while keeping the default to D).

> I'm aware, but since the paper explores B and C independently too, it might make sense to enable them via config flags (while keeping the default to D).

This seems impossible with the current setup, the model is called `ResNetD` thus it has to be resnet-d. If we want to have all the variants we should add them to `ResNet` and create `ResNetD` using a specific set of parameters in the `ResNetConfig`. 

For instance, if I want to create `ResNetC` how should I call the `*ShortCut`? `ResNetDCShortCut`?


> This seems impossible with the current setup, the model is called ResNetD thus it has to be resnet-d.

Why? It should be called ResNet-D (because that is the final name in the paper) and it can still have config flags to enable the variants.
Anyhow, you don't want to add it so let's stop commenting about it and just merge this.

Update the codebase and modify one test in `test_config_auto` to check for an exact match (otherwise `resnetd` is matched with `resnet` thus failing the test)

Due to the incoming changes from #16188 , I want to merge that first and then rebase + update the codebase here

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.
Fix pipeline tests for Roberta-like tokenizers
Author: sgugger
Pull request: yes

# What does this PR do?

The pipeline tests rely on an inheritance test for the (weird) behavior of Roberta-like models/tokenizers having a +2 / -2 on the embeddings. This was working fine until someone decided to encourage the community to uncouple all configs, and now it breaks.

This PR fixes it.

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