noamaanMulla-03/transformers-issues huggingface dataset:
[s2s] Switch README urls to cdn
Author: sshleifer
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 -->

Fixes # (issue)


## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dimiss 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 the 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 which 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.

 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: @TevenLeScao
 Blenderbot, Bart, Marian, Pegasus: @sshleifer
 T5: @patrickvonplaten
 Longformer/Reformer: @patrickvonplaten
 TransfoXL/XLNet: @TevenLeScao 
 examples/seq2seq: @sshleifer
 examples/bert-loses-patience: @JetRunner
 tensorflow: @jplu
 examples/token-classification: @stefan-it
 documentation: @sgugger
 -->

Comments:
fix nn.DataParallel compatibility with PyTorch 1.5
Author: guhur
Pull request: yes

The same type of errors as in https://github.com/huggingface/transformers/pull/4300

# What does this PR do?
DataParallel replicate has a known issue in PyTorch 1.5: https://github.com/pytorch/pytorch/issues/40457

A similar PR proposes a work around by removing the `next(self.parameters().dtype)`: https://github.com/huggingface/transformers/pull/4300/files/7eef4f5a7575e05e822f8ef45d7f473a102671aa

I did the same in LXMERT


## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dimiss 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 the 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?

@patrickvonplaten
 @julien-c 

Comments:
(tagging @eltoto1219 for information)
tokenizer_bert.py not call _clean_text?
Author: liwei-cpp
Pull request: no

for transformers/src/transformers/tokenization_bert.py, there is a function called _clean_text.
But seems this function is not be called at all?

In google bert(https://github.com/google-research/bert/blob/master/tokenization.py) there exists a same function and that function has been called at the beginning of the tokenization.

Comments:
How to produce customized attention mask for BertModel?
Author: empty-id
Pull request: no
Labels: name: wontfix

# ❓ Questions & Help

<!-- The GitHub issue tracker is primarly intended for bugs, feature requests,
     new models and benchmarks, and migration questions. For all other questions,
     we direct you to the Hugging Face forum: https://discuss.huggingface.co/ .
     You can also try Stack Overflow (SO) where a whole community of PyTorch and
     Tensorflow enthusiast can help you out. In this case, make sure to tag your
     question with the right deep learning framework as well as the
     huggingface-transformers tag: 
     https://stackoverflow.com/questions/tagged/huggingface-transformers 
     -->

## Details
<!-- Description of your issue -->

<!-- You should first ask your question on the forum or SO, and only if
     you didn't get an answer ask it here on GitHub. -->

The attention mask for BertModel needs a tensor sized (batch, seq-length). But what if I need to customize the attention for each token, just like UniLM, or some diagonal attention like GPT?

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.


Is there any help?

@null-id I also want to know how to customize query-key attention mask. Did you solve the problem?
Faster Pegasus tokenizer tests
Author: sshleifer
Pull request: no
Labels: name: Help wanted

name: Tests

Current test_tokenization_pegasus.py takes more than a minute to run because it uses a full size tokenizer [here](https://github.com/huggingface/transformers/blob/master/tests/test_tokenization_pegasus.py#L19)


It should use "fixtures/test_sentencepiece.model" like `tests/test_tokenization_t5.py`.

Comments:
Any interest @stas00 ?

Yes, please, you can assign this to me, but most likely will be able to start on it in a few weeks when I have free time.

We can start this, but if we do we should wait for @thomwolf 's fast tokenizer PR to merge before we merge the fix.

This is unblocked, thom merged!
[pegasus] Faster tokenizer tests
Author: stas00
Pull request: yes

This PR implements #7354

* The suggested `fixtures/test_sentencepiece.model` couldn't be used since it has wrong special token ids: we need 
   1. no bos
   2. eos_id is 1
   3. unk_id is 2

   added a script that builds a custom tokenizer model: `test_sentencepiece_no_bos.model`. Had to figure out how to match `"google/pegasus-large"` spm file. See the build script for nuances.
* switched pegasus common tests to use the newly added `test_sentencepiece_no_bos.model` - 2 custom tests still use the large tokenizer - remained untouched

And a few extra tweaks I made while sorting this PR out:

* removed `get_vocab` in `tokenization_pegasus.py` as it's identical to superclass's one
* a few minor prose edits in related files
* expanded `testing_utils.py`' s `get_tests_dir` to accept an optional `append_path` arg to remove clutter from tests. will probably rename it in the future to something else, works for now.



Fixes #7354

@sshleifer, @LysandreJik 

Comments:
SqueezBert link gives a 404 error
Author: mockingbirdz
Pull request: no

The main Readme.md file (https://github.com/huggingface/transformers/blob/master/README.md), the SqueezeBert link (https://huggingface.co/transformers/model_doc/squeezebert.html) gives a "404 - Not Found" Error.

Comments:
Yes, unfortunately that link will only be live at the next release (for now squeezeBERT is only in master, so only in the master documentation).
@LysandreJik not sure if there is a way to properly fix this unless we add "Check all the links in the README to remove the master" in our release check list.

You're right, I don't think there's any other way without over-engineering a feature.
Better links for models in README and doc index
Author: sgugger
Pull request: yes

# What does this PR do?

This PR fixes the links to the docs for unreleased models and makes the automatic copy to the index.rst a little bit better (by using relative links so there is no jump in version).
It adds instructions in the setup.py to clean the master in the links for unreleased models at the time of a release, we will just need to remember to have the right links in the README in a PR that adds a new model.

<!-- Remove if not applicable -->

Fixes #7657

Comments:
torch模型的forward方法里面内容为空，用Electra模型无法训练。
Author: ChrisChaw
Pull request: no
Labels: name: wontfix

![image](https://user-images.githubusercontent.com/41299010/89173067-406ef880-d5b6-11ea-9c64-4e41243dad43.png)
![image](https://user-images.githubusercontent.com/41299010/89173121-5a104000-d5b6-11ea-9039-d2341dca9463.png)
上图是训练模型时调用的forward方法，这个方法里的代码为空，下图是报的错，请教您这个问题该如何解决？非常感谢您！！！

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.
Add `do_lower_case` handling to GPT2TokenizerFast and descendant tokenizers
Author: poudro
Pull request: no
Labels: name: wontfix

I'm currently pretraining a model from scratch based on RoBERTa architecture and am using a custom `ByteLevelBPETokenizer` tokenizer trained on my data with `lowercase` set to `True`. 

For ease of use, I load it with
```
from transformers import RobertaTokenizerFast

tokenizer = RobertaTokenizerFast(
                        'custom-vocab.json',
                        'custom-merges.txt',
                    )
```

The issue, is that unlike `BertTokenizerFast`, `RobertaTokenizerFast` (and it's parent class `GPT2TokenizerFast`) doesn't handle the `do_lower_case` parameter. 

I prefer using a BPE rather than WordPiece on this task so at the moment I make sure to lowercase text before tokenization but it can be error prone in the future.

Looking at the code, it seems `GPT2TokenizerFast` and descendants are the main ones lacking the parameter.

Could it be possible to add this?


Comments:
I've just openned a pull request that handles this for GPT2TokenizerFast and RobertaTokenizerFast

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.
taeminlee/kogpt2 not working
Author: ksjae
Pull request: no
Labels: name: wontfix

## 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! -->
     
- None: hosted inference API

### Who can help
@LysandreJik 
@julien-c 
@TevenLeScao


## Information

Model I am using (Bert, XLNet ...):

The problem arises when using:
* [O] the official example scripts: Hosted Inference API testing page
* [ ] my own modified scripts: (give details below)

The tasks I am working on is:
* [ ] an official GLUE/SQUaD task: (give the name)
* [O] my own task or dataset: Text generation, or anything

## To reproduce

Steps to reproduce the behavior:

1. https://huggingface.co/taeminlee/kogpt2?text=제+이름은+홍길동
2. Or type any text
3. Model returns just the text

## Expected behavior

Generated text should be returned, but isn't.


Comments:
~It seems to work? What's happening on your end?~ Indeed, the generated text seems to be truncated.

@ksjae, I can't seem to make that model work in my environment, without relying on the inference API. 

```py
from transformers import AutoModelWithLMHead, pipeline
from transformers import GPT2Tokenizer

tokenizer = GPT2Tokenizer.from_pretrained("taeminlee/kogpt2", do_lower_case=False)

print(tokenizer.tokenize("제 이름은 홍길동"))
# ['ì', 'ł', 'ľ', 'Ġ', 'ì', 'Ŀ', '´', 'ë', '¦', 'Ħ', 'ì', 'Ŀ', 'Ģ', 'Ġ', 'í', 'Ļ', 'į', 'ê', '¸', '¸', 'ë', 'ı', 'Ļ']  # probably not what we're looking for

print(tokenizer.decode(tokenizer.encode("제 이름은 홍길동")))
# <unk><unk><unk><unk><unk><unk><unk><unk><unk><unk><unk><unk><unk><unk>�<unk><unk><unk><unk><unk><unk><unk><unk>
# Definitely not what we're looking for
```

Do you know the author?

No, I don't.
I'll try to add a new one(in training right now) though.

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.
run_squad example doesn't work with XLM model
Author: sshearing
Pull request: no
Labels: name: wontfix

# 🐛 Bug

## Information

Model I am using (Bert, XLNet ...): XLM

Language I am using the model on (English, Chinese ...): Korean

The problem arises when using:
* [ ] the official example scripts: run_squad.py
* [ ] 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: KorQuAD v1.0

## To reproduce

Steps to reproduce the behavior:

1. Download the KorQuAD v1.0 data (it is formatted exactly as SQuAD v1.0)
2. Run the run_squad script with KorQuAD instead of SQuAD
3. Use the XLM model type (with specific model: xlm-mlm-100-1280_384)

<!-- 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. -->

Since the data is formatted exactly the same as the english version, except its in Korean now, I expect the script to be able to fully train and evaluate on the new data. In fact, the script successfully does this when you use multi-lingual BERT instead of XLM. However, when you use XLM, you get invalid input in the forward call:

"cls_index" and "p_mask" are unexpected inputs.

I tried hacking in a fix for this, specifically just deleting cls_index and p_mask from the inputs when using XLM instead of Bert. This caused the model to be able to train correctly, but when we try to evaluate, we end up crashing on a new error. I don't know if its related or not, but this is in the squad metrics, not within run_squad.py, so I was less excited to start messing with that and instead decided to put up this issue.

It specifically crashes here:
 transformers/data/metrics/squad_metrics.py", line 629, in compute_predictions_log_probs
    cur_null_score = result.cls_logits
AttributeError: 'SquadResult' object has no attribute 'cls_logits'

## 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: 3.0.2
- Platform: Linux-3.10.0-862.14.4.el7.x86_64-x86_64-with-centos-7.5.1804-Core
- Python version: 3.7.3
- PyTorch version (GPU?): 1.4.0 (False)
- Tensorflow version (GPU?): not installed (NA)
- Using GPU in script?: Yes
- Using distributed or parallel set-up in script?: No (Just 1 GPU)


Comments:
see also #3535

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.
Using BertWordPiece Tokenizer
Author: bhavaygg
Pull request: no
Labels: name: wontfix

# ❓ Questions & Help

<!-- The GitHub issue tracker is primarly intended for bugs, feature requests,
     new models and benchmarks, and migration questions. For all other questions,
     we direct you to the Hugging Face forum: https://discuss.huggingface.co/ .
     You can also try Stack Overflow (SO) where a whole community of PyTorch and
     Tensorflow enthusiast can help you out. In this case, make sure to tag your
     question with the right deep learning framework as well as the
     huggingface-transformers tag: 
     https://stackoverflow.com/questions/tagged/huggingface-transformers 
     -->

## Details
The Bert WordPiece tokenizer only saves a vocab file on saving the model while other tokenizers such as Byte Level BPE also save a merges file.  When I try to call the model after saving it `RobertaTokenizerFast.from_pretrained("./EsperBERTo_italian", max_len=512)` I get the following error 
`OSError: Model name './EsperBERTo_italian' was not found in tokenizers model name list (roberta-base, roberta-large, roberta-large-mnli, distilroberta-base, roberta-base-openai-detector, roberta-large-openai-detector). We assumed './EsperBERTo_italian' was a path, a model identifier, or url to a directory containing vocabulary files named ['vocab.json', 'merges.txt'] but couldn't find such vocabulary files at this path or url.
`


Comments:
Hi! Are you trying to load a BERT vocabulary in a RoBERTa tokenizer? This unfortunately won't work, as the mechanisms between the WordPiece and Byte level BPE are inherently different.

Hi, I could not find documentation for it so I thought id try. Another thing I wanted to ask is that I am working on a dataset of recipes so I have a list of ingredients in order.  I now remove random ingredients and predict them using various models. I have tried Seq2Seq models and Roberta to solve this problem but both give poor results. In my opinion, this problem is somewhat similar to NLP problems but significantly different because tokenizing like BERT does not give any advantage and creates more problems. Do you have any architecture in mind that might be more suited to tackle this problem?

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.
🐛 Not adding `token_type_ids` when the model is `electra` (pytorch_lightning example)
Author: monologg
Pull request: no
Labels: name: wontfix

### Who can help
@sshleifer (examples issue)


## Information

Model I am using (Bert, XLNet ...): `ELECTRA`

The problem arises when using:
* [X] the official example scripts: (give details below)
* [ ] my own modified scripts: (give details below)

The tasks I am working on is:
* [X] an official GLUE/SQUaD task: (give the name)
* [ ] my own task or dataset: (give details below)

## About Issue

https://github.com/huggingface/transformers/blob/838dc06ff5a438159ac25f531d622e8f344476f5/examples/text-classification/run_pl_glue.py#L38-L39

As above, it seems that `token_type_ids` is not included if the `model_type=='electra'` (which also have `token_type_ids`)

I think this code should be changed in other way.

Comments:
Hi @monologg , yes toke_type_ids should be there for electra,

easy fix would be somethin like
```python3
if self.config.model_type not in ["xlm", "roberta", "distilbert", "camembert", "longformer"]:
     inputs["token_type_ids"] = batch[2] 
```

This is how it's done in the squad dataset

@LysandreJik  , if yes, I can open a PR

@patil-suraj, I also think that is the best to way to fix this issue:)

https://github.com/huggingface/transformers/blob/838dc06ff5a438159ac25f531d622e8f344476f5/examples/text-classification/run_pl_glue.py#L98-L102

And not only in `training_step()`, also `validation_step()` has to be fixed.

Yes, totally forgot about that, thanks! 

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.
Failing ONNX Export test
Author: sshleifer
Pull request: no
Labels: name: wontfix

https://github.com/huggingface/transformers/runs/929962952?check_suite_focus=true

```
FAILED tests/test_onnx.py::OnnxExportTestCase::test_quantize_pytorch - TypeError
```

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.
Why are the `device()` and `dtype()` functions in `modelling_utils.py` needed?
Author: h56cho
Pull request: no
Labels: name: wontfix

Hello,

For BERT and RoBERTa HuggingFace pre-trained models, why are the `device()` and `dtype()` functions in `modeling_utils.py` needed? 

See: https://github.com/huggingface/transformers/blob/8edfaaa81b9995cedea2f8805e4c18c2b6cb5bfc/src/transformers/modeling_utils.py#L158

https://github.com/huggingface/transformers/blob/8edfaaa81b9995cedea2f8805e4c18c2b6cb5bfc/src/transformers/modeling_utils.py#L177

Would it be possible for my RoBERTa model to function without an error, if I modify these  `device()` and `dtype()` functions in a way that they will always return `cpu` and `torch.float32` (or `torch.float64`), respectively? 

Also, while it is easy to modify the original code to do this, I am not sure on how to get my HuggingFace RoBERTa model to take those modified functions into effect. How can I do this?

Thank you (sorry for asking so many questions),


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.
[Feature request] Support batched conditional generation from GPT-2 
Author: sarahwie
Pull request: no
Labels: name: wontfix

# 🚀 Feature request

Support batched conditional generation from GPT-2 

## Motivation

Currently the [method](https://github.com/huggingface/transformers/blob/9ca485734aea269961d63a040ff194365d151fd1/src/transformers/modeling_utils.py#L802) to generate text from GPT-2 conditioned on an input sequence only supports either 1) a single input at a time, or 2) a batch of inputs where the conditioning input sequence is the same length. It would be great (for efficiency) if this method could be updated to support a batch with conditional inputs of varying length, done by ignoring padding in the input_ids. 

## Your contribution

Unlikely to have time to code this, but will submit a PR if I do. 


Comments:
Also see: https://github.com/huggingface/transformers/issues/3021

This is known to not work at the moment with `generate()`. I have to think a bit about the cleanest way to implement it :-) Code suggestions are very welcome! 



Very interested in this! Came here from #3021 (many hours after wondering why my batch generation was not working...)

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.