noamaanMulla-03/transformers-issues huggingface dataset:
Request for Support to Adapt a Model (Human Dignity Observatory: Non-Profit Project) 
Author: KnowmadInstitut
Pull request: no
Labels: name: wontfix

Dear @huggingface community from the Knowmad Institut we need your contribution and support for the Observatory of Human Dignity that we have developed.

You can access to the observatory here: (https://bit.ly/MQHHRRES)

We need your support to adapt the hugging face tools. We need to get the sentiments out of the content of the tweets and also (based on the data we have filtered out one by one) filter out the ones that are really human rights violations, like classifying from 1 to 5 with 1 being the one that looks the least like a human rights violation and 5 being the one that most matches the data we already have.

We thank the community and the @huggingface team for their support in disseminating this request for support.

|<center>[![FB18.png](https://knowmadinstitut.org/wp-content/uploads/2020/04/Black-and-Red-Geometric-Technology-Keynote-Presentation-1.png)](https://bit.ly/MQHHRRES) </center>|

<div class="center">

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Dear <a href="https://twitter.com/huggingface?ref_src=twsrc%5Etfw">@huggingface</a> community from the Knowmad Institut we need your contribution and support for the Observatory of Human Dignity that we have developed.<br><br>You can access to the observatory here: <a href="https://t.co/3TgKwjs3PJ">https://t.co/3TgKwjs3PJ</a><br><br>1/3 <a href="https://t.co/ly4Z139qHb">pic.twitter.com/ly4Z139qHb</a></p>&mdash; Knowmad Institut (@KnowmadInstitut) <a href="https://twitter.com/KnowmadInstitut/status/1280904300831612935?ref_src=twsrc%5Etfw">July 8, 2020</a></blockquote><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

</div>

Comments:
Hi @KnowmadInstitut you should post this on the forum as well at https://discuss.huggingface.co/

> Hi @KnowmadInstitut you should post this on the forum as well at https://discuss.huggingface.co/

Thank you so much for the guidance, I'll get right on it.  :)


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.
Any insight to this mystery issue? Using the Keras functional API results in whole deleted weights/layers for transformer layers. 
Author: Santosh-Gupta
Pull request: no
Labels: name: wontfix

# ❓ Questions & Help

This is probably a Keras, tensorflow bug, but just wanted to check-in here in case I overlooked anything. 

I've discovered a bug, where if transformer layers are copied from a transformer model, and used as individual layers, and then a Keras model is made using the functional API, this seems to result in missing weights/layers from the list of trainable layers. However, the issue goes away if I use model subclassing to make the Keras model. 

I raised the issue here

https://github.com/tensorflow/tensorflow/issues/40638#event-3468314954

but you can directly checkout the issue in this colab notebook 

https://colab.research.google.com/gist/Santosh-Gupta/273361f873e4daf572fddea691b1f325/missingtrainablevars.ipynb

Which copies the layers from one of your transformer models. I also made one where I implemented the transformer layers from (near) scratch, and got the same result

https://colab.research.google.com/gist/ravikyram/0191e12b7c6d9afeb80ccc009870b255/untitled52.ipynb

This likely seems like a bug in Keras, but may take a while to pinpoint what exactly is causing this, since a transformer layer has many parts. But just wanted to pop this in here, in case there was some insight to the issue, or a way to pinpoint the cause. 

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.
Classification accuracy on validation set didn't improve while fine-tuning BERT
Author: rxlian
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 
     -->

I was fine-tuning BERT with BertForSequenceClassification on my own dataset. 0.8 of the whole dataset was used as training set and the others as validation set. The training loss decreased during the process. However, the accuracy on validation set was always around 0.5, which is similar to random guessing. And the accuracy on validation didn't improve a lot after fine-tuning. For example, from epochs 1-3, accuracy was from 0.48-0.52. So I was wondering whether this problem was caused by my dataset itself or if I did something wrong while fine-tuning it? Does anybody have any ideas on this? By the way, before this, I was fine-tuning BERT on another dataset and it did improve the classification accuracy a lot .
<!-- 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. -->
**A link to original question on Stack Overflow**:

Comments:
Hello! This is an interesting question, but is kind of out of scope for the Github issues. We just opened a forum at [discuss.huggingface.co](https://discuss.huggingface.co). Do you think you could ask your question over there?

Thank you.

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.
"How to train a new language model from scratch" colab stuck at training
Author: iggygeek
Pull request: no
Labels: name: wontfix

Hello,
I am following the tutorial : https://huggingface.co/blog/how-to-train
At command :
trainer.train()
It gets stuck (Nothing displayed except "Using deprecated `--per_gpu_train_batch_size` argument").
Any idea ?

Comments:
Hi @iggygeek  not sure what the exact problem is, can you provide exact details, env info, transformers and torch version and probably your code (script or colab).

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.
Unable to load the reformer pre-trained model, connection broken after X%
Author: as-stevens
Pull request: no
Labels: name: wontfix

# ❓ Questions & Help

I am trying to load the Reformer pre-trained model, But I am not able to do so. The load fails after some random x%. The error stack trace is;

ChunkedEncodingError: ('Connection broken: OSError("(10054, \'WSAECONNRESET\')",)', OSError("(10054, 'WSAECONNRESET')",))

Code to load the model, a simple cell with imports and just the code below to load the model;

modelWiki =  ReformerModelWithLMHead.from_pretrained('google/reformer-enwik8')

The notebook is running behind the proxy, could that be an issue?
The SO - https://stackoverflow.com/questions/27333671/how-to-solve-the-10054-error
But it talks about connection refused by server.
<!-- 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 Stack Overflow (SO) where a whole community of PyTorch and
     Tensorflow enthusiast can help you out. 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 
     
     If your question wasn't answered after a period of time on Stack Overflow, you
     can always open a question on GitHub. You should then link to the SO question 
     that you posted.
     -->

## Details
<!-- Description of your issue -->

<!-- You should first ask your question on SO, and only if
     you didn't get an answer ask it here on GitHub. -->
**A link to original question on Stack Overflow**:


Comments:
Not sure how to help you here. Can you load other models from pretrained? Like

```python 
model = BertModel.from_pretrained("bert-base-uncased")
```
?

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.
Bugs due to design choices in LongformerTokenizer
Author: danishpruthi
Pull request: no
Labels: name: wontfix

I am using the transformers library from source (version: 3.0.2). 

```python
import transformers
from transformers import *
longformer_tokenizer = LongformerTokenizer.from_pretrained("allenai/longformer-base-4096")
longformer_tokenizer.tokenize("This is a sample sentence for the tokenizer.")
```
The output I get is 
``` ['This', 'Ġis', 'Ġa', 'Ġsample', 'Ġsentence', 'Ġfor', 'Ġthe', 'Ġtoken', 'izer']```

The design choice here is to use the `Ġ` as a start of every new word (except for the first word). This is in contrast with other tokenizers which insert `##` tokens for suffixes of broken words. 

Due to this slightly different tokenization quirk, many things could break, one of which is the following piece of code in `squad.py`:

https://github.com/huggingface/transformers/blob/02a0b43014ac333a169e99d76aaba023a316e384/src/transformers/data/processors/squad.py#L106-L112

The `doc_tokens` from the processor are whitespace separated tokens, which are to be further tokenized using this code. But since each word is treated individually, and `LongformerTokenizer` doesn't insert `Ġ` for the first token, there is a problem. The resulting `all_doc_tokens` can not be correctly converted to original string using `tokenizer.convert_tokens_to_string` because it is missing the `Ġ`  at the start. 

Comments:
Thanks for this issue. Longformer was trained on trivia_qa by default and not squad, so the model is not by default compatible with `squad` and needs some special post processing as shown in the example of this model, here:
https://huggingface.co/transformers/model_doc/longformer.html#longformerforquestionanswering

This is also related to: https://github.com/huggingface/transformers/pull/4615 

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.
How do you connect Convolutional layers to Transformers?
Author: leersaam
Pull request: no
Labels: name: wontfix

# ❓ Questions & Help
Hi everyone!
Where can I find code example that makes clear how to connect Convolutional layers to Transformers and how it needs to be shaped in order to make such a connection?
I have a bit of a hard time figuring it out.

Thank you for your support.


Comments:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I am training a bert model for question classification task, now it is a binary classifier. 0 for Descriptive question and 1 for not descriptive. While testing I am getting the following error :-
Author: HarshMultani
Pull request: no
Labels: name: wontfix

I have generated my model with the help of around 1700 questions

But when I am testing it for one question at a time and running
      outputs = model(b_input_ids, token_type_ids=None, attention_mask=b_input_masks)

It is giving me the following error
ValueError: Wrong shape for input_ids (shape torch.Size([1])) or attention_mask (shape torch.Size([1]))

b_input_ids are the padded id of the input question
b_input_masks are the attention mask of the b_input_ids

Any idea how this error can be resolved


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.


use torch.unsqueeze(0) on b_input_ids,b_input_masks so that they become of shape (batch_size(=1),dim)

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.
AttributeError: 'GPT2LMHeadModel' object has no attribute 'h'
Author: Heiheiyo
Pull request: no
Labels: name: wontfix

# ❓ Questions & Help

when I run run_generation.py（I use TF1.14 fine tuned gpt2）,the program is broken with the error message AttributeError: 'GPT2LMHeadModel' object has no attribute 'h'

Environment:
WIN10
pytorch 1.3.1
python 3.6

Part of the code has been modified
![image](https://user-images.githubusercontent.com/15426714/87869491-e6294180-c9d2-11ea-8b45-be83742b1045.png)


Comments:
You can't load directly a TF checkpoint if it's not been generated by the TensorFlow side of the library (which can't be the case here since you're using a TF1 checkpoint and the lib requires TF2.0). You probably have to use the [conversion script](https://huggingface.co/transformers/converting_tensorflow_models.html).

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.
Unicode normalization for bert-cased models
Author: alexeyr
Pull request: no
Labels: name: wontfix

# 🐛 Bug

## Information

Model I am using (Bert, XLNet ...): Bert

Language I am using the model on (English, Chinese ...): English

The problem arises when using:
* [ ] the official example scripts: (give details below)
* [x] my own modified scripts: (give details below)

The tasks I am working on is:
* [ ] an official GLUE/SQUaD task: (give the name)
* [x] my own task or dataset: (give details below)

## To reproduce

Steps to reproduce the behavior:

Tokenize text containing combining marks with `BertTokenizer`. E.g.
```
In [1]: from transformers.tokenization_bert import *                                                                                                     

In [2]: tokenizer = BertTokenizer.from_pretrained("bert-base-cased")                                                                                     

In [3]: tokenizer.tokenize("\u00E1")                                                                                                                     
Out[3]: ['á']

In [4]: tokenizer.tokenize("a\u0301")                                                                                                                    
Out[4]: ['a', '##́']

In [5]: tokenizer.tokenize("a\u0300")                                                                                                                    
Out[5]: ['[UNK]']

In [6]: tokenizer.tokenize("\u00E0")                                                                                                                     
Out[6]: ['à']
```

Results for `BertTokenizerFast` are the same.

## Expected behavior

`"\u00E1"` and `"a\u0301"` should ideally be tokenized the same way; so should `"\u00E0"` and `"a\u0300"`. If existing behavior should be preserved, maybe add an optional argument.

## 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-4.4.0-18362-Microsoft-x86_64-with-Ubuntu-18.04-bionic
- Python version: 3.6.9
- PyTorch version (GPU?): 1.4.0 (False)
- Tensorflow version (GPU?): not installed (NA)
- Using GPU in script?: No
- Using distributed or parallel set-up in script?: No


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.
TypeError: join() argument must be str or bytes, not 'NoneType'
Author: marton-avrios
Pull request: no
Labels: name: wontfix

Trying to run seq2seq example scripts with multiple gpus and wandb logging and I get
```
Traceback (most recent call last):
  File "/home/martongyorgy/projects/tmp/transformers/examples/seq2seq/finetune.py", line 364, in <module>
	xsum_rouge.json
  File "/home/martongyorgy/projects/tmp/transformers/examples/seq2seq/finetune.py", line 342, in main
    logger=logger,
  File "/home/martongyorgy/projects/tmp/transformers/examples/lightning_base.py", line 330, in generic_train
    trainer.fit(model)
  File "/home/martongyorgy/miniconda3/envs/transformers/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 891, in fit
    self.ddp_train(task, model)
  File "/home/martongyorgy/miniconda3/envs/transformers/lib/python3.7/site-packages/pytorch_lightning/trainer/distrib_data_parallel.py", line 530, in ddp_train
    self.run_pretrain_routine(model)
  File "/home/martongyorgy/miniconda3/envs/transformers/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 1046, in run_pretrain_routine
    self.configure_checkpoint_callback()
  File "/home/martongyorgy/miniconda3/envs/transformers/lib/python3.7/site-packages/pytorch_lightning/trainer/callback_config.py", line 60, in configure_checkpoint_callback
    "checkpoints"
  File "/home/martongyorgy/miniconda3/envs/transformers/lib/python3.7/posixpath.py", line 94, in join
    genericpath._check_arg_types('join', a, *p)
  File "/home/martongyorgy/miniconda3/envs/transformers/lib/python3.7/genericpath.py", line 153, in _check_arg_types
    (funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'NoneType'
```

To reproduce follow the instructions in the seq2seq example Readme to download XSUM then run
```
export PYTHONPATH="../":"${PYTHONPATH}"

python finetune.py \
    --learning_rate=3e-5 \
    --fp16 \
    --gpus 2 \
    --do_train \
    --n_val 1000 \
    --val_check_interval 0.1 \
    --data_dir xsum \
    --output_dir xsum_frozen_embs \
    --model_name_or_path t5-small \
    --train_batch_size 16 --eval_batch_size 16 --freeze_embeds --freeze_encoder \
    --num_train_epochs 6 \
    --max_target_length=60 --val_max_target_length=60 --test_max_target_length=100 \
    --logger wandb
```

Happens in pytorch-lightning 0.8.1, fixed in 0.8.4. But there is another problem in  0.8.4, see #5584 


Comments:
Hopefully fixed by https://github.com/huggingface/transformers/pull/5361

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 pipeline('ner'), partial tokens returned when grouped_entities=True
Author: JamesDeAntonis
Pull request: no
Labels: name: wontfix

# 🐛 Bug

## Information

Model I am using (Bert, XLNet ...): pipeline('ner', grouped_entities=True)

Language I am using the model on (English, Chinese ...): English

The problem arises when using:
* [ ] the official example scripts: (give details below)
* [x] my own modified scripts: (give details below)

The tasks I am working on is:
* [ ] an official GLUE/SQUaD task: (give the name)
* [x] my own task or dataset: (give details below)

## To reproduce

Steps to reproduce the behavior:

```python
from transformers import pipeline
ner = pipeline('ner', grouped_entities=True)
ner("the sapodilla tree is native to Central America")
```

## Expected behavior

The output says that "##di" is one of the named entities.  It doesn't seem like partial tokens should possibly be returned as predicted named entities.  Instead, I imagine that the desired result is that either the entire word "sapodilla" is determined to be an entity group or nothing at all.  Is this a bug or was this quirk consciously chosen to be allowed?

As a side note, another similar quirk here is that something like "U.S." occasionally gives just "U" or "S" as individual named entities, where "U.S." is desired.  I consider this related to the above issue.

## Environment info
- `transformers` version: 3.0.2
- Platform: Linux-5.3.0-1032-azure-x86_64-with-glibc2.10
- Python version: 3.8.1
- PyTorch version (GPU?): 1.5.1 (False)
- Tensorflow version (GPU?): not installed (NA)
- Using GPU in script?: no
- Using distributed or parallel set-up in script?: no

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.
Unable to finetune BERT on own dataset
Author: noabenefraim
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
Hello, I am trying to use my own data to finetune transformers for summarization tasks. I have followed the instructions on the README.md by generating a text file with each article to be summarized on its own line. The text file is located in ...\workspace\hug

Below is the command that I ran and it's resulting error. I couldn't find further instructions on the README or in the stackoverflow/current or closed issues. Can you please provide more guidance with examples on how to train on your data set. I would greatly appreciate this. @sshleifer 

Command ran + error:
![image](https://user-images.githubusercontent.com/13383820/87342840-c7bdd480-c500-11ea-8cc7-10751701b519.png)

Finetune.sh
![image](https://user-images.githubusercontent.com/13383820/87343018-12d7e780-c501-11ea-834d-48ed5f4c3b02.png)


Once again, I would really appreciate your help! 

Comments:
Seems you are using Powershell.  Since this is a bash shell file, you will need to run it outside of Powershell in bash shell.

Here's an example using Google Colab

https://colab.research.google.com/github/interactive-fiction-class/interactive-fiction-class.github.io/blob/master/homeworks/language-model/hw4_transformer.ipynb

Some additional examples
https://github.com/huggingface/transformers/blob/223084e42b57cd0d8e78de38e15a42d5d6b04391/notebooks/README.md

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.