noamaanMulla-03/transformers-issues huggingface dataset:
word_to_tokens method of XLNetTokenizerFast not behaving correctly
Author: linfeng-du
Pull request: no

## 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: 4.3.3


### Who can help
@LysandreJik 


## Information
The `word_to_tokens` method of `XLNetTokenizerFast` seems not behaving correctly.

## To reproduce
Code below for example
```py
batch_claim = [
    ['Colin', 'Kaepernick', 'became', 'a'],
    ['Tilda', 'Swinton', 'is', 'a', 'vegan', '.']
]
batch_evidence = [
    ['He', 'remained', 'the', 'team', "'s", 'starting', 'quarterback'],
    ['Katherine', 'Matilda', '`', '`', 'Tilda', "''", 'Swinton', '-LRB-', 'born', '5', 'November', '1960']
]

tokenizer = XLNetTokenizerFast.from_pretrained('xlnet-base-cased')
# tokenizer = RobertaTokenizerFast.from_pretrained('roberta-base', add_prefix_space=True)
tokenized = tokenizer(
    batch_claim, batch_evidence,
    padding=True, truncation='do_not_truncate', is_split_into_words=True, return_tensors='pt'
)
print(tokenized)
print(tokenized.word_to_tokens(0, 0, 0))
```

gives None. (Maybe it's because that `XLNetTokenizer` pads on the front that causes this misbehavior?)

Output:
```
{'input_ids': tensor([[    5,     5,     5,     5,     5,     5,     5,     5,     5,     5,
             5,     5,     5,     5,  8041,  2066,    93,  1371,  9797,   403,
            24,     4,    69,  1493,    18,   230,    17,    26,    23,  1541,
          6217,     4,     3],
        [15731,  1011, 22588,   577,    27,    24, 28629,    17,     9,     4,
         17067,  6883,   902,  1011,  2651,  2651, 15731,  1011,    17,    12,
         22588,   577,    17,    13,  1039, 12573,    13,  1094,   306,   704,
          2726,     4,     3]]), 'token_type_ids': tensor([[3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1, 2],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1, 2]]), 'attention_mask': tensor([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1, 1],
        [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1, 1]])}
None
```

<!-- A clear and concise description of what you would expect to happen. -->


Comments:
Indeed, thanks for reporting. This is related to https://github.com/huggingface/tokenizers/issues/552

Thanks! Could you please indicate the time this could be fixed? I'll decide whether to align it locally haha..

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.
Request: New LM Adapted checkpoints for T5
Author: Xirider
Pull request: no
Labels: name: New model

# 🌟 New LM Adapted checkpoints for T5

## Description

Google released a new set of checkpoints for T5 v1.1. here:
https://github.com/google-research/text-to-text-transfer-transformer/blob/master/released_checkpoints.md#t511

Especially interesting for most people will be the checkpoints below, as finetuning T5 with a prompt or using T5 for conditional text generation is quite common and these checkpoints promise better performance. The default T5 v1.1 checkpoints have never seen sequences without sentinel tokens.

### LM-Adapted: t5.1.1.lm100k (copied from the readme)

These "LM adapted" models are initialized from t5.1.1 (above) and train for an
additional 100K steps on the LM objective discussed in the [T5 paper][paper].
This adaptation improves the ability of the model to be used for [prompt
tuning](https://arxiv.org/abs/2104.08691).

* **t5.1.1.lm100k.small** (~77 million parameters): [gs://t5-data/pretrained_models/t5.1.1.lm100k.small](https://console.cloud.google.com/storage/browser/t5-data/pretrained_models/t5.1.1.lm100k.small/)
* **t5.1.1.lm100k.base** (~250 million parameters): [gs://t5-data/pretrained_models/t5.1.1.lm100k.base](https://console.cloud.google.com/storage/browser/t5-data/pretrained_models/t5.1.1.lm100k.base/)
* **t5.1.1.lm100k.large** (~800 million parameters): [gs://t5-data/pretrained_models/t5.1.1.lm100k.large](https://console.cloud.google.com/storage/browser/t5-data/pretrained_models/t5.1.1.lm100k.large/)
* **t5.1.1.lm100k.xl** (~3 billion parameters): [gs://t5-data/pretrained_models/t5.1.1.lm100k.xl](https://console.cloud.google.com/storage/browser/t5-data/pretrained_models/t5.1.1.lm100k.xl/)
* **t5.1.1.lm100k.xxl** (~11 billion parameters): [gs://t5-data/pretrained_models/t5.1.1.lm100k.xxl](https://console.cloud.google.com/storage/browser/t5-data/pretrained_models/t5.1.1.lm100k.xxl/)

## Open source status

* [x] the model implementation is available: t5 v1.1. with geglu
* [x] the model weights are available: see links above
* [x] who are the authors: Brian Lester, Rami Al-Rfou, Noah Constant


Comments:
ImportError: cannot import name 'BertEncoder' from 'transformers'
Author: Tikquuss
Pull request: no

```
from transformers import  BertEncoder 
```

A week ago this import was working normally, but this morning I ran my code and got this error.
```
ImportError: cannot import name 'BertEncoder' from 'transformers' (unknown location)
```

How to import BertEncoder? ```'BertEncoder' in dir(transformers)``` is `False`

########################################
- `transformers` version: 4.8.1
- Platform: Linux-5.4.104+-x86_64-with-Ubuntu-18.04-bionic
- Python version: 3.7.10
- PyTorch version (GPU?): 1.9.0+cu102 (False)
- Tensorflow version (GPU?): 2.5.0 (False)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: No
- Using distributed or parallel set-up in script?: No

Comments:
Hello! I'm failing to find a version where this worked, going back to version 1.0.0. If you have it handy, could you point me to the version that had it?

If you want to import `BertEncoder` you can do it as such:
```
from transformers.models.bert.modeling_bert import BertEncoder
```
[Examples] Replace `print` statement with `logger.info` in QA example utils
Author: bhadreshpsavani
Pull request: yes

# What does this PR do?
Earlier in `utils_qa.py`,  `run_qa_beam_search.py` was using `print()` for showing states saving file paths, while `run_qa.py` using `logger.info()` which seems more appropriate.

This PR replace `print()` with `logger.info()`. 

## 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. Discussed in [Issue](https://github.com/huggingface/transformers/issues/12363)
- [ ] 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?
@stas00 @sgugger 

Comments:
Thanks!
ERROR: Failed building wheel for tokenizers
Author: JaheimLee
Pull request: no

## 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: 4.8.1
- Platform: Macbook pro M1 16G
- Python version: 3.8.10
- PyTorch version (GPU?):
- Tensorflow version (GPU?): 2.5.0

### Who can help
@LysandreJik

When I install transformers in my mac, this error occurred! 
`ERROR: Could not build wheels for tokenizers which use PEP 517 and cannot be installed directly`



Comments:
Hi! Could you open an issue on `tokenizers` instead? https://github.com/huggingface/tokenizers
same sentence different padding length result different embedding.
Author: JJplane
Pull request: no

I use nn.Softmax(dim=-1) to softmax. I find different outputs.
```
a = [-3.6180e-01,  6.6926e-01,  1.2248e+01, -9.5795e-01]
b = [-3.6180e-01,  6.6926e-01,  1.2248e+01, -9.5795e-01, -9.5795e-01]
```
softmax(a) = [3.3403e-06, 9.366**2**e-06, 9.999**9**e-01, 1.8402e-06]
softmax(b) =[3.3403e-06, 9.366**1**e-06, 9.999**8**e-01, 1.8402e-06, 1.8402e-06]
The different softmax results result in different sentence embedding, sometimes the embedding differ a lot.I test transeformers the question cant repoduce. This bug appears in  transformers  modified by our company.  Any help is appreciate!

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.
version of T5 is not reported in HuggingFace models 
Author: dorooddorood606
Pull request: no

Hi  @patrickvonplaten, @patil-suraj,
Google T5 model has two checkpoints, of t5.0.0 and t5.1.0, the performance of the two models is very different, in huggingface mdoels it is not specified which version HuggingFace is using, could you kindly add the details?
thanks

Comments:
Hi there,

for T5V1.1 models we explicitly mention it in the model name, for example see here 
https://huggingface.co/google/t5-v1_1-base

the model version is mentioned in the name as `v1_1`.

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.
Text Generation, adding random words, weird linebreaks & symbols at random.
Author: steeljardas
Pull request: no

Here's the code I'm using to generate text.

`sentence= tokenizer.encode(kw, return_tensors='pt')
output = model.generate(sentence, 
max_length = 500, 
no_repeat_ngram_size  = 2,
do_sample=False)
text.append(tokenizer.decode(output[0], skip_special_tokens = True))`

The issue is that the output often comes like this:

`What are the benefits of using collagen?

,,,

 ,
 ,

 ,,
, __________________, __________
The skin that has collagen has a higher level of hydrophilic (water-loving) proteins. `

or like this:

`Yes, collagen is a natural skin-repairing substance. It is also a powerful anti-inflammatory and antiaging agent.
, and, are the most common types of collagen found in skin.`

As you can see, at the start it wrote ", and," at random and it happens EXTREMELY often, nearly in every single text generation I did.

I don't know if it's related to my settings or not but I'd appreciate all the help you guys can give. I want to get my text to be as human-readable as possible & up to 100-500 words each input.

Comments:
Hi! Could you provide more information, especially regarding which model and tokenizer you're using? Also, you might have more luck asking on the [forum](https://discusss.huggingface.co), as GitHub issues are for bugs/feature requests.

Thanks!

> Hi! Could you provide more information, especially regarding which model and tokenizer you're using? Also, you might have more luck asking on the [forum](https://discusss.huggingface.co), as GitHub issues are for bugs/feature requests.
> 
> Thanks!

oh sorry forgot to include them.

		tokenizer = GPT2Tokenizer.from_pretrained('gpt2-medium') 
		model = GPT2LMHeadModel.from_pretrained('gpt2-medium' , pad_token_id = tokenizer.eos_token_id)

> Hi! Could you provide more information, especially regarding which model and tokenizer you're using? Also, you might have more luck asking on the [forum](https://discusss.huggingface.co), as GitHub issues are for bugs/feature requests.
> 
> Thanks!

if possible can you remove my account on hold on the forum? wont allow me to ask it there.

"steelhard" is the account name.

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.
LongformerForSequenceClassification: global_attention_mask=None
Author: jackashore
Pull request: no

Hi, my question is, what happens if `global_attention_mask` in `LongformerForSequenceClassification` is not stated? Does it mean that only local attention works in this case? I haven't found anything about it in the docs. Thanks in advance!

Comments:
Hello, thanks for opening an issue! We try to keep the github issues for bugs/feature requests.
Could you ask your question on the [forum](https://discusss.huggingface.co) instead?

Thanks!

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.
Different performance when training different transformers version
Author: quancq
Pull request: no

## Environment info
- `transformers` version: 4.6 and 4.5
- Platform:
- Python version: 3.7
- PyTorch version (GPU?): 1.8.0 GPU
- Tensorflow version (GPU?):
- Using GPU in script?: yes
- Using distributed or parallel set-up in script?: no

### Who can help

@LysandreJik @sgugger 

Models: PhoBERT (RoBERTa based)
Model hub: https://huggingface.co/vinai/phobert-base/

## Information
Model I am using (PhoBERT ...):

The problem arises when using:
* [x] my own modified scripts: (give details below)

The tasks I am working on is:
* [x] my own task or dataset: (give details below)

## Expected behavior
Training loss, dev loss, dev F1 in each epoch different when training model with transformers version 4.5 and 4.6.

Have anyone meet same this problem?

Comments:
We do not guarantee the exact reproducibility of training between versions, only with the same version (PyTorch does the same by the way). Are you using the Trainer API? If this is the case, I believe it's the work done to ensure full reproducibility for checkpoints (e.g. you get to the same results training from scratch or resuming from a checkpoint) that is probably creating this difference, as the way the training data was shuffled has been changed.

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.
Parameter in `DebertaV2Tokenizer.__init__()` without documentation: `split_by_punct`
Author: PhilipMay
Pull request: no

The `split_by_punct` parameter in `DebertaV2Tokenizer.__init__()` should be documented: 

https://github.com/huggingface/transformers/blob/52166f672ed337934d90cc525c226d93209e0923/src/transformers/models/deberta_v2/tokenization_deberta_v2.py#L89

@BigBird01 : could you please check this?

Comments:
@BigBird01 : could you please help with this?

I believe this parameter additionally splits the text on the punctuation, as it can be seen from the method it's calling:

https://github.com/huggingface/transformers/blob/afe479adb5474250215438fe27db9dc9dbbbde09/src/transformers/models/deberta_v2/tokenization_deberta_v2.py#L446-L464

I think this docstring should help out:

https://github.com/huggingface/transformers/blob/afe479adb5474250215438fe27db9dc9dbbbde09/src/transformers/models/deberta_v2/tokenization_deberta_v2.py#L500-L512

To see it in practice, you can try it with:

```py
>>> tok = DebertaV2Tokenizer.from_pretrained("microsoft/deberta-v2-xlarge")
>>> tok._tokenizer._run_split_on_punc("Hey, how's he doing?")
['Hey', ',', ' how', "'", 's he doing', '?']
```

Thanks @LysandreJik  for the explanation. Yes, it will split input sentences by punctuation then tokenize the segments by SPM tokenizer. We found this can help the performance of **SQuAD** task, but not on other tasks, e.g. MNLI. So we set it to false by default.


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.
RobertaTokenizer doesn't have 'batch_encode_plus'
Author: amaloraini
Pull request: no
Labels: name: wontfix

name: Version mismatch

# 🐛 Bug

## Information

Model I am using (Bert, XLNet ...): RoBERTa

Language I am using the model on (English, Chinese ...): English

The problem arises when using:
* [X] the official example scripts: (give details below)
* [ ] my own modified scripts: (give details below)

Following the tutorial on how to train your own RoBERTa model in this [link](https://huggingface.co/blog/how-to-train)

The tasks I am working on is:
* [X] an official GLUE/SQUaD task: (give the name)
* [ ] my own task or dataset: (give details below)

Fill mask

## To reproduce
Steps to reproduce the behavior:

1. I pretrained my own tokenizer and roberta model 
2.  The tokenizer and model are loaded fine and both seems to have the training information 
3. However, when I join them together in the  pipeline step as in:
`tokenizer = RobertaTokenizer.from_pretrained('./eo_data')`
`rmodel = RobertaForMaskedLM.from_pretrained('./output_dir')`
`fill_mask = pipeline(
    "fill-mask",
    model=rmodel,
    tokenizer= tokenizer
)
`

 I get the following error:
`
AttributeError: 'RobertaTokenizer' object has no attribute 'batch_encode_plus'
`
It seems that RobertaTokenizer doesn't have the batch_encode_plus function as BertTokenizer 

<!-- 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. -->

## Environment info
<!-- You can run the command `python transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->
     
- `transformers` version: 2.5.1
- Platform: Ubuntu 
- Python version: 3.6.8
- PyTorch version (GPU?):
- Tensorflow version (GPU?):
- Using GPU in script?:
- Using distributed or parallel set-up in script?:

Thank you 


Comments:
Hi, this is probably because you're using an old version of `transformers`. Version 2.8 doesn't exist, the latest is 2.5.1 ...

Sorry, I accidently put 2.8. The version I have is: 2.5.1
I am going to edit the post. 

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.


Started getting the same issue today. Is there a known solution?
[CI] add dependency table sync verification
Author: stas00
Pull request: yes

Sometimes version is being modified in `setup.py` but not updated in the autogenerated versions file `src/transformers/dependency_versions_table.py` and then all devs start getting this uncommitted change in their clone on `make fixup/style`. This PR adds a new make target to do the checking and adds it to the `check_code_quality` CI job.

Expecting it to fail in this PR initially as I didn't sync the table.

TODO: backout the setup.py version changes before merging.

@sgugger, @LysandreJik 

Comments:
So now when the table is out of sync it fails with:

![snapshot_4](https://user-images.githubusercontent.com/10676103/123495350-3bed6d00-d5d8-11eb-8a88-272ac40a1ae4.png)

Let me know if this is good and I will re-test with when it's in sync.
[Examples] Added context manager to datasets map
Author: bhadreshpsavani
Pull request: yes

# What does this PR do?

Fixes #12363

## 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.
- [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?
@stas00 @sgugger 

Comments:
[Deepspeed] match the trainer log level 
Author: stas00
Pull request: yes

This PR sets the trainer log level for Deepspeed, so the whole application runs on the same log level.

Once https://github.com/microsoft/DeepSpeed/pull/1190 is merged running the trainer with `--log_level error --log_level_replica error` with deepspeed is absolutely silent, just gives you the training results.

well, minus the lame `tensorflow` info logs who refuses to be respectful of the ecosphere.

and pt-1.9.0's distributed + launch which too has the default log level wrong, but it will be fixed in 1.9.1

@sgugger 

Comments:
Rename detr targets to labels
Author: NielsRogge
Pull request: yes

# What does this PR do?

It fixes #12248. As the models accept "labels" as an argument, it's better to also use the term "labels" in the feature extractor instead of "target". 

Note that if this PR gets merged, I'll need to update my demo notebooks (rename "target" to "labels").

I also improved the documentation a little more, and removed some unused variables from `DetrConfig`.

cc @LysandreJik 

Comments:
@LysandreJik if you want, I can also update the failing integration test for `DetrForSegmentation` in this PR (and perhaps rename the PR). And how can I create an alias for `DetrForSegmentation` (to be renamed to `DetrForImageSegmentation`)?

Let's merge this PR as-is and update the integration test in another PR.

For the alias you can simply do `DetrForImageSegmentation = DetrForSegmentation`