noamaanMulla-03/transformers-issues huggingface dataset:
Fix/test convert_mbart.py
Author: sshleifer
Pull request: no
Labels: name: wontfix

from [forums](https://discuss.huggingface.co/t/how-can-i-convert-a-model-created-with-fairseq/564/10?u=sshleifer)


```

    Traceback (most recent call last):
      File "./convert_mbart_original_checkpoint_to_pytorch.py", line 7, in <module>
        from .convert_bart_original_pytorch_checkpoint_to_pytorch import remove_ignore_keys_
    ModuleNotFoundError: No module named '__main__.convert_bart_original_pytorch_checkpoint_to_pytorch'; '__main__' is not a package
```

After I change `from .convert_bart_original_pytorch_checkpoint_to_pytorch import remove_ignore_keys_` to `from convert_bart_original_pytorch_checkpoint_to_pytorch import remove_ignore_keys_` (just removing the dot), the script can run

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.
Dataloader in Trainer num_workers > 0
Author: diegoantognini
Pull request: no
Labels: name: wontfix

# ❓ Questions & Help

I notice that when doing inference/training with a pre-trained language model in a Trainer, only one worker is used. For training it's not a problem as the batch size is usually small, however, for inference, I can largely increase it.

However, it seems that https://github.com/huggingface/transformers/blob/master/src/transformers/trainer.py#L263 only supports num_workers=0. I tried to modified it manually and put num_workers=10, but no effect.

Am I doing something wrong in my reasoning?

Thanks for your help!

Comments:
I also have the same issue.

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.
Trainer.evaluate does not support seq2seq models
Author: Guitaricet
Pull request: no
Labels: name: wontfix

# 🐛 Bug

## Information

Hi! I can't thank you enough for Transformers. I know that the Trainer is still under development, but would like to report this just to know the current status.

Currently `Trainer._prediction_loop` assumes that different batches of data have the same shape.
Specifically, [this line](https://github.com/huggingface/transformers/blob/473808da0d476792070f0e7dfebcf1121a12a34f/src/transformers/trainer.py#L786)

```python
preds = torch.cat((preds, logits.detach()), dim=0)
```

This does not allow to use Trainer.evaluate for models with a variable output (e.g. seq2seq models). One of the possible solutions is to pad all batches to the same length, but it is pretty inefficient.

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:

1. create seq2seq model
2. pad batches in such a way that each batch is padded to the maximum length within batch
3. create Trainer for the model, call .evaluate() 

```
Traceback (most recent call last):
  File "/home/vlialin/miniconda3/lib/python3.7/site-packages/transformers/trainer.py", line 509, in train
    self.evaluate()
  File "/home/vlialin/miniconda3/lib/python3.7/site-packages/transformers/trainer.py", line 696, in evaluate
    output = self._prediction_loop(eval_dataloader, description="Evaluation")
  File "/home/vlialin/miniconda3/lib/python3.7/site-packages/transformers/trainer.py", line 767, in _prediction_loop
    preds = torch.cat((preds, logits.detach()), dim=0)
RuntimeError: Sizes of tensors must match except in dimension 0. Got 29 and 22 in dimension 1
```

## Expected behavior

Trainer is able to evaluate Seq2seq

## Environment info

- `transformers` version: 2.11
- Platform: Linux
- Python version: 3.7.6
- PyTorch version (GPU?): 1.5.0
- Tensorflow version (GPU?): 2.2.0
- Using GPU in script?: No
- Using distributed or parallel set-up in script?: No


Comments:
Hi @Guitaricet , if you only want to evaluate for loss (AFAIK this is the case for seq2seq models) then you can set `prediction_loss_only` to `True`

Hi! Thank you, but I need the metrics too. Workaround was to inherit from `Trainer` and override `_prediction_loop`. 

That sounds like a reasonable solution, but we should document this somewhere. Pinging @sgugger on this:)

Yes, documentation about trainer would be awesome! Would love to contribute

Still no updates on this issue?

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.
Multi-gpu LM finetuning
Author: cppntn
Pull request: no
Labels: name: wontfix

Hello, 

how can I run LM finetuning with more than one gpu (specifically I want to train gpt2-medium on Google Cloud with four nvidia T4, 64GB).

What are the arguments to pass to `run_language_modeling.py` script?

Thanks

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.
OSError: Model name 'lonePatient/albert_chinese_small' was not found in tokenizers model
Author: SeekPoint
Pull request: no
Labels: name: wontfix

my code:

from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("lonePatient/albert_chinese_small")
model = AutoModel.from_pretrained("lonePatient/albert_chinese_small")
model.save_pretrained("lonePatient+albert_chinese_small")


+++++++++++

Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 633/633 [00:00<00:00, 113kB/s]
Traceback (most recent call last):
  File "hg_download.py", line 30, in <module>
    tokenizer = AutoTokenizer.from_pretrained("lonePatient/albert_chinese_small")
  File "/usr/local/lib/python3.8/site-packages/transformers/tokenization_auto.py", line 217, in from_pretrained
    return tokenizer_class_py.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/transformers/tokenization_utils_base.py", line 1140, in from_pretrained
    return cls._from_pretrained(*inputs, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/transformers/tokenization_utils_base.py", line 1239, in _from_pretrained
    raise EnvironmentError(
OSError: Model name 'lonePatient/albert_chinese_small' was not found in tokenizers model name list (albert-base-v1, albert-large-v1, albert-xlarge-v1, albert-xxlarge-v1, albert-base-v2, albert-large-v2, albert-xlarge-v2, albert-xxlarge-v2). We assumed 'lonePatient/albert_chinese_small' was a path, a model identifier, or url to a directory containing vocabulary files named ['spiece.model'] but couldn't find such vocabulary files at this path or url.
~/ub16_prj %

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.
delete unused tiny models
Author: sshleifer
Pull request: no
Labels: name: wontfix

```
                           [ok] bart-tiny-random/
                           [ok] tiny-marian-en-de/
                           [ok] tiny-mbart/
                           [deleted] distilbert_tiny_random/
                           [ok] tiny-ctrl/
                           PRE tiny-dbmdz-bert-large-cased-finetuned-conll03-english/
                           [ok] tiny-distilbert-base-cased-distilled-squad/
                           [ok] tiny-distilbert-base-cased/
                           [ok] tiny-distilbert-base-uncased-finetuned-sst-2-english/
                           [ok] tiny-distilroberta-base/
                           [ok] tiny-gpt2/
                           [ok] tiny-xlnet-base-cased/
```
and make sure the ones that remain are usable/have tokenizer files.

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.
Wrong answers from Longformer model even on simple questions
Author: danishpruthi
Pull request: no
Labels: name: wontfix

I am using the pretrained model `allenai/longformer-large-4096-finetuned-triviaqa`, however upon inspecting it on my system and the demo on the huggingface website, the outputs seem off even for very simple examples and samples from the dataset.

1. [Example 1](https://www.dropbox.com/s/9h3dcqpwq0n1b05/download%20%283%29.png?dl=0)
2. [Example 2](https://www.dropbox.com/s/40e93m2odix8x1p/download%20%284%29.png?dl=0)
3. [Example 3](https://www.dropbox.com/s/s5t1k6jluyzfs33/download%20%286%29.png?dl=0)
4. [Example 4](https://www.dropbox.com/s/oyps5a5gr2e4c25/download%20%287%29.png?dl=0)

Other models for QA (like `bert-large-uncased-whole-word-masking`) get such simple examples right.


Comments:
Yeah this is related to a bug, see: https://github.com/huggingface/transformers/pull/4615

cc @mfuntowicz @julien-c - we should refactor the squad preprocessing in pipelines to make longformer work.

Hi @patrickvonplaten: are there are any updates with respect to this?

We will probably start working on a fix in ~2 weeks.

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 is distillbart-cnn done with no teacher and distilbart-xsum has a teacher?
Author: moyid
Pull request: no
Labels: name: Discussion

name: wontfix

@sshleifer Can you expand on why distillbart-xsum is done with a teacher and distillbart-cnn is not?



Comments:
It's purely empirical. `distilbart-xsum` variants perform about 1-2 ROUGE pts worse without a teacher, the gap is basically 0 for the `distilbart-cnn` variants.  For translation, it seems like teacher also helps a bit.


In the future, you can tag me on discussion questions on discuss.huggingface.co !

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.
The default cache directory is lack of disk capacity, I need change the configure of the default cache directory.
Author: leeivan
Pull request: no
Labels: name: wontfix

# 🚀 Feature request

<!-- A clear and concise description of the feature proposal.
     Please provide a link to the paper and code in case they exist. -->

## Motivation

<!-- Please outline the motivation for the proposal. Is your feature request
     related to a problem? e.g., I'm always frustrated when [...]. If this is related
     to another GitHub issue, please link here too. -->

## Your contribution

<!-- Is there any way that you could help, e.g. by submitting a PR?
     Make sure to read the CONTRIBUTING.MD readme:
     https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md -->


Comments:
Please try to write better posts in the future. This is just lazy.

You can set the directory for a cache with the `TRANSFORMERS_CACHE` environment variable.

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 do categorical sequence classification?
Author: FerusAndBeyond
Pull request: no

Whenever I have a sequence of max length y of batch size x: (x, y) and categorical (z) classification (x, z) I get the error that batch size isn't the same x vs x*z, how do I fix this?

Comments:
Solved  by adding `num_labels` to the constructor: `BertForSequenceClassification.from_pretrained("...", num_labels=z)`. Then the onehot-encoding wasn't necessary either. Another error would probably make it easier to spot this though.
Tokenizers as an optional dependency
Author: jeanm
Pull request: no

# 🚀 Feature request

<!-- A clear and concise description of the feature proposal.
     Please provide a link to the paper and code in case they exist. -->

Would it be possible to make `tokenizers` an optional dependency? I see this was already attempted here by @thomwolf: https://github.com/huggingface/transformers/pull/2342.

## Motivation

<!-- Please outline the motivation for the proposal. Is your feature request
     related to a problem? e.g., I'm always frustrated when [...]. If this is related
     to another GitHub issue, please link here too. -->
For various reasons we are unable to support Rust in our environment. Given that `tokenizers` is a hard dependency, this means we cannot use `transformers` at all. We would be fine with using the non-fast versions of tokenizers as a workaround.


Comments:
Sounds reasonable, but – if you're at liberty to share – and out of curiosity, would also like to know why you can't install Rust-built native deps

Thanks for the quick response. Rust is generally fine – what's causing issues is specifically the `pyo3` crate, which has a somewhat involved build script which doesn't get along with our build system.

Hi @jeanm, I work on the tokenizers library, can you explain how you are unable to use `tokenizers` ? You should never have to "see" Rust as we ship prebuilt libraries.
Maybe we are missing a platform we should add so that you don't have to build from source and so you don't have an issue with Rust or Pyo3 ?

Only using the python tokenizers may prevent you from running some example scripts and use some additional functionalities of the library in the future though since we plan to rely more and more on the fast alignements tools provided by the Rust tokenizers to make processing simpler and more accurate.

Do you think you could give us more details on the issue so that we can try to make the tokenizers library compatible with your system?

Happy to talk further by DM/mail if it's easier for you to give some details, you can ping me by email or twitter/linkedin for instance.

Hi @Narsil @thomwolf, thanks for the responses. As a matter of policy (+ technical reasons I unfortunately cannot get into) we have to build all python wheels from source. If it were possible to make `tokenizers` optional without complicating things on your end, we would be perfectly fine with dealing with reduced functionality, as that's still much better than not being able to run the package at all :)
TF2 implementation of LineByLineTextDataset?
Author: simran-khanuja
Pull request: no
Labels: name: wontfix

Hi, I have a text file which I want to use as input for trainer_tf.py. Since it requires a dataset object as input, is there any implementation of something like the LineByLineTextDataset module in TF2 as well?

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.
convert_pytorch_checkpoint_to_tf2.py AttributeError: cls.seq_relationship.weight not found in PyTorch model
Author: DenisStenyushkin
Pull request: no
Labels: name: wontfix

Hi all. I'm trying to convert a pre-trained BERT model from PyTorch into TF2 format and facing a problem.

Model being converted: DeepPavlov/rubert-base-cased. I downloaded all files into a local folder.
File convert_pytorch_checkpoint_to_tf2.py from master branch - I downloaded it separately.

The command I'm running:
`python convert_pytorch_checkpoint_to_tf2.py --tf_dump_path ./rubert-base-cased_tf2/ --model_type bert --pytorch_checkpoint_path ./rubert-base-cased-pt/pytorch_model.bin --config_file ./rubert-base-cased-pt/config.json`

And the stacktrace:
```
Traceback (most recent call last):
  File "convert_pytorch_checkpoint_to_tf2.py", line 364, in <module>
    convert_all_pt_checkpoints_to_tf(
  File "convert_pytorch_checkpoint_to_tf2.py", line 298, in convert_all_pt_checkpoints_to_tf
    convert_pt_checkpoint_to_tf(
  File "convert_pytorch_checkpoint_to_tf2.py", line 209, in convert_pt_checkpoint_to_tf
    tf_model = load_pytorch_checkpoint_in_tf2_model(tf_model, pytorch_checkpoint_path)
  File "/Users/denisstenyushkin/.virtualenvs/tf2_pytorch/lib/python3.8/site-packages/transformers/modeling_tf_pytorch_utils.py", line 92, in load_pytorch_checkpoint_in_tf2_model
    return load_pytorch_weights_in_tf2_model(
  File "/Users/denisstenyushkin/.virtualenvs/tf2_pytorch/lib/python3.8/site-packages/transformers/modeling_tf_pytorch_utils.py", line 166, in load_pytorch_weights_in_tf2_model
    raise AttributeError("{} not found in PyTorch model".format(name))
AttributeError: cls.seq_relationship.weight not found in PyTorch model
```

Versions:
- `transformers` version: 3.0.2
- Platform: macOS-10.15.5-x86_64-i386-64bit
- Python version: 3.8.5
- PyTorch version (GPU?): 1.6.0 (False)
- Tensorflow version (GPU?): 2.3.0 (False)
- Using GPU in script?: no
- Using distributed or parallel set-up in script?: no

Comments:
Hey @DenisStenyushkin,

It seems like you have the PyTorch model trained with our library, so you can simply do:

```python
from transformers import TFBertModel
model = TFBertModel.from_pretrained("./rubert-base-cased-pt", from_pt=True)

model.save("./rubert-base-cased") # this adds a TF model file (tf_model.h5) to your directory
```

Let me know if this does not solve your 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.
losses does not decrease when trainning  with TFTransfoXLLMHeadModel  . 
Author: gaiyongbo
Pull request: no
Labels: name: wontfix

I inspect the source code , because  the weight  initializer in class TFAdaptiveSoftmaxMask  were all set to zeros.   This causes the gradient can't propagate back . please double check that .  

eg:   weight = self.add_weight(
                    shape=(r_idx - l_idx, d_emb_i,),
                    initializer='zeros',
                    trainable=True,
                    name="out_layers_._{}_._weight".format(i),
                )

initializer='zeros' should be some  random initializer like : TruncatedNormal, right?

Comments:
Hey @gaiyongbo,

Thanks for the issue. Will ping our TransfoXL master - @TevenLeScao can you take look maybe? 

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.
[tests] fix slow bart cnn test, faster marian tests
Author: sshleifer
Pull request: yes

+ bart slow cnn test needs to not consider special tokens
+ Marian integration tests run `setupClass`, which downloads a tokenizer, even if they are skipped. By moving that logic to skipped property, we can save 40s of useless tokenizer downloads.

cc @stas00 


Comments:
Merging as this just fixes tests.
style: fix typo
Author: rememberYou
Pull request: yes

# What does this PR do?

## Before submitting
- [x] 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?

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.

Comments:
AdamW 
Author: guoxuxu
Pull request: no

## Environment info
<!-- You can run the command `transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->

Using AdamW of transformers 2.5.1 or 2.6.0, I got the following:

 /home/user/anaconda3/lib/python3.7/site-packages/transformers/optimization.py:155: UserWarning: This overload of add_ is deprecated:
        add_(Number alpha, Tensor other)
Consider using one of the following signatures instead:
        add_(Tensor other, *, Number alpha) (Triggered internally at  /opt/conda/conda-bld/pytorch_1595629403081/work/torch/csrc/utils/python_arg_parser.cpp:766.)
  exp_avg.mul_(beta1).add_(1.0 - beta1, grad)     



- `transformers` version:
- Platform: linux
- Python version: 3.7.4
- PyTorch version (GPU?): 1.6.0
- Tensorflow version (GPU?):
- Using GPU in script?:
- Using distributed or parallel set-up in script?:

### 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
 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: @mariamabarham
 Bart: @sshleifer
 Marian: @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
 -->

## Information

Model I am using (Bert, XLNet ...):

The problem arises when using:
* [ ] the official example scripts: (give details below)
* [ ] 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: (give details below)

## To reproduce

Steps to reproduce the behavior:

1.
2.
3.

<!-- 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. -->


Comments:
Hi, yes, this is a warning, nothing you should be afraid of.
style: fix typo in the README
Author: rememberYou
Pull request: yes

# What does this PR do?

## Before submitting
- [x] 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? 

Comments: