noamaanMulla-03/transformers-issues huggingface dataset:
Added tokenize keyword arguments to feature extraction pipeline
Author: quancore
Pull request: yes

# What does this PR do?

The PR adds keyword arguments for the tokenizer for the feature extraction pipeline. Fixes: https://github.com/huggingface/transformers/issues/19374


## 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).
- [x] Did you write any new necessary tests?


## 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.
@LysandreJik
@Narsil

<!-- 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:

- albert, bert, xlm: @LysandreJik
- blenderbot, bart, marian, pegasus, encoderdecoder,  t5: @patrickvonplaten, @patil-suraj
- longformer, reformer, transfoxl, xlnet: @patrickvonplaten
- fsmt: @stas00
- funnel: @sgugger
- gpt2: @patrickvonplaten, @LysandreJik
- rag: @patrickvonplaten, @lhoestq
- tensorflow: @LysandreJik

Library:

- benchmarks: @patrickvonplaten
- deepspeed: @stas00
- ray/raytune: @richardliaw, @amogkam
- text generation: @patrickvonplaten
- tokenizers: @n1t0, @LysandreJik
- trainer: @sgugger
- pipelines: @LysandreJik

Documentation: @sgugger

HF projects:

- datasets: [different repo](https://github.com/huggingface/datasets)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Examples:

- maintained examples (not research project or legacy): @sgugger, @patil-suraj
- research_projects/bert-loses-patience: @JetRunner
- research_projects/distillation: @VictorSanh

 -->


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

After checking, the broken tests are exactly broken by the lack of `truncation` support.

Also for quality you should be able to to 
```
pip install -e .[dev] #  or pip install transformers[dev]
make fixup
```
Cheers.

@Narsil I made the changes you indicate.

@sgugger I have moved the import to top.

Thanks a lot!
`python3` instead of `python` in Push CI setup job
Author: ydshieh
Pull request: yes

# What does this PR do?

The `setup` job in push CI uses image `transformers-all-latest-gpu-push-ci`, which should use `python3` instead of `python`.
(I forgot this detail when working on #19054)

Currently, the setup job failed, and no test to run.

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

Actually, `python` is not found. I think we need to tweak a bit if we want to use `python` as `python3`. Do you want me to work on the docker image for  this purpose?

```bash
/__w/_temp/5f33851e-ac7e-4126-b3d7-88092ae0b56d.sh: 2: python: not found
```

No, don't worry. I was just complaining about the action env, not your PR :-)
Update PT to TF CLI for audio models
Author: amyeroberts
Pull request: yes

# What does this PR do?

Fixes small issues which prevented converting checkpoints for the whisper model with the pt-to-tf CLI.  

* `"raw_speech"` -> `"audio"`: updates the name of the inputs fed to the processor. This reflects the deprecation of `raw_speech` in [the audio processors](https://github.com/huggingface/transformers/blob/331ea019d7053924ee4d9d4d30282a2c74c272a6/src/transformers/models/wav2vec2/processing_wav2vec2.py#L79)
* Takes the feature extractor's default padding strategy if it's not False. Otherwise sets it to True. This was needed as whisper models must be padded to the max sequence length (not to the max sequence in the batch). Whereas other speech models' feature extractors can run with `padding=True` but don't have max length set by default so will fail if `padding="max_length"` e.g. `"facebook/s2t-small-librispeech-asr"` 


## 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._

> This was causing the conversion script to throw exceptions with Whisper, correct?

@gante Exactly. I modified it locally to push the weights to the hub. This PR is a tidier version of the changes I made i.e. not breaking it for other models.
Bert config changes 
Author: imarekkus
Pull request: yes

# What does this PR do?

Fixes # (issue)
Fixed done in accordance with below issue
![image](https://user-images.githubusercontent.com/49692939/195178992-fe4f6bd2-8af5-42f0-a6a5-fcc74b0a85f1.png)

Tests passed
![image](https://user-images.githubusercontent.com/49692939/195178754-a9161007-b198-4b20-a3bd-5dd97273de66.png)


Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_19495). All of your documentation changes will be reflected on that endpoint.
Use a dynamic configuration for circleCI tests
Author: sgugger
Pull request: yes

# What does this PR do?

This PR entirely rewrites the circle CI setup for the tests run at each commit, to use a configuration generated on the fly depending on which tests should be run. It also offers a Python wrapper around the circleCI API via the new util `create_circleci_config.py`.

This way, when a commit does no modification in the source code/tests/examples, only the quality jobs and the test fetcher are run (see the job below this PR). When a modification only touches the examples, the quality jobs and the example tests are run (see this [job](https://app.circleci.com/pipelines/github/huggingface/transformers/48462)) and when a modification touches some code, all tests jobs and example tests are run (tests jobs running on impacted tests only) as seen in this [report](https://app.circleci.com/pipelines/github/huggingface/transformers/48461).

The generated config is stored as an artifact in the `fetch_tests` job (in txt format because yml would not be rendered).

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

Feel free to merge whenever ready
Compute true loss Flax examples
Author: duongna21
Pull request: yes

# What does this PR do?

'True' losses should be computed in Flax examples, as [discussed](https://github.com/huggingface/transformers/pull/18297#discussion_r931971230) with @sanchit-gandhi.


## Who can review?
cc @sanchit-gandhi @patrickvonplaten 



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

@duongna21 super sorry it seems like the git commit history got messed up :-/ Any chance you could re-submit your PR?
Anything but plain "greedy" search "not implemented for 'Half'"
Author: auwsom
Pull request: no

### System Info

`transformers-cli env`=
```
Traceback (most recent call last):
  File "/home/user/.local/bin/transformers-cli", line 5, in <module>
    from transformers.commands.transformers_cli import main
  File "/home/user/.local/lib/python3.10/site-packages/transformers/commands/transformers_cli.py", line 24, in <module>
    from .pt_to_tf import PTtoTFCommand
  File "/home/user/.local/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'
```
https://colab.research.google.com/drive/1YORPWx4okIHXnjW7MSAidXN29mPVNT7F?usp=sharing

### Who can help?

@sgugger, @patil-suraj

Im following:
https://colab.research.google.com/drive/1YORPWx4okIHXnjW7MSAidXN29mPVNT7F
from:
https://huggingface.co/blog/hf-bitsandbytes-integration

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

I love being able to use the int8 models! And being able to run the big LLMs on Colab. However, I just discovered that only the default search algo works. This is too bad, because for a chat application, the TopK sampling provides much more natural variation.

Beam:
RuntimeError: "log_softmax_lastdim_kernel_impl" not implemented for 'Half'
Topk:
RuntimeError: "topk_cpu" not implemented for 'Half'

### Expected behavior

being able to use TopK and TopP sampling on int8 optimized models

Comments:
Hey @auwsom ! 
Thanks for your message! Indeed it would be better to support all the possible sampling procedures for 8-bit models 💪 
There is definitely something around half-precision logits and `generate` that needs a closer look! 
Also this seems to be a duplicate of https://github.com/TimDettmers/bitsandbytes/issues/42#issuecomment-1272877078 - so tagging the issue here 

Will look into it ASAP! 

Hey @auwsom !
Thanks for your patience!
It appears that the workaroud is pretty much straightforward, could you run `generate` with `inputs_ids` set to a GPU device? For example by making sure that: 
```
input_ids = input_ids.to('cuda')
```
`generate` yields an error since by instantiating a model with `device_map=auto` forces the output of the model to be on the same device as the input. In the snippet in https://github.com/TimDettmers/bitsandbytes/issues/42#issuecomment-1272877078 the `input_ids` are set on the `cpu`. I believe that making sure that these are on the GPU should do the trick for you, before waiting a proper fix to be merged in #19468 ? Could you confirm that this workaround fixes your issue? Thanks!

@younesbelkada yes, this works on the example notebook on Colab. Thanks!
Avoid Push CI failing to report due to many commits being merged
Author: ydshieh
Pull request: yes

# What does this PR do?

We have increasing commits merged recently, and when it happens in a very period of short time (4 merges in ~ 1min yesterday), we get an error when using `actions/checkout@v2` in the `workflow_run` event for **Push CI**

```bash
fatal: reference is not a tree: 5f5e264a12956bd7cce47dcb422b80ed68e4c24e
```

So this PR increases the fetch depth to 20, and hopefully we are safe with this number 😆 
```
fetch-depth: 20
```

Comments:
@sgugger Probably it's good for L to know this change - your call :-)

_The documentation is not available anymore as the PR was closed or merged._
Add LiLT
Author: NielsRogge
Pull request: yes

# What does this PR do?

This PR adds LiLT, a simple way to extend LayoutLM to any language that has a pre-trained RoBERTa checkpoint.

To do:

- [x] setup new organization, transfer checkpoints
- [x] make tests faster
- [x] remove is_decoder logic

Comments:
_The documentation is not available anymore as the PR was closed or merged._
bart config changes
Author: imarekkus
Pull request: yes

# What does this PR do?
PR for issue below:
![image](https://user-images.githubusercontent.com/49692939/195200740-7f361283-4246-4550-9fc9-33d6d7e5b6e8.png)

Test passed:
![image](https://user-images.githubusercontent.com/49692939/195200622-146ee670-dbc4-4a84-a555-3565b29cb749.png)


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

Not sure why it fails the check_code_quality test. Doing exactly what is written here: https://github.com/huggingface/transformers/pull/19485


> Not sure why it fails the check_code_quality test. Doing exactly what is written here: #19485

Hi @imarekkus Could you try to run `make style` and see what happens?
Also, please do not change the `configuration_bert.py` in this PR, it is done in #19485, thank you 🙏
Update configuration_bart.py
Author: imarekkus
Pull request: yes

Update following #19487 issue

![image](https://user-images.githubusercontent.com/49692939/195312422-1f70218d-ede7-48cc-9392-6bd7c02d1b87.png)


Tests passed

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_19517). All of your documentation changes will be reflected on that endpoint.
Update configuration_bart.py
Author: imarekkus
Pull request: yes

Updated bart config in accordance with this issue:
![image](https://user-images.githubusercontent.com/49692939/195330903-af849c7a-b711-4c9d-93e3-f6612c2413ec.png)

Tests passed
![image](https://user-images.githubusercontent.com/49692939/195330933-b984cac2-d74e-4a86-9e81-fca680586123.png)



Comments:
_The documentation is not available anymore as the PR was closed or merged._
Can't load tokenizer for 'imxly/t5-pegasus'.
Author: xiaojinglu
Pull request: no

when I use t5-pegasus on huggingface.co, What's the problem？
<img width="1589" alt="截屏2021-06-18 上午11 10 34" src="https://user-images.githubusercontent.com/12478408/122500741-e76d4f00-d025-11eb-839c-96f259c89af0.png">


Comments:
The tokenizer specified for that model is `T5Tokenizer`, which is a sentencepiece-based tokenizer. However, the tokenizer file is `vocab.txt`, which is a BERT-like (WordPiece) file.

The T5 tokenizer expects as `spiece.model` file generated by the SentencePiece library, or a `tokenizer.json` file generated by the Tokenizers library.

> The tokenizer specified for that model is `T5Tokenizer`, which is a sentencepiece-based tokenizer. However, the tokenizer file is `vocab.txt`, which is a BERT-like (WordPiece) file.
> 
> The T5 tokenizer expects as `spiece.model` file generated by the SentencePiece library, or a `tokenizer.json` file generated by the Tokenizers library.

so is it the fault of the uploaded model ?

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/master/CONTRIBUTING.md) are likely to be ignored.

Can't load tokenizer for './models/t5-pegasus'

下载后使用也存在这个问题
ERNIE and tensorflow2
Author: Smile-L-up
Pull request: no
Labels: name: TensorFlow

name: New model

### Feature request

Checked the transformersss Explanatory document , I found that only ErnieModel that supports torch exists. Is there any plan to release TFErnieModel later?

### Motivation

I am using the tensoflow2 framework  and want use ERNIE.

### Your contribution

sorry.

Comments:
cc @amyeroberts 

Hi @Smile-L-up. Thanks for raising this issue. 

You can check if there's any ongoing work to port a model to TensorFlow, by searching the [open issues](https://github.com/huggingface/transformers/issues?q=is%3Aissue+is%3Aopen+ernie) and [PRs](https://github.com/huggingface/transformers/pulls?q=is%3Apr+is%3Aopen+ernie). I don't think there's any plans or ongoing work to port ERNIE. 

If you're interested in adding the model yourself, we have a great guide showing all the steps [here](https://huggingface.co/docs/transformers/v4.23.1/en/add_tensorflow_model) and we're of course happy to help along the way.
fill-mask with roberta-base and --targets options
Author: mabomb
Pull request: no

Dear @sgugger,
I was trying to use the fill-mask function starting from "roberta-base" and limiting the search to target words using the --targets option.
For numerous target words, however, I get the warning that the word does not exist in the vocabulary.

An example is followed:
```
from transformers import pipeline

unmasker = pipeline('fill-mask', model="roberta-base", tokenizer="roberta-base", top_k=10)
filled = unmasker("When I am hungry, I eat a <mask>.", targets=["pizza", "banana", "pasta"])
for r in filled:
    print(r['token_str'], "->", r['score'])

```
The output is:

```
The specified target token `pizza` does not exist in the model vocabulary. Replacing with `p`.
The specified target token `banana` does not exist in the model vocabulary. Replacing with `ban`.
The specified target token `pasta` does not exist in the model vocabulary. Replacing with `past`.
p -> 1.0362288094256655e-07
ban -> 1.0942345918252272e-09
past -> 5.667477598336745e-10
```

This problem does not exist with BERT:
```
pizza -> 0.0014738412573933601
banana -> 0.0009286535205319524
pasta -> 1.1728033314284403e-05
```
Could you explain to me the reason for this behaviour? How can I fix it?

Comments:
Hi there! Please use the [forums](https://discuss.huggingface.co/) for such questions as we keep issues for bugs and feature requests only. In this instance, it's because RoBERTa uses a different tokenization algorithm than BERT which mark the beginning of each word with a special symbol.

Thanks!
Fix pytorch seq2seq qa
Author: FilipposVentirozos
Pull request: yes

I created this pull request based on our discussion https://github.com/huggingface/transformers/issues/15398#issuecomment-1262926868

I also changed the typo in the README for the SQuADs feature. Then I also saw that the [trainer_seq2seq_qa.py](https://github.com/huggingface/transformers/blob/main/examples/pytorch/question-answering/trainer_seq2seq_qa.py) changed since I had it locally. And it caused me an issue, below you can see the slight adjustment, basically similar to how it was before.

I had been using the [run_seq2seq_qa.py](https://github.com/huggingface/transformers/blob/main/examples/pytorch/question-answering/run_seq2seq_qa.py) file with local text files, slightly adjusting the code, so I have tried with a `--do_predict` on my local setting, but not for an online dataset.



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

Gently pinging @sgugger for final approval.

`test_run_swag_no_trainer` failed but it is not related to this PR :thinking:
Add depth estimation pipeline
Author: NielsRogge
Pull request: no
Labels: name: Good First Issue

### Feature request

We currently have 2 monocular depth estimation models in the library, namely [DPT](https://huggingface.co/docs/transformers/model_doc/dpt) and [GLPN](https://huggingface.co/docs/transformers/model_doc/glpn).

It would be great to have a pipeline for this task, with the following API:

```
from transformers import pipeline

pipe = pipeline("depth-estimation")
pipe("cats.png")
```

This pipeline could default to the https://huggingface.co/Intel/dpt-large checkpoint. Also check out the [Space](https://huggingface.co/spaces/nielsr/dpt-depth-estimation) that showcases the model.

This can be implemented similar to [other pipelines](https://github.com/huggingface/transformers/tree/main/src/transformers/pipelines). For an example PR that added a pipeline, see https://github.com/huggingface/transformers/pull/11598.

### Motivation

Pipelines are a great way to quickly perform inference with a model for a given task, abstracting away all the complexity.

### Your contribution

I can assist with this, together with @Narsil.

Comments:
What would be the output like @NielsRogge  ?

My understanding is that depth is just a gray scale image (black = infinitely far, white = infinitely close).


If that's the case It seems really close to `image-segmentation` in the sense that it's generating a new image from the original image, so we should try and reuse as much as possible.

Also maybe we could have something like `image-generation` to try and keep the name generic ? (And have an alias for `depth-estimation` for instance ?)


Hi @NielsRogge I would like to add this pipeline. 

Hi @Narsil,

I'm not sure whether we should add this to the existing `image-segmentation` pipeline. Depth estimation is basically pixel regression, rather than pixel classification (the latter is image segmentation). It would be quite confusing to add it there.

Depth estimation is quite a different field, see e.g. https://paperswithcode.com/task/depth-estimation

And hi @nandwalritik, thanks for your interest in this. Feel free to start a draft PR.

Thanks I will start working on it.

> I'm not sure whether we should add this to the existing image-segmentation pipeline.

I said we should inspire from it, not reuse it, but I suggested using an `image-generation`one. (Just to be slightly more general)
The output is a grayscale image, right ?
Bart configuration update
Author: imarekkus
Pull request: yes

Update to bart config.
![image](https://user-images.githubusercontent.com/49692939/195334601-7dc95d78-a587-403b-8edd-bbb9c6467de8.png)


Tests passed
![image](https://user-images.githubusercontent.com/49692939/195334485-fef47414-cb7d-431c-8c69-2c7cce686804.png)


Comments:
Hey @ydshieh! It turned out that copy-pasting the "(with random weights)" text was causing the check_code_quality test failure. But unfortunately I don't know what is causing this ConnectionResetError: [Errno 104] while building PR Documentation

> Hey @ydshieh! It turned out that copy-pasting the "(with random weights)" text was causing the check_code_quality test failure.
Glad it works now 💯 Thank you!


> But unfortunately I don't know what is causing this ConnectionResetError: [Errno 104] while building PR Documentation
You can ignore this :-)


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