noamaanMulla-03/transformers-issues huggingface dataset:
Add: doc page for the object detection task
Author: MKhalusova
Pull request: yes

This is a PR for the [#20805](https://github.com/huggingface/transformers/issues/20805) issue. The guide has content and working code examples for:
*  Introduction
*  Loading CPPE-5 dataset from Hub
*  Preprocessing both images and annotations. Images are augmented, and annotations are reformatted to be in the format DETR expects
*  Training with Trainer
*  Evaluation
*  Inference

Comments:
This PR replaces the https://github.com/huggingface/transformers/pull/20874 

To preserve the discussion, here's @sayakpaul 's comment relevant to the CI issue: https://github.com/huggingface/transformers/pull/20874#issuecomment-1366717321

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

> * Make sure to split long code samples in several smaller ones with text introducing each step. The evaluation in particular is too long and may be too technical for this guide.

I agree that the evaluation part is a bit too technical, but unfortunately at the moment, there's no simpler way (hopefully soon there will be an easier way to have coco evaluation metrics). But I can certainly split it up somewhat. 


Thank you for the feedback @sayakpaul !
 > Do you have a Colab Notebook where this code has been tested (preferably with outputs)?

Yes, I do. Here's my playground notebook with outputs. All the code examples are working. The only issue is that I didn't really pay too much attention to the hyperparameters, so the resulting model isn't very good. It would probably improve with more epochs and better learning rate decay. But I ran out of free GPU in Colab today :D
https://colab.research.google.com/drive/1wPTZJajGRhhh00Lnz7-8E5qE1x_qL1Of#scrollTo=5w2lsRRYPXDN




@NielsRogge note that finetune/fine-tune has no decided standard in the doc/transformers and both are used equally.
Clarify and add missing typical_p argument docstring.
Author: shermansiu
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 -->

This adds an argument docstring of locally typical sampling (implemented in #15504) that was missing in `src/transformers/configuration_utils.py` and clarifies the existing docstring in `src/transformers/generation/configuration_utils.py`.


## Who can review?
@stevhliu @patrickvonplaten 

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

cc @gante as well
FELIX: Flexible Text Editing Through Tagging and Insertion
Author: shermansiu
Pull request: no
Labels: name: New model

### Model description

FELIX is an encoder-only text editing model, which allows for faster editing and summarization than sequence-to-sequence models, because the summarization can be computed in parallel instead of autoregressively.

- [Blog](https://ai.googleblog.com/2021/05/introducing-felix-flexible-text-editing.html?hl=hr&m=1)
- [Paper](https://aclanthology.org/2020.findings-emnlp.111/)

### Open source status

- [X] The model implementation is available
- [ ] The model weights are available

### Provide useful links for the implementation

https://github.com/google-research/google-research/tree/master/felix

No weights are available, but code to train it is available. A component of FELIX is BERT, so training FELIX is a matter of fine-tuning a pre-trained BERT model.

@Jmallins

Comments:
Because FELIX can be applied to any encoder-only model, perhaps what is needed is an `AutoModelForSequenceEditing`/`<ModelName>ModelForSequenceEditing`?

Closing this as it's a duplicate of #11632
Make `test_save_pretrained_signatures` slow test
Author: ydshieh
Pull request: yes

# What does this PR do?

`UtilsFunctionsTest.test_save_pretrained_signatures` in `tests/test_modeling_tf_common.py` is introduced on Oct. 2022, which runs about ~60 seconds, and failed a lot of times **on Push CI** due to the timeout limit on Push CI job setting (`PYTEST_TIMEOUT`).

Notice that, on CircleCI, we have `PYTEST_TIMEOUT=120` - as we use flag `-n 8` to run tests in parallel. I don't want to set `120` for Push CI at this moment (without running with it first), as it might make the CI slow down (a lot).

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

Thanks! I'd like to have @Rocketknight1 and @gante approve on this before we merge (or find a way to make this test slower).
Feature Request: VideoMAEForMaskedVideoModeling
Author: will-rice
Pull request: no

### Feature request

Basically, it would be nice if we could fill in the masked video.

### Motivation

I doubt I'm the only person that would like to try/train this model for inpainting masked video.

### Your contribution

I guess I could contribute it since I went to the torchside

Comments:
Hi,

This is already available, the class is called [VideoMAEForPreTraining](https://huggingface.co/docs/transformers/model_doc/videomae#transformers.VideoMAEForPreTraining). To reconstruct pixel values, you can load the following model:
```
from transformers import VideoMAEForPreTraining

model = VideoMAEForPreTraining.from_pretrained("MCG-NJU/videomae-base")
```

To visualize a masked video, you can borrow the code from the [original implementation](https://github.com/MCG-NJU/VideoMAE/blob/45dcd7f10183099669baa481c6d33165842d8bf3/run_videomae_vis.py#L167).
got an unexpected keyword argument 'early_stop_callback'
Author: yxu1168
Pull request: no

__init__() got an unexpected keyword argument 'early_stop_callback'

## Environment info
<!-- You can run the command `transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->
     
- `transformers` version:
- Platform:
- Python version:
- PyTorch version (GPU?):
- Tensorflow version (GPU?):
- Using GPU in script?:
- Using distributed or parallel set-up in script?:

### Who can help
<!-- Your issue will be replied to more quickly if you can figure out the right person to tag with @
 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.
 
 albert, bert, GPT2, XLM: @LysandreJik 
 tokenizers: @mfuntowicz
 Trainer: @sgugger
 Speed and Memory Benchmarks: @patrickvonplaten
 Model Cards: @julien-c
 Translation: @sshleifer
 Summarization: @sshleifer
 TextGeneration: @TevenLeScao 
 examples/distillation: @VictorSanh
 nlp datasets: [different repo](https://github.com/huggingface/nlp)
 rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)
 Text Generation: @patrickvonplaten @TevenLeScao
 blenderbot: @mariamabarham
 Bart: @sshleifer
 Marian: @sshleifer
 T5: @patrickvonplaten
 Longformer/Reformer: @patrickvonplaten
 TransfoXL/XLNet: @TevenLeScao
 RAG: @patrickvonplaten, @lhoestq
 FSTM: @stas00
 examples/seq2seq: @sshleifer
 examples/bert-loses-patience: @JetRunner
 tensorflow: @jplu
 examples/token-classification: @stefan-it
 documentation: @sgugger
 -->

## Information

Model I am using (Bert, XLNet ...):

The problem arises when using:
* [ ] the official example scripts: (give details below)
* [ ] my own modified scripts: (give details below)

The tasks I am working on is:
* [ ] an official GLUE/SQUaD task: (give the name)
* [ ] my own task or dataset: (give details below)

## To reproduce

Steps to reproduce the behavior:

1.
2.
3.

<!-- If you have code snippets, error messages, stack traces please provide them here as well.
     Important! Use code tags to correctly format your code. See https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks#syntax-highlighting
     Do not use screenshots, as they are hard to read and (more importantly) don't allow others to copy-and-paste your code.-->

## Expected behavior

<!-- A clear and concise description of what you would expect to happen. -->


Comments:
Hello, we would need you to fill the issue template to have an idea of what's going on and how we can help.

if you have `pytorch-lightning=1.0.4` and the code on `master` this shouldn't happen.

Thank you Sam, it works!

I have 1.8.6 and it still happens.
Pipeline for Question Answering: How to return multiple correct answers output?
Author: rcontesti
Pull request: no
Labels: name: wontfix

name: Core: Pipeline

name: High-Level feature

name: Ex: Question Answering

Very simple question I'm using transformer pipelines question answering on a very long piece of text. And, it is the cases that the are are multiple cases for the correct answer. I want them all.

I was wondering if I could retrieve the 10 best scores of output instead of just one.

Many thanks. 

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 need a solution to this problem as well please help

Thanks.

The solution is to use the `topk` parameter, for example, following the example in https://huggingface.co/transformers/task_summary.html about question answering, if you want 3 answer:

` result = nlp(question="What is extractive question answering?", context=context, topk = 3)`

@fumpe Can this work for sagemaker? Actually I am trying to deploy this pipeline in sagemaker, how can we customize the topk parameter in that? (As Sagemaker works a bit differently), Sagemaker currently returns only 1 answer, and am unable to modify the parameters to increase the number of returned items. Thank you.

This is my model and pipeline setup in Sagemaker:
hub = {
'HF_MODEL_ID':'valhalla/t5-base-qa-qg-hl',
'HF_TASK':'text2text-generation'
}
GIT does not work with beam search
Author: PeterL1n
Pull request: no

### System Info

- `transformers` version: 4.26.0.dev0
- Platform: Linux-5.4.143.bsk.7-amd64-x86_64-with-glibc2.31
- Python version: 3.9.2
- Huggingface_hub version: 0.11.1
- PyTorch version (GPU?): 1.13.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?: NO

### Who can help?

@gante @ArthurZucker @younesbelkada 

### Information

- [ ] The official example scripts
- [X] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

Take the script from official doc (https://huggingface.co/docs/transformers/main/model_doc/git#transformers.GitForCausalLM)

Add `num_beams=3`. Git model will report error.

```python
from transformers import AutoProcessor, AutoModelForCausalLM
import requests
from PIL import Image

processor = AutoProcessor.from_pretrained("microsoft/git-base-coco")
model = AutoModelForCausalLM.from_pretrained("microsoft/git-base-coco")

url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)

pixel_values = processor(images=image, return_tensors="pt").pixel_values

generated_ids = model.generate(pixel_values=pixel_values, max_length=50, num_beams=3)
generated_caption = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(generated_caption)
```

### Expected behavior

GIT model should work with beam search.

Comments:
using raw string for regex to search <extra_id>
Author: pfliu-nlp
Pull request: yes

# What does this PR do?

Similar to this: https://github.com/huggingface/transformers/pull/21125

This change replaces the regex pattern written in a Unicode string with a raw string for these two files:
* `tokenization_t5.py`
* `test_tokenization_t5.py`

Also checked, and no more:)


## 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?

Hi, @ArthurZucker @sgugger. Would you be happy to review this PR?
## Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

<!-- Your PR will be replied to more quickly if you can figure out the right person to tag with @

 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.

Models:

- text models: @ArthurZucker and @younesbelkada
- vision models: @amyeroberts and @NielsRogge
- speech models: @sanchit-gandhi
- graph models: @clefourrier

Library:

- flax: @sanchit-gandhi
- generate: @gante
- pipelines: @Narsil
- tensorflow: @gante and @Rocketknight1
- tokenizers: @ArthurZucker
- trainer: @sgugger



Integrations:

- deepspeed: @stas00
- ray/raytune: @richardliaw, @amogkam

Documentation: @sgugger, @stevhliu and @MKhalusova

HF projects:

- accelerate: [different repo](https://github.com/huggingface/accelerate)
- datasets: [different repo](https://github.com/huggingface/datasets)
- diffusers: [different repo](https://github.com/huggingface/diffusers)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Maintained examples (not research project or legacy):

- Flax: @sanchit-gandhi
- PyTorch: @sgugger
- TensorFlow: @Rocketknight1

 -->


Comments:
_The documentation is not available anymore as the PR was closed or merged._
Flax `.from_pretrained` fails to use `subfolder`
Author: keturn
Pull request: no

### System Info

- transformers 4.23.1
- Ubuntu 22.04
- jax 0.3.23
- huggingface_hub 10.0.1

`!transformers-cli env`:

<details>
<summary>ModuleNotFoundError: No module named 'datasets'</summary>

```
Traceback (most recent call last):
  File "🏠/venv.lab/bin/transformers-cli", line 5, in <module>
    from transformers.commands.transformers_cli import main
  File "🏠/venv.lab/lib/python3.10/site-packages/transformers/commands/transformers_cli.py", line 24, in <module>
    from .pt_to_tf import PTtoTFCommand
  File "🏠/venv.lab/lib/python3.10/site-packages/transformers/commands/pt_to_tf.py", line 21, in <module>
    from datasets import load_dataset
ModuleNotFoundError: No module named 'datasets'
```

</details>


### Who can help?

@patil-suraj for Flax and also CLIP


### Information

- My own modified scripts


### Reproduction

```py
from transformers import FlaxCLIPTextModel
text_encoder = FlaxCLIPTextModel.from_pretrained(
    "CompVis/stable-diffusion-v1-4",
    revision="flax",
    subfolder="text_encoder",
)
```

fails with 
> HTTPError: 404 Client Error: Not Found for url: 
https://huggingface.co/CompVis/stable-diffusion-v1-4/resolve/flax/config.json
> OSError: CompVis/stable-diffusion-v1-4 does not appear to have a file named config.json. Checkout 
'https://huggingface.co/CompVis/stable-diffusion-v1-4/flax' for available files.


### Expected behavior

a FlaxCLIPTextModel is created from https://huggingface.co/CompVis/stable-diffusion-v1-4/blob/flax/text_encoder/config.json

related: #18184 

Comments:
note that this _does_ work with the non-Flax CLIPTextModel.

cc @sanchit-gandhi 

Hey @keturn! The command `transformers-cli env` is failing as you don't have `datasets` installed. You can install `datasets` through:
```
pip install datasets
```
or from main: https://github.com/huggingface/datasets

With regards to the Flax `.from_pretrained()` method failing with `subfolder`, the PR you've mentioned implemented the `subfolder` feature for PyTorch but not Flax! Would you like to have a go at implementing this feature in Flax? The PR can largely follow the changes made in https://github.com/huggingface/transformers/pull/18184.

Hey @keturn, just following up here! Let me know if you'd be keen to open a PR - I can help you with with pointers and any questions you might have! Otherwise I can take look next week 🤗

oh, I don't expect to get to this anytime soon myself. 

Hey @keturn - have added it to my TODOs!

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.
Fine Tuned GPT2 model performs very poorly on token classification task
Author: Dhanachandra
Pull request: no

## Environment info

- `transformers` version: 4.17.0.dev0
- Platform: Linux-5.4.144+-x86_64-with-Ubuntu-18.04-bionic
- Python version: 3.7.12
- PyTorch version (GPU?): 1.10.0+cu111 (True)
- Tensorflow version (GPU?): 2.7.0 (True)
- 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?: <fill in>

###Models:
- GPT-2: @patrickvonplaten, @LysandreJik

## Information

Model I am using gpt2:

The problem arises when using:
* [run_ner ] the official example scripts:

The tasks I am working on is:
Token classification on ncbi_disease dataset

## To reproduce
python run_ner.py \
  --model_name_or_path gpt2 \
  --dataset_name ncbi_disease \
  --output_dir /tmp/test-ner \
  --do_train \
  --do_eval
The f1-score after fine-tuning for 3 epoch is only 0.6114 whereas roberta-base provides f1 score of 0.8358 on the evaluation dataset. 

Comments:
Hey @Dhanachandra,

As this is not an obvious bug, could you please try to make use of the forum: https://discuss.huggingface.co/ here instead?

Sorry, @patrickvonplaten, 
Due to curiosity to know the reason, I was posting the querry here. 

That's totally fine! I hope you'll find some help on the forum :-)

Just commenting on this since I was trying to do a similar thing. I unfortunately had some false-confidence since the code specifically checks for `gpt2` config. Hopefully this will help people looking at this in the future! 

There is a subtle oversight in the code for decoder-only models. The `run_ner.py` code puts the label on the first of tokenized inputs. So for example:
```
Inputs: "He is on the ketogenic diet"
Label: "ketogenic diet" -> treatment
Tokenized-inputs: ["He", "is", "on", "the", "ke", "to", "genic", "diet"]
Old Model Labels: [0, 0, 0, 0, 1, -100,  -100,  1]
```

So it will only see "ke" before needing to make a prediction. This should be changed to the following:
```
Tokenized-inputs: ["He", "is", "on", "the", "ke", "to", "genic", "diet"]
New Model Labels: [0, 0, 0, 0, -100, -100, 1, 1]
```
Adapt repository creation to latest hf_hub
Author: sgugger
Pull request: yes

# What does this PR do?

This PR adapts the code to push the trained model to the Hub to the latest APIs in `huggingface_hub`. In particular, `Repository` is no longer responsible for the distant repo creation, so this PR switches to the use of `create_repo`. We relied on this behavior in:
- the Trainer
- all PyTorch no_trainer examples
- all Flax examples
- some tests

It also uses the new `token` keyword argument instead of `use_auth_token`, which is the reason for the version bump (`Repository` in v0.10 still expects `use_auth_token`). I updated all the uses I could find to pass from `use_auth_token` to `token` as part of this PR.

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

> It also uses the new token keyword argument instead of use_auth_token,

It is indeed good practice to drop `use_auth_token` whenever possible when using `huggingface_hub` (in favor of `token`). Just to mention it, using `use_auth_token` would still work (without deprecation yet) so if you missed some occurrences, it will not break.
Rewrite a couple of lines in the TF XLA doc
Author: Rocketknight1
Pull request: yes

This PR makes a quick edit at the top of the TF XLA doc to clarify that for training/inference you can just pass `jit_compile` to `model.compile()`! (cc @sayakpaul )

Comments:
(Going to assume this one is small enough to merge without @sgugger approval, but feel free to yell at me if it wasn't!)

_The documentation is not available anymore as the PR was closed or merged._
[issues template] update deepspeed owners
Author: stas00
Pull request: yes

add the right contact for deepspeed@accelerate


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

That's an excellent idea, Sylvain. Added.

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_21027). All of your documentation changes will be reflected on that endpoint.
Starts on a list of external deps required for dev
Author: colindean
Pull request: yes

I've found that I need to install MeCab manually on my AS Mac while working on #18702.

# What does this PR do?

Adds nudge to install MeCab from Homebrew to dev contributing instructions.

## 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?


## Who can review?

Documentation: @sgugger



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