noamaanMulla-03/transformers-issues huggingface dataset:
finding a bug in training the code of /src/transformers/models/detr/modeling_detr.py
Author: zhangbo2008
Pull request: no

finding a bug in training the code of https://github.com/huggingface/transformers/blob/f74655cd9b2e316af9d862968bc59c15d6849cad/src/transformers/models/detr/modeling_detr.py

https://github.com/huggingface/transformers/blob/f74655cd9b2e316af9d862968bc59c15d6849cad/src/transformers/models/detr/feature_extraction_detr.py#L616
should change  encoded_inputs["targets"] to  encoded_inputs["labels"]
because in  https://github.com/huggingface/transformers/blob/f74655cd9b2e316af9d862968bc59c15d6849cad/src/transformers/models/detr/modeling_detr.py#L1350  we use variable of name labels in the function.






Comments:
Oh yeah, that makes sense, thanks for spotting it. I didn't have an issue with it as I never directly provided labels created by `DetrFeatureExtractor` to the model, but in case you do, you indeed will encounter an error.

Will update it!
Add out of vocabulary error to ASR models
Author: will-rice
Pull request: yes

# What does this PR do?
This PR adds a check to Wav2Vec2 and Hubert models to ensure the labels do not contain values greater than the configured vocab size.  

Fixes # (issue)
https://github.com/huggingface/transformers/issues/12270

## 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/master/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/master/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/master/docs#writing-source-documentation).
- [x] Did you write any new necessary tests?


## Who can review?

@patrickvonplaten 

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:

- 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:
fix ids_to_tokens naming error in tokenizer of deberta v2
Author: hjptriplebee
Pull request: yes

# What does this PR do?

"ids_to_tokens" is named as "id_to_tokens" in tokenizer of deberta v2, which may cause an exception when "convert_ids_to_tokens" is called. So fix ids_to_tokens naming error in tokenizer of deberta v2. 

## Before submitting
- [X] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [ ] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/master/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/master/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/master/docs#writing-source-documentation).
- [ ] 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.

<!-- 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:
🌟 New model addition: FNet
Author: changjonathanc
Pull request: no
Labels: name: New model

# 🌟 New model addition: FNet

FNet is a highly efficient Transformer-like encoder architecture, wherein the self-attention sublayers have been wholly replaced by standard, unparameterized Fourier Transforms.


I would like to help adding this!

## Open source status

* [x] the model implementation is available: https://github.com/google-research/google-research/tree/master/f_net
* [x] the model weights are available: https://github.com/google-research/google-research/tree/master/f_net
* [x] who are the authors: (@ilyaeck @santiontanon) (Not sure, googled the authors' name + github, sorry if it's incorrect)

Comments:
Somebody is already working on this, see #12335 

Thanks @NielsRogge , weird that I didn't see it when I searched.

@cccntu I believe what you want for the JAX/Flax community week is a Flax model. It seems unlikely that I will finish the PR in the next week. Maybe, you can start working on the Flax model parallely?

Or, we can discuss over slack and then try to finish both.

@patil-suraj @patrickvonplaten wdyt? Is it easier to go from PyTorch to Flax? Or it doesn't matter at all? In case PT is needed, I am willing to spend my time next week on this and try to finish it.



@gchhablani Yes! I would love to add the Flax part. 
@patil-suraj @patrickvonplaten  I have a few questions before I proceed: 
* There is no license in the original repo, should I email the authors for permission for code and weights? 
* How much of the original model code should I modify, other than wrapping it in huggingface/transformers classes?
Should we refactor it for better weight alignment with pytorch code e.t.c?

Thanks!



Great @cccntu! Let's discuss over Slack.
Easily train a new fast tokenizer from a given one - tackle the special tokens format (str or AddedToken)
Author: SaulLu
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.
-->

This PR is a sub-PR of the feature developed in PR #12361.

In the `train_new_from_iterator` method, the user can indicate that he wants to change the wording of a special token with the `special_tokens_map` argument. 

In terms of behavior, we expect the resulting tokenizer to have special tokens that behave like the special tokens that were in the initial tokenizer. In other words, if in the initial token the special token linked to the `mask_token` was an `AddedToken` with `lstrip=True` then this parameter must be kept in the new trained tokenizer even if the user in the `special_tokens_map` argument indicates that the wording changes. For example from `[MASK]` to `<mask>`.

This PR proposes this behavior and tests it


Comments:
Easily train a new fast tokenizer from a given one
Author: sgugger
Pull request: yes

# What does this PR do?

This PR does two different things at the same time:
- it allows to instantiate a subclass of a `PreTrainedTokenizerFast` with just the tokenizer object by making arguments like vocab or merges optional (only done for three models here but can complete if the design is accepted)
- adds a method to train a new fast tokenizer from an existing one, using the same normalizer, pre-tokenizers and post-processors.

With this done, one can do:
```
from transformers import AutoTokenizer

checkpoint = "bert-base-cased" # or any checkpoint that has a fast tokenizer.
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
assert tokenizer.is_fast, "This only works for fast tokenizers."

# Should be a generator of list of texts.
training_corpus = [
    ["This is the first sentence.", "This is the second one."],
    ["This sentence (contains #) over symbols and numbers 12 3.", "But not this one."],
]
new_tokenizer = tokenizer.train_new_from_iterator(training_corpus, vocab_size=25000)
```
The new tokenizer can then be used, saved, pushed to the hub. It has the same type as `tokenizer`.

Comments:
Failure is spurious, so merging!
[Flax][WIP] Addition of Flax-Wav2Vec Model
Author: bhadreshpsavani
Pull request: yes

# What does this PR do?
This PR is for the addition of Wav2Vec Model 

## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [ ] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/master/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/master/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/master/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


## Who can review?
@patil-suraj

Comments:
Cool PR! For next steps, we should write the missing classes and remove everything which is related to:

```
feat_extract_norm="group"
do_stable_layer_norm=True
```

(This config parameters are only used for https://huggingface.co/facebook/wav2vec2-base-960h which is the oldest of the wav2vec2 models)

Also, it would be very important to add tests in `modeling_flax_wav2vec2.py` 

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.

Closing this in favor of https://github.com/huggingface/transformers/pull/12271
HfArgumentParser defaults booleans to on
Author: Craigacp
Pull request: no

## Environment info
- `transformers` version: 4.9.0.dev0 (initially discovered on 4.8.1)
- Platform: macOS-11.4-x86_64-i386-64bit
- Python version: 3.9.5
- PyTorch version (GPU?): not installed (NA)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed

### Who can help
@sgugger

## Information

HfArgumentParser when used on a dataclass with a bool field with no default turns the bool on unless it's supplied with `--<field_name> False` or similar "false-y" value. I would expect that as the field has no default it should be false unless `--<field_name>` or `--<field_name> True` is supplied.  This is a behaviour change from `v3.0.0` where the booleans are parsed correctly as we're looking at upgrading and this issue hit us.

## To reproduce

Steps to reproduce the behavior:

1. Define a dataclass with a boolean field
2. Supply a list of arguments which does not include that field name
3. The field is turned on.

Appending this snippet to the bottom of [`test_basic` at line 110](https://github.com/huggingface/transformers/blob/master/tests/test_hf_argparser.py#L110) in `test_hf_argparser.py` fails the test.

```python

        args = ["--foo", "1", "--baz", "quux", "--bar", "0.5"]

        example, = parser.parse_args_into_dataclasses(args, look_for_args_file=False)

        self.assertFalse(example.flag)
```

Extending `args` with `["--flag","False"]` recovers the expected behaviour.

## Expected behavior

The boolean should be set to false if the argument is not passed in.

Comments:
If you agree this is a bug in the parsing logic then we'd be happy to fix it and send a PR.

Yes, it does look like a bug. Fix is quite simple, I can make a PR.

Ok thanks. That saves me a job later this week.

If you want to have a look at the PR mentioned above and check it does give the expected behavior, that would be great!

Ok, I'll check it tomorrow against our internal use case to make sure it fixes that too.
Fix default bool in argparser
Author: sgugger
Pull request: yes

# What does this PR do?

As outlined in #12423, in a dataclass with no default for a bool parameter, the bool ended up defaulting to `True` when not passed, which is the opposite of the wanted behavior.
Fixes #12423

Comments:
Do you want to pull in the test snippet from the issue to make sure it doesn't happen again? That test doesn't actually parse any arguments at the moment, so it relies on the argparser being configured right in the test, which is more error prone than just parsing simple things and checking them.
Add default bos_token and eos_token for tokenizer of deberta_v2
Author: hjptriplebee
Pull request: yes

# What does this PR do?
Add default bos_token and eos_token for tokenizer of deberta_v2

## 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/master/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/master/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/master/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


## Who can review?

@n1t0, @LysandreJik



Comments:
Add new CANINE model
Author: stefan-it
Pull request: no
Labels: name: New model

# 🌟 New model addition

## Model description

Google recently proposed a new **C**haracter **A**rchitecture with **N**o tokenization **I**n **N**eural **E**ncoders architecture (CANINE). Not only the title is exciting:

> Pipelined NLP systems have largely been superseded by end-to-end neural modeling, yet nearly all commonly-used models still require an explicit tokenization step. While recent tokenization approaches based on data-derived subword lexicons are less brittle than manually engineered tokenizers, these techniques are not equally suited to all languages, and the use of any fixed vocabulary may limit a model's ability to adapt. In this paper, we present CANINE, a neural encoder that operates directly on character sequences, without explicit tokenization or vocabulary, and a pre-training strategy that operates either directly on characters or optionally uses subwords as a soft inductive bias. To use its finer-grained input effectively and efficiently, CANINE combines downsampling, which reduces the input sequence length, with a deep transformer stack, which encodes context. CANINE outperforms a comparable mBERT model by 2.8 F1 on TyDi QA, a challenging multilingual benchmark, despite having 28% fewer model parameters.

Overview of the architecture:

![outputname-1](https://user-images.githubusercontent.com/20651387/113306475-6c3cac80-9304-11eb-9bad-ad6323904632.png)

Paper is available [here](https://arxiv.org/abs/2103.06874).

We heavily need this architecture in Transformers (RIP subword tokenization)!

The first author (Jonathan Clark) said on [Twitter](https://twitter.com/JonClarkSeattle/status/1377505048029134856) that the model and code will be released in April :partying_face: 

## Open source status

* [x] the model implementation is available: [here](https://caninemodel.page.link/code)
* [x] the model weights are available: [here](https://caninemodel.page.link/code)
* [x] who are the authors: @jhclark-google, @dhgarrette, @jwieting (not sure)



Comments:
Update on that: model and checkpoints are released:

https://github.com/google-research/language/tree/master/language/canine

:hugs: 

Hi @stefan-it, thanks for the update.
Do you know how we can use those pre-trained tensorflow checkpoints to get the pooled text representations from CANINE model?
Thanks

any updates on this ? 

Hi, 

I've started working on this. Forward pass in PyTorch is working, and giving me the same output tensors as the TF implementation on the same input data.

Will open a PR soon

Hi @dhgarrette,

I don't want to spam the CANINE PR with this question/discussion, so I'm asking it here in this issue 😅

So I would like to use CANINE for token classification (I'm currently implementing it into Flair framwork...), and for that reason tokenized input is passed to the model. For token classification using e.g. BERT one would use the first subword as "pooling strategy". But when using CANINE and following the subword "analogy", using the embedding of the first - let's say - character is a good strategy (instead of e.g. `mean`) 🤔
feat: add contributor over time graph to README
Author: guoqqqi
Pull request: yes

Hi, community!

To better present how our community grows, we develop a tool to show contributors growing history on [https://github.com/api7/contributor-graph](https://github.com/api7/contributor-graph). Since we found it helpful, we think maybe if it could help some other community.

## WHAT IT IS

Basically, it just shows the contributors growth over time, just like the stargazers over time on the README. It would be the same with stars that we would update the graph each day, so the link would always present the real-time data. There is some other stuff to play around with if you would like to give it a try~

![image](https://user-images.githubusercontent.com/72343596/119220139-8c763400-bb1b-11eb-8431-7d9d3c40ea49.png)

## HOW IT WORKS 

We use Github API to get all commits, try to find the “Github way” to filter commits so the result data would be similar to Github, and then get the first commit time of each user.

Don't hesitate to tell us if there is a better place to present this graph other than this, or there are some other worries or other features you would like to have~🍻


Comments:
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md) are likely to be ignored.
Add option to save on each training node
Author: sgugger
Pull request: yes

# What does this PR do?

There is currently a problem when using `load_best_model_at_end=True` on a training with multiple nodes: the model is only saved on the main process (so the machine rank 0) and machine with other ranks can't see the saved model (unless the system uses some kind of shared storage). This PR adds a flag to enable the save on each node for that situation, and avoids the hard failure when the model to reload is not found.

Comments:
[Flax] Add wav2vec2
Author: patrickvonplaten
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 -->

Adds Wav2Vec2 in Flax

- [x] FlaxCTCWav2Vec2
- [x] FlaxForPreTraining
- [x] FlaxWav2Vec2 random mask code
- [x] Clean-up
- [x] Write pretraining script

Comments:
Anything I can help with ? 
Looking forward to use Flax Wav2vec for the community event :)

Hey @ThomAub - that's very nice of you! I will need to spend a couple more hours on this and then add pretraining as well. One thing that would be very helpful would be to check how to do the GumbelSoftmax in Flax. *I.e.* how can we translate this: https://github.com/huggingface/transformers/blob/f2c4ce7e339f4a2f8aaacb392496bc1a5743881f/src/transformers/models/wav2vec2/modeling_wav2vec2.py#L751 PyTorch module to Flax? This might be a bit difficult and require some googling to see if others have already implement gumbel softmax in jax/Flax or not. If you could take a look at this, it would be very useful! 

I guess I wasn't fast enough ! Great work 

@patil-suraj @sgugger - actually this is still WIP. Sorry for tagging you too early
Add test for a WordLevel tokenizer model
Author: SaulLu
Pull request: yes

# What does this PR do?

In this PR I propose to add a test for the feature developed in PR #12361. Unless I'm mistaken, no language model tested currently uses a tokenizer that would use the WordLevel model. 

The tokenizer created for this test is hosted here: [https://hf.co/robot-test/dummy-tokenizer-wordlevel](https://huggingface.co/robot-test/dummy-tokenizer-wordlevel)


Comments: