noamaanMulla-03/transformers-issues huggingface dataset:
exbert links for my albert model cards
Author: elgeish
Pull request: yes
Labels: name: model card

Adding links for exbert visualization.

Comments:
Hi @elgeish , you also need to add a 

```
tags:
- exbert
```

to the metadata block.



# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/3729?src=pr&el=h1) Report
> Merging [#3729](https://codecov.io/gh/huggingface/transformers/pull/3729?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/ce2298fb5f84a8d0d8860c15fb677b7ada07a8ad&el=desc) will **increase** coverage by `0.01%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/huggingface/transformers/pull/3729/graphs/tree.svg?width=650&height=150&src=pr&token=9qOlN6Hb1c)](https://codecov.io/gh/huggingface/transformers/pull/3729?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master    #3729      +/-   ##
==========================================
+ Coverage   78.18%   78.20%   +0.01%     
==========================================
  Files         104      104              
  Lines       17799    17799              
==========================================
+ Hits        13917    13919       +2     
+ Misses       3882     3880       -2     
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/3729?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/modeling\_tf\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/3729/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl91dGlscy5weQ==) | `92.96% <0.00%> (+0.16%)` | :arrow_up: |
| [src/transformers/modeling\_transfo\_xl.py](https://codecov.io/gh/huggingface/transformers/pull/3729/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190cmFuc2ZvX3hsLnB5) | `77.22% <0.00%> (+0.21%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/huggingface/transformers/pull/3729?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/huggingface/transformers/pull/3729?src=pr&el=footer). Last update [ce2298f...e003d19](https://codecov.io/gh/huggingface/transformers/pull/3729?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Thanks!
Extending XLM Roberta for Question Answering
Author: anlausch
Pull request: no

# ❓ Questions & Help

The AutoModelForQuestionAnswering is supported by many models, but not yet by XLM Roberta. In the current implementation I could see that most task-specific classes for XLM-R, e.g. XLMRobertaForSequenceClassification are just inheriting from Roberta. However, when I try to extend the class analogously, the process fails. This is my extension:

`from transformers.modeling_roberta import (
    RobertaForQuestionAnswering,
)`

and

`@add_start_docstrings(
    XLM_ROBERTA_START_DOCSTRING,
)`

`class XLMRobertaForQuestionAnswering(RobertaForQuestionAnswering):
    config_class = XLMRobertaConfig
    pretrained_model_archive_map = XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_MAP
`

The error message I get is 

> Traceback (most recent call last):
  File "..miniconda3/lib/python3.6/site-packages/torch/serialization.py", line 289, in _check_seekable
    f.seek(f.tell())
AttributeError: 'NoneType' object has no attribute 'seek'

> During handling of the above exception, another exception occurred:

> Traceback (most recent call last):
  File "../miniconda3/lib/python3.6/site-packages/transformers/modeling_utils.py", line 516, in from_pretrained
    state_dict = torch.load(resolved_archive_file, map_location="cpu")
  File "../miniconda3/lib/python3.6/site-packages/torch/serialization.py", line 525, in load
    with _open_file_like(f, 'rb') as opened_file:
  File "../miniconda3/lib/python3.6/site-packages/torch/serialization.py", line 217, in _open_file_like
    return _open_buffer_reader(name_or_buffer)
  File "../miniconda3/lib/python3.6/site-packages/torch/serialization.py", line 202, in __init__
    _check_seekable(buffer)
  File "../miniconda3/lib/python3.6/site-packages/torch/serialization.py", line 292, in _check_seekable
    raise_err_msg(["seek", "tell"], e)
  File "/home/anlausch/miniconda3/lib/python3.6/site-packages/torch/serialization.py", line 285, in raise_err_msg
    raise type(e)(msg)
AttributeError: 'NoneType' object has no attribute 'seek'. You can only torch.load from a file that is seekable. Please pre-load the data into a buffer like io.BytesIO and try to load from it instead.

>  File "../modeling_auto.py", line 968, in from_pretrained
    return model_class.from_pretrained(pretrained_model_name_or_path, *model_args, config=config, **kwargs)
  File "..miniconda3/lib/python3.6/site-packages/transformers/modeling_utils.py", line 519, in from_pretrained
    "Unable to load weights from pytorch checkpoint file. "

Any idea what's going on here? 

Comments:
I've worked around this problem now by not extending the huggingface framework directly but implementing XLMRobertaForQuestionAnswering externally (using huggingface classes etc.). 

Would make sense to have it as a new feature though but that's a different issue type. ;)

Could you share the code or make PR? 

@djstrong The code corresponds to my solution presented above. The issue was related to me changing the library instead of just adding the file externally.
Turning off Verbosity on QA model using Pipeline
Author: WeiyangSun
Pull request: no

Hi,

I am looking for a way to turn off the logs warnings. Please refer to the screenshot.

![image](https://user-images.githubusercontent.com/34964824/79020501-9e2a9100-7b3e-11ea-8f63-afb26b11a5a1.png)

This is currently what I am doing.

![image](https://user-images.githubusercontent.com/34964824/79020549-ba2e3280-7b3e-11ea-893d-a527939181a7.png)

Is there any way?

Comments:
I was just wondering the same thing.
Added electra-bahasa README
Author: huseinzol05
Pull request: yes
Labels: name: model card


Comments:
# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/3854?src=pr&el=h1) Report
> Merging [#3854](https://codecov.io/gh/huggingface/transformers/pull/3854?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/a21d4fa410dc3b4c62f93aa0e6bbe4b75a101ee9&el=desc) will **increase** coverage by `0.00%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/huggingface/transformers/pull/3854/graphs/tree.svg?width=650&height=150&src=pr&token=9qOlN6Hb1c)](https://codecov.io/gh/huggingface/transformers/pull/3854?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master    #3854   +/-   ##
=======================================
  Coverage   78.61%   78.62%           
=======================================
  Files         106      106           
  Lines       17953    17953           
=======================================
+ Hits        14114    14115    +1     
+ Misses       3839     3838    -1     
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/3854?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/modeling\_tf\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/3854/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl91dGlscy5weQ==) | `92.76% <0.00%> (+0.16%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/huggingface/transformers/pull/3854?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/huggingface/transformers/pull/3854?src=pr&el=footer). Last update [a21d4fa...b5f2dc5](https://codecov.io/gh/huggingface/transformers/pull/3854?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Cherry-picked in 7f23af16840113fe137f42415a9daa7ce7f7f15f

Thank you, that looks great! cc @LysandreJik and @clarkkev
New model added
Author: punyajoy
Pull request: yes
Labels: name: model card

The first model added to the repo

Comments:
Thanks! [model page](https://huggingface.co/Hate-speech-CNERG/dehatebert-mono-english)

A few things to add to the model card if you can (happy to help!)

- which language(s) is it trained on?
- How can one use it, i.e. is this a sequence classifier?
ImportError: cannot import name 'HfArgumentParser' from 'transformers'
Author: ThomasSYT
Pull request: no

Hi,
I installed tokenizers-0.5.2 transformers-2.8.0.
When I try to run run_bertology.py in the example dir calling it with

export TASK_NAME=mnli
python ./run_bertology.py     --data_dir $GLUE_DIR/$TASK_NAME     
                              --model_name bert-base-uncased     
                              --task_name $TASK_NAME        
                              --output_dir ./tmp/$TASK_NAME/     
                              --try_masking 

But it fails with
Traceback (most recent call last):
  File "run_bertology.py", line 33, in <module>
    from run_glue import ALL_MODELS, MODEL_CLASSES, load_and_cache_examples, set_seed
  File "/Users/thomas/PycharmProjects/transformers/examples/run_glue.py", line 34, in <module>
    from transformers import (
ImportError: cannot import name 'HfArgumentParser' from 'transformers' (/Users/thomas/opt/anaconda3/lib/python3.7/site-packages/transformers/__init__.py)

Please help, thanks.

Comments:
Hi, 

As mentioned [here](https://github.com/huggingface/transformers/tree/master/examples#examples) and in the main README you need to install from source in order to run the latest versions of the examples
Fix bug in run_*.py scripts: double wrap into DataParallel during eval
Author: and-kul
Pull request: yes

This bug is present in several scripts in `examples`:
* `examples/run_language_modeling.py`
* `examples/run_multiple_choice.py`
* `examples/run_xnli.py`
* `examples/ner/run_ner.py`
* `examples/mm-imdb/run_mmimdb.py`
* `examples/hans/test_hans.py`

The problem is exactly the same as it was in #1801 and in #1504:

During the evaluation, we are trying to wrap the `model` into `DataParallel` second time (we did it already during training). As a result we have: 
> "RuntimeError: module must have its parameters and buffers on device cuda:0 (device_ids[0]) but found one of them on device: cuda:1" (ids of devices may differ)

The fix is straightforward:
Before:
```python
# multi-gpu eval
if args.n_gpu > 1:
    model = torch.nn.DataParallel(model)
```

After:
```python
# multi-gpu eval
if args.n_gpu > 1 and not isinstance(model, torch.nn.DataParallel):
    model = torch.nn.DataParallel(model)
```


Comments:
Merging this, though it will be rendered obsolete (for a subset of the script initially) by #3800
when I run transformers in Docker container, it appeared this error
Author: xiongma
Pull request: no

```
unknown exception: Model name 'bert-base-uncased' was not found in tokenizers model name list (bert-base-uncased, bert-large-uncased, bert-base-cased, bert-large-cased, bert-base-multilingual-uncased, bert-base-multilingual-cased, bert-base-chinese, bert-base-german-cased, bert-large-uncased-whole-word-masking, bert-large-cased-whole-word-masking, bert-large-uncased-whole-word-masking-finetuned-squad, bert-large-cased-whole-word-masking-finetuned-squad, bert-base-cased-finetuned-mrpc, bert-base-german-dbmdz-cased, bert-base-german-dbmdz-uncased, bert-base-finnish-cased-v1, bert-base-finnish-uncased-v1, bert-base-dutch-cased). We assumed 'bert-base-uncased' was a path, a model identifier, or url to a directory containing vocabulary files named ['vocab.txt'] but couldn't find such vocabulary files at this path or url.
```
OS platform python 3.7.6 transformer 2.4 debian

Comments:
We would need more information in order to help you debug, namely transformers version, python version, code example, etc.

Have you seen the issue template? Respecting it will ensure you get help :slightly_smiling_face:
Fix Documentation issue in BertForMaskedLM forward
Author: bharatr21
Pull request: yes

Fix #3066 by interchanging positions of `ltr_lm_loss` and `masked_lm_loss`

Comments:
# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/3855?src=pr&el=h1) Report
> Merging [#3855](https://codecov.io/gh/huggingface/transformers/pull/3855?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/a21d4fa410dc3b4c62f93aa0e6bbe4b75a101ee9&el=desc) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/huggingface/transformers/pull/3855/graphs/tree.svg?width=650&height=150&src=pr&token=9qOlN6Hb1c)](https://codecov.io/gh/huggingface/transformers/pull/3855?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master    #3855   +/-   ##
=======================================
  Coverage   78.61%   78.62%           
=======================================
  Files         106      106           
  Lines       17953    17953           
=======================================
+ Hits        14114    14115    +1     
+ Misses       3839     3838    -1     
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/3855?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/modeling\_bert.py](https://codecov.io/gh/huggingface/transformers/pull/3855/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ19iZXJ0LnB5) | `88.40% <100.00%> (ø)` | |
| [src/transformers/modeling\_tf\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/3855/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl91dGlscy5weQ==) | `92.76% <0.00%> (+0.16%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/huggingface/transformers/pull/3855?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/huggingface/transformers/pull/3855?src=pr&el=footer). Last update [a21d4fa...06fb495](https://codecov.io/gh/huggingface/transformers/pull/3855?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Good catch @Bharat123rox - thanks for the PR :-)
Documentation and code mismatch in BertForMaskedLM forward method
Author: onurgu
Pull request: no
Labels: name: Documentation

# 🐛 Bug

## Information

Model I am using (Bert, XLNet ...):

BertForMaskedLM

Language I am using the model on (English, Chinese ...):

Not important.

The problem arises when using:
* [x] my own modified scripts: (give details below)

The tasks I am working on is:

I am trying to obtain LM probabilities for research purposes.

## To reproduce

Steps to reproduce the behavior:

1. According to the documentation, the code below should work as expected.

However, masked_lm_loss and ltr_lm_loss values are in fact in 2nd and 1st positions. This is apparent if the code is inspected, i.e. lm_labels related code is executed after masked_lm_labels related code.

See https://github.com/huggingface/transformers/blob/908fa43b543cf52a3238129624f502240725a6a6/src/transformers/modeling_bert.py#L1001-L1014

and

https://github.com/huggingface/transformers/blob/908fa43b543cf52a3238129624f502240725a6a6/src/transformers/modeling_bert.py#L1014

The following code is an excerpt from my code.

```python
model = BertForMaskedLM.from_pretrained('bert-base-cased')
with torch.no_grad():
    outputs = model(token_ids_in_sentence_tensor,
                    masked_lm_labels=token_ids_in_sentence_tensor,
                            lm_labels=token_ids_in_sentence_tensor,
                            token_type_ids=segments_tensors)
    masked_lm_loss = outputs[0]
    ltr_lm_loss = outputs[1]
    predictions = outputs[2]
```

## Expected behavior

Explained above.

## Environment info
     
- `transformers` version:
- Platform: Darwin XXX-3.local 19.3.0 Darwin Kernel Version 19.3.0: Thu Jan  9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64 x86_64
- Python version: 3.7.4
- PyTorch version (GPU?): no GPU, 1.3.1
- Tensorflow version (GPU?): 2.0.0
- Using GPU in script?: No
- Using distributed or parallel set-up in script?: No


Comments:
How to set local_rank argument in run_squad.py
Author: tothniki
Pull request: no

Hi!

I would like to try out the run_squad.py script (with AWS SageMaker in a PyTorch container).
I will use 8 x 100V 16 GB GPUs for the training.
How should I set the the local_rank parameter in this case?
( I tried to understand it from the code, but I couldn't really.)

Thank you for the help!

Comments:
The easiest way is to use the torch launch script. It will automatically set the local rank correctly. It would look something like this (can't test, am on phone) :

```bash
python -m torch.distributed.launch --nproc_per_node 8 run_squad.py <your arguments>
```

Hi,

Thanks for the fast answer!

Yes I saw this solution in the examples,  but I am interested in the case when I am using PyTorch container and I have to set up an entry point for the training (= run_squad.py) and its parameters . And so in that case how should I set it? Or just let it to be -1? 

(Or you recommend in that case to create a bash file as entry where I start this torch lunch.)

Thanks again! 

If you want to run it manually, you'll have to run the script once for each GPU, and set the local rank to the GPU ID for each process. It might help to look at the contents of the launch script that I mentioned before. It shows you how to set the local rank automatically for multiple processes, which I think is what you want. 

Ok, thanks for the response!  I will try that!

If your problem is fixed, please do close this issue. 

@tothniki Did you have to modify the script very much to run with SM? Attempting to do so now, as well. 

@petulla No, at the end i didn't modify anything regarding to the multiple GPU problem. ( of course I had to modify the read-in and the save to a S3 Bucket).I tried with SageMaker as it was, and it seemed to me that the distribution between GPUs worked.

> The easiest way is to use the torch launch script. It will automatically set the local rank correctly. It would look something like this (can't test, am on phone) :
> 
> ```shell
> python -m torch.distributed.launch --nproc_per_node 8 run_squad.py <your arguments>
> ```

Hi @ugent

what about ( run_language_modeling.py )  ? 
Does passing local_rank = 0  to it means  it will automatically do the task on 4 GPUs (for ex.) which we have available ? and our speed will be 4 times faster ? (by distributed training)

or we have to run script by ( python -m torch.distributed.launch .....)
 



@mahdirezaey

Please use the correct tag when tagging...

No, it will not do this automatically, you have to use the launch utility.
create readme for spentaur/yelp model
Author: spentaur
Pull request: yes
Labels: name: model card

sorry, not sure if this is the right way to do this

Comments:
It is! (though ideally you would add an example of use + details about training)

Will merge this unless you add more in the next 24 hours.

# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/3874?src=pr&el=h1) Report
> Merging [#3874](https://codecov.io/gh/huggingface/transformers/pull/3874?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/b1ff0b2ae7d368b7db3a8a8472a29cc195d278d8&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/huggingface/transformers/pull/3874/graphs/tree.svg?width=650&height=150&src=pr&token=9qOlN6Hb1c)](https://codecov.io/gh/huggingface/transformers/pull/3874?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master    #3874   +/-   ##
=======================================
  Coverage   78.57%   78.57%           
=======================================
  Files         106      106           
  Lines       17962    17962           
=======================================
  Hits        14114    14114           
  Misses       3848     3848           
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/huggingface/transformers/pull/3874?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/huggingface/transformers/pull/3874?src=pr&el=footer). Last update [b1ff0b2...8a40fb1](https://codecov.io/gh/huggingface/transformers/pull/3874?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


that makes a lot of sense. i'll update that. thank you

[model page](https://huggingface.co/spentaur/yelp)
No longer able to fine-tune GPT2 using provided examples
Author: texturejc
Pull request: no

A few months ago, I was able to run GPT2 on a Google Colab notebook. This was using the following script, which is based on the provided docs:

```
!git clone https://github.com/huggingface/transformers
%cd transformers
!pip install .
!pip install -r ./examples/requirements.txt

!python /content/transformers/examples/run_lm_finetuning.py \
    --output_dir=output \
    --model_type=gpt2 \
    --model_name_or_path=gpt2 \
    --do_train \
    --train_data_file=/content/train.txt \
    --do_eval \
    --eval_data_file=/content/test.txt \
    --per_gpu_train_batch_size=2

!python /content/transformers/examples/run_generation.py \
    --model_type=gpt2 \
    --model_name_or_path=gpt2 \
    --length 500
```
Coming back to it after a little while, it no longer works. I realise that `run_lm_finetuning.py` has been replaced by `run_language_modeling.py`. However, running this file instead either produces a `command not found error`, or it asks me to provide details that I've already provided: `the following arguments are required: --train_data_file, --output_dir, --model_type`.

I appreciate that you guys perform a great service to the community by making these models available, and I thank you for doing so. I also understand that it's my responsibility to keep up with changes. All the same, any help in getting this functionality back on track would be appreciated!



Comments:
Never mind; this was an issue with the colab. It's sorted now.