noamaanMulla-03/transformers-issues huggingface dataset:
OSError: [Errno 116] Stale file handle
Author: jimkim3
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! -->

- `transformers` version:
- Platform: linux
- Python version: 3.7
- PyTorch version (GPU?): 1.6
- Tensorflow version (GPU?): - 
- Using GPU in script?: - 
- Using distributed or parallel set-up in script?: - only 1 GPU

### Who can help
 Trainer: @sgugger
 examples/seq2seq: @patil-suraj

## Information
Hi, I am training finetune_trainer.py on on wmt dataset. I am getting the following error sometimes, do you have an idea what might cause it? thanks for any suggestion 

```
  File "finetune_trainer.py", line 342, in <module>
    main()
  File "finetune_trainer.py", line 256, in main
    if (os.path.isdir(training_args.output_dir) and not training_args.optimize_from_scratch) else None,
  File "/home/jim/trainer.py", line 814, in train
    self._maybe_log_save_evaluate(tr_loss, model, trial, epoch)
  File "/home/jim/trainer.py", line 885, in _maybe_log_save_evaluate
    self._save_checkpoint(model, trial, metrics=metrics)
  File "/home/jim/trainer.py", line 916, in _save_checkpoint
    torch.save(self.optimizer.state_dict(), os.path.join(output_dir, "optimizer.pt"))
  File "/home/jim/libs/anaconda3/envs/success/lib/python3.7/site-packages/torch/serialization.py", line 374, in save
    _legacy_save(obj, opened_file, pickle_module, pickle_protocol)
  File "/home/jim/libs/anaconda3/envs/success/lib/python3.7/site-packages/torch/serialization.py", line 214, in __exit__
    self.file_like.close()
OSError: [Errno 116] Stale file handle
```
Model I am using T5.

## To reproduce
this is not happening all the time, but it does happen

## Expected behavior

to run the codes


Comments:
This probably seems more related to your system rather than `Trainer` or `finetune_trainer.py` 

thanks, but I just do not see why this happens, any idea is appreciated

On Thu, Jan 21, 2021 at 5:01 PM Suraj Patil <notifications@github.com>
wrote:

> This probably seems more related to your system rather than Trainer or
> finetune_trainer.py
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/huggingface/transformers/issues/9732#issuecomment-764746041>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ANVIVSDVFWQUXCYIYLAOA23S3BFVFANCNFSM4WNBWFSQ>
> .
>


This issue has been automatically marked as stale and been closed because it has not had recent activity. Thank you for your contributions.

If you think this still needs to be addressed please comment on this thread.
Docs suggest to use discriminator weights for ElectraForMaskedLM instead of generator
Author: jbingel
Pull request: no
Labels: name: wontfix

## Environment info

- `transformers` version: 4.2.2
- Platform: Linux-5.3.0-64-generic-x86_64-with-Ubuntu-19.10-eoan
- Python version: 3.7.5
- PyTorch version (GPU?): 1.6.0 (False)
- Tensorflow version (GPU?): not installed (NA)
- Using GPU in script?: no
- Using distributed or parallel set-up in script?: no

### Who can help
 @LysandreJik

## Information

Model I am using (Bert, XLNet ...): ELECTRA

The problem arises when using:
* [x] the official example scripts: https://huggingface.co/transformers/model_doc/electra.html#codecell3
* [ ] 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: I want to check if a some word fits into the context of a sentence, for which I use the prediction probability of that word at the MASK position

## To reproduce

Steps to reproduce the behavior:

1. `from transformers import ElectraForMaskedLM`
2. `model = ElectraForMaskedLM.from_pretrained('google/electra-small-discriminator')`

## My issue

I get the following warning: 

`Some weights of ElectraForMaskedLM were not initialized from the model checkpoint at google/electra-small-discriminator and are newly initialized: ['generator_predictions.LayerNorm.weight', 'generator_predictions.LayerNorm.bias', 'generator_predictions.dense.weight', 'generator_predictions.dense.bias', 'generator_lm_head.weight', 'generator_lm_head.bias']`

I understand that I'm loading the discriminator weights, whereas ElectraForMaskedLM needs the generator weights for the MLM output. Why do the docs tell me to use the discriminator? Am I missing something?




Comments:
Hello! Indeed, this is a mistake! Do you want to update the docs to show the generator instead?

This issue has been automatically marked as stale and been closed because it has not had recent activity. Thank you for your contributions.

If you think this still needs to be addressed please comment on this thread.
Text generation pipeline - output_scores parameter
Author: bala1802
Pull request: no
Labels: name: wontfix

In `text-generation` pipeline, I am looking for a parameter which calculates the confidence score of the generated text. Source: [here](https://huggingface.co/transformers/main_classes/pipelines.html#transformers.TextGenerationPipeline)

I am assuming that,  `output_scores` (from [here](https://huggingface.co/transformers/main_classes/configuration.html#transformers.PretrainedConfig)) parameter is not returned while prediction,

**Code**:

`predictedText = pipeline('text-generation',model=checkpoint_path, tokenizer=gpt2_tokenizer, config={'max_length':20, 'output_scores':True})`

`predictedText('This is a ')`


**Output**:

`Setting `pad_token_id` to `eos_token_id`:50256 for open-end generation.
[{'generated_text': 'This is a Generated Text'}]`

In the output, I am looking for a confidence score of the predicted text to be displayed





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 and been closed because it has not had recent activity. Thank you for your contributions.

If you think this still needs to be addressed please comment on this thread.
Mistake in the "Summary of the tasks" article
Author: BunnyNoBugs
Pull request: no
Labels: name: wontfix

Two first points of the translation process are duplicating two first points of summarization process:
[https://huggingface.co/transformers/task_summary.html#translation](https://huggingface.co/transformers/task_summary.html#translation)

> 1. Instantiate a tokenizer and a model from the checkpoint name. Summarization is usually done using an encoder-decoder model, such as Bart or T5.
> 2. Define the article that should be summarized.

Comments:
Indeed! Do you want to open a PR with a doc fix?

I would like to, but I couldn't find where that exact doc in the repo is

Also, a built-in tool for pointing out mistakes in the docs would be usable (like those when you highlight an error and press Ctrl+Enter). I notice a few mistakes and typos from time to time.
I am speaking not about the docs themselves, but about the guides and tutorials which are more community-oriented

> Indeed! Do you want to open a PR with a doc fix?

@LysandreJik, could you please point out the doc I could fix?

Here it is: https://github.com/huggingface/transformers/blob/master/docs/source/task_summary.rst

This issue has been automatically marked as stale and been closed because it has not had recent activity. Thank you for your contributions.

If you think this still needs to be addressed please comment on this thread.
Order of inputs (difference between doc and output)
Author: tide90
Pull request: no
Labels: name: wontfix

Hey,

when using a dictionary as model input does the order matters? Eg:

`model({"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": attention_mask})
`

and 

`model({"input_ids": input_ids, "attention_mask": attention_mask, "token_type_ids": token_type_ids})
`

When using tokenizer I get a order different from the docstring and arguments order:

```
tokenizer = BertTokenizer.from_pretrained('bert-base-cased')
input_query = tokenizer(input_query,max_length=MAX_SEQ_lEN,padding="max_length",truncation=True,return_tensors="tf")

-> {"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": attention_mask}
```


v3.4


Comments:
Hi! Order doesn’t matter in a dictionary. 

It only matters if you use the arguments as positional arguments, which is not recommended.

@LysandreJik 

So, order does matter when using lists? What is now the right order?


This issue has been automatically marked as stale and been closed because it has not had recent activity. Thank you for your contributions.

If you think this still needs to be addressed please comment on this thread.
tokenizer decode method
Author: Zessay
Pull request: no
Labels: name: wontfix

<!-- 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.1.1
- Platform: Windows-10-10.0.19041-SP0
- Python version: 3.7.9
- PyTorch version (GPU?): 1.7.1+cu101 (True)
- Tensorflow version (GPU?): not installed (NA)
- Using GPU in script?: No
- Using distributed or parallel set-up in script?: No

### Who can help
<!-- Your issue 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
 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: @patrickvonplaten @TevenLeScao
 Blenderbot: @patrickvonplaten
 Bart: @patrickvonplaten
 Marian: @patrickvonplaten
 Pegasus: @patrickvonplaten
 mBART: @patrickvonplaten
 T5: @patrickvonplaten
 Longformer/Reformer: @patrickvonplaten
 TransfoXL/XLNet: @TevenLeScao
 RAG: @patrickvonplaten, @lhoestq
 FSMT: @stas00
 examples/seq2seq: @patil-suraj
 examples/bert-loses-patience: @JetRunner
 ray/raytune: @richardliaw @amogkam
 tensorflow: @jplu
 examples/token-classification: @stefan-it
 documentation: @sgugger
 -->

@mfuntowicz

## Information

When I learn the source code of the tokenizer method `decode`, I found a problem in the **line 719 of the file `tokenization_utils.py`**. In my view, the type of the variable `token` is `str`, while the type of the property `all_special_ids` is `List[int]`. Although this problem will not raise error, even has no effect to the `decode` method, I still think this is a case which is need to be fixed for us to understand.


<!-- 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. -->


I think it is required to replace `self.all_special_ids` with `self.all_special_tokens` in the **line 719 of the file `tokenization_utils.py`**.

Comments:
This issue has been automatically marked as stale and been closed because it has not had recent activity. Thank you for your contributions.

If you think this still needs to be addressed please comment on this thread.
Where is convert_bert_original_tf_checkpoint_to_pytorch.py?
Author: sednaasil
Pull request: no
Labels: name: wontfix

name: Migration

HI:  

I am getting the following error when implementing entity extraction in BERT.  OSError: Error no file named ['pytorch_model.bin', 'tf_model.h5', 'model.ckpt.index']

I am very new to using BERT, and noted that [issue 2110](https://github.com/huggingface/transformers/issues/2110) had a similar issue.  Issue 2110 was referred to the convert_bert_original_tf_checkpoint_to_pytorch.py file.  However, the current link isn't working.  Could you point me to its current location?

V/r,
L

Comments:
Its current location is [here](https://github.com/huggingface/transformers/blob/master/src/transformers/models/bert/convert_bert_original_tf_checkpoint_to_pytorch.py).

Hi @sednaasil, what are you trying to do? Could you show the code that you're using so that we may help you debug it? Thanks.

Hi!  

I downloaded the uncased_L-12_H-768_A-12 BERT model to create an entity extraction tool following this [method](https://github.com/abhishekkrthakur/bert-entity-extraction).  The model I downloaded did not include 'pytorch_model.bin', 'tf_model.h5', 'model.ckpt.index' files, resulting in an error implementing my model.  I saw a previous post where the files I needed were generated with the convert_bert_original_tf_checkpoint_to_pytorch.py file; however the link to the file was broken.  Is this the correct way to proceed?



Where did you download your model from? Is something preventing you from using `bert-base-cased`?

```py
from transformers import BertModel

model = BertModel.from_pretrained("bert-base-cased")
```

This issue has been automatically marked as stale and been closed because it has not had recent activity. Thank you for your contributions.

If you think this still needs to be addressed please comment on this thread.
bounding by compute, retraining from the time the model is killed 
Author: ghost
Pull request: no
Labels: name: wontfix

Hi
I have limited access to GPUs, with limited hours, I am using finetune_trainer.py is there a way I can retrain the models from the time it is killed? could you assist me and give me some hints?
thanks 

Comments:
This issue has been automatically marked as stale and been closed because it has not had recent activity. Thank you for your contributions.

If you think this still needs to be addressed please comment on this thread.
Seq2Seq include custom glossary/dictionary
Author: codingnoobneedshelp
Pull request: no
Labels: name: wontfix

Hello, 

Is it possible to include a custom glossary/dictionary while fine-tuning the Seq2Seq model for a specific domain?

So I basically want to ensure that specific words are always translated as they are in the glossary/dictionary. 

Thanks for helping out.

coodingnoobneedshelp

Comments:
Hi @codingnoobneedshelp 

Not sure what exactly this means,

What do you mean by

> custom glossary/dictionary

and 
> ensure that specific words are always translated as they are in the glossary/dictionary.

Thanks for the answer. Let me try to clarify this. 
From Google:  A glossary is a custom dictionary to consistently translate the customer's domain-specific terminology. This typically involves specifying how to translate a named entity. 

For example, a Person name: "Peter Eisen" must translate to "Peter Eisen." There are some cases where the model would translate this to "Peter Iron". 

So I basically want to have a dictionary that tells the model that "Peter Eisen" should always be "Peter Eisen".

Does anyone know how I can archive that?

Thanks

This issue has been automatically marked as stale and been closed because it has not had recent activity. Thank you for your contributions.

If you think this still needs to be addressed please comment on this thread.
Print All Tokens Over a Certain Probability Threshold: T5 
Author: BigSalmon2
Pull request: no
Labels: name: wontfix

`This works with GPT-2, but not with T5. Is it possible to adapt this to make T5 work? This works with GPT-2, but not with T5. Is it possible to adapt this to make T5 work?`

```
import torch
import torch.nn.functional as F
from transformers import AutoTokenizer, AutoModelWithLMHead
tokenizer = AutoTokenizer.from_pretrained("t5-base")
model = AutoModelWithLMHead.from_pretrained("t5-base")
input_txt = "Hello, my name is Sylvain."
inputs = tokenizer(input_txt, return_tensors='pt')
outputs = model(**inputs)
predictions = F.softmax(outputs[0], dim=-1)
thresh = 1e-2
vocab_size = predictions.shape[-1]
idxs = torch.arange(0, vocab_size)[predictions[0][-1] >= thresh]
print(tokenizer.convert_ids_to_tokens(idxs))
```

`ValueError: You have to specify either decoder_inputs or decoder_inputs_embeds`

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?

Have you checked the [T5 docs](https://huggingface.co/transformers/model_doc/t5.html) regarding the `decoder_inputs`? Are they unclear?

Thanks!

This issue has been automatically marked as stale and been closed because it has not had recent activity. Thank you for your contributions.

If you think this still needs to be addressed please comment on this thread.
Documentation's example script linked does no exist anymore
Author: Skylixia
Pull request: no
Labels: name: wontfix

Hello,

I'm looking at the [documentation ](https://huggingface.co/transformers/v2.2.0/examples.html#abstractive-summarization) provided examples to be able to fine-tune a summarization task. It refers to the script run_summarization_finetuning.py but the link provided: https://github.com/huggingface/transformers/blob/master/examples/run_summarization_finetuning.py
returns a 404 error. 
Did the script migrate to another link ? Where can I find an example for the fine-tuning of a summarization task now ?

Thank you!

Comments:
Hello @Skylixia,

I believe the summarisation examples have been migrated to the `seq2seq` folder here: https://github.com/huggingface/transformers/tree/master/examples/seq2seq

In the README, you can find instructions on how to fine-tune a model for summarisation: https://github.com/huggingface/transformers/tree/master/examples/seq2seq#fine-tuning-using-seq2seqtrainer

HTH!

This issue has been automatically marked as stale and been closed because it has not had recent activity. Thank you for your contributions.

If you think this still needs to be addressed please comment on this thread.
wrong output for Bert-larged-uncased
Author: Twsschx
Pull request: no
Labels: name: wontfix

I am running Bert for the pytorch version:

from transformers import BertConfig, BertTokenizer, BertModel

config_class, model_class, tokenizer_class = (BertConfig, BertModel, BertTokenizer)
        
transformer_config = config_class.from_pretrained(pretrained_model + "/bert_config.json")
tokenizer = tokenizer_class.from_pretrained(pretrained_model, do_lower_case = True)
transformer_model = model_class.from_pretrained(pretrained_model, config=transformer_config)

last_hidden_states, pooling_output =transformer_model(input_ids_tensor, attention_mask_tensor, segment_ids_tensor)

The output of 'transformer_model' -- last_hidden_states, should be a Tensor. But the result is 'last_hidden_state', that means it is a string object. What's wrong with it ?


Comments:
Hi @Twsschx 

In the newer version of transformers, PyTorch models have outputs that are instances of subclasses of `ModelOutput`,
to access it as a tuple, you can use slicing, or to get a particular tensor, just provide the key to the output class.

i.e 
```python3
last_hidden_states, pooling_output =transformer_model(input_ids_tensor, attention_mask_tensor, segment_ids_tensor)[:] # slice
```

or 
```python3
output =transformer_model(input_ids_tensor, attention_mask_tensor, segment_ids_tensor)
last_hidden_state = output["last_hidden_states"]
pooling_output = output["pooler_output"]
```

And if you want the models to output tuple like the previous versions, then pass `return_dict=False` to `forward`

```python3
last_hidden_states, pooling_output = transformer_model(**inputs, return_dict=False)
```

You can find more about output classes in this [doc](https://huggingface.co/transformers/main_classes/output.html).

Thanks. It helps me a lot!

This issue has been automatically marked as stale and been closed because it has not had recent activity. Thank you for your contributions.

If you think this still needs to be addressed please comment on this thread.
Where is the impact when output_attentions=True?
Author: celsofranssa
Pull request: no
Labels: name: wontfix

Is there any impact regarding performance (training/fine-tuning time, GPU memory, batch size, etc.) when  `output_attentions=True`?

```python
self.bert_encoder = BertModel.from_pretrained(
            hparams.architecture, # "bert-base-uncased"
            output_attentions=True)
```

Comments:
If `output_attentions=True` memory consumption should increase significantly (for large `sequence_length`) since we now store all attentions of size (`batch_size`, `num_heas`, `sequence_length`, `sequence_length`). This is less significant in training since the stored activations for training consume most RAM anyways. Speed should not be really affected by this.

This issue has been automatically marked as stale and been closed because it has not had recent activity. Thank you for your contributions.

If you think this still needs to be addressed please comment on this thread.
[Marian] Doc says `config.add_bias_logits=True`, but config is has `config.add_bias_logits=False`
Author: patrickvonplaten
Pull request: no
Labels: name: wontfix

**Question**:

In the docs, it is written that Marian has (contrary to Bart), `config.add_bias_logits=True`: https://huggingface.co/transformers/model_doc/marian.html#implementation-notes. But when looking into the code: 
https://github.com/huggingface/transformers/blob/b01f451ca38695c60175b34d245997ef4d18231d/src/transformers/models/marian/configuration_marian.py#L25 Marian has the exact same default config as Bart and also Marian's config files online have `config.add_bias_logits=False` - see:
https://huggingface.co/Helsinki-NLP/opus-mt-en-de/resolve/main/config.json

@sshleifer @patil-suraj 

Is the documentation not up-to-date anymore? Because all the slow tests are passing....


Comments:
I think what's going on is that `config.add_final_bias_logits` is unused.

In modeling_bart.py line 148 we call

```python
self.register_buffer("final_logits_bias", torch.zeros((1, self.model.shared.num_embeddings)))
```
regardless of the config, and then if it's in the state dict it will get loaded by `from_pretrained`.

I do think that `final_bias_logits` is in the marian state dict, as this line would have `KeyError`'d during conversion otherwise: https://github.com/sshleifer/transformers_fork/blob/121ec9dced3d068352078e7c3523ecd66830e39e/src/transformers/models/marian/convert_marian_to_pytorch.py#L461-L461 



This issue has been automatically marked as stale and been closed because it has not had recent activity. Thank you for your contributions.

If you think this still needs to be addressed please comment on this thread.
how to evaluate models on SUPER_GLUE benchmark?
Author: YoungTimmy
Pull request: no
Labels: name: wontfix

Hi, I am trying to evaluate models on SUPER_GLUE benchmark. 
However, I can load SUPER_GLUE dataset from Transformer but I cant find any metrics of this benchmark.
Is there any script like _**superglue_metrics.py**_ that can evaluate models on superglue?

thanks a lot! :)

Comments:
This issue has been automatically marked as stale and been closed because it has not had recent activity. Thank you for your contributions.

If you think this still needs to be addressed please comment on this thread.