noamaanMulla-03/transformers-issues huggingface dataset:
Support for larger XGLM models
Author: Hritikbansal
Pull request: no
Labels: name: New model

According to the official XGLM repo, https://github.com/pytorch/fairseq/tree/main/examples/xglm, there are five versions of XGLM out there. The architecture of the larger XGLM versions is same as the base XGLM, ; why doesn't HF provide support for larger XGLM versions?  It seems that currently HF provides support for the smallest one (546M parameters) only. 

Comments:
Hi,

There are already 4 variants available: https://huggingface.co/models?other=xglm.

Only the 4.5B variant seems to be missing as of now, but pretty sure @patil-suraj is going to add that one as well.

As Niels pointed out, all the xglm checkpoints are available on the hub except the 4.5B. I'm having some issues with that checkpoint so will upload that once it's resolved.

Just pushed the 4.5B checkpoint https://huggingface.co/facebook/xglm-4.5B

All XGLM checkpoints are now available on the hub. Closing this issue.

Hi @patil-suraj and @NielsRogge ! Thanks for your quick reply! I went through the code of XGLM model. It seems that for the model and tokenizer part, we can only use the smallest one. Because I noticed a snippet like this:

XGLM_PRETRAINED_MODEL_ARCHIVE_LIST = [
    "facebook/xglm-564M",
    # See all XGLM models at https://huggingface.co/models?filter=xglm
]

Would you like to provide any advice to make use of the larger models like 1.7B, 2.5B and 4.5B? For example, just add the model names in the list? Thanks in advance!

Hi @WadeYin9712 

That list is only used for internal purposes. You can use all the xglm checkpoints available on the hub https://huggingface.co/models?other=xglm.

To use it, just pass the repo id to `from_pretrained`. For ex

```python3
model = XGLMForCausalLM.from_pretrained("facebook/xglm-1.7B")
```
Misfiring tf warnings
Author: Rocketknight1
Pull request: yes

One last misfiring TF warning switched to `tf.print`.

Comments:
_The documentation is not available anymore as the PR was closed or merged._

I think this is the last misfiring warning (this one is usually triggered in Seq2Seq models). I'm a little worried that there's some use-case where this will actually cause console spam instead, but I think it's safe.

Aaa, wait! In some examples this is actually much worse. I believe the warning isn't even correct/necessary anymore, though - I'm doing some testing to see if it even makes sense with modern TF.

After testing, I don't think this warning even makes sense anymore - I had no problems changing the values of these arguments at call-time instead of model initialization. I presume this dates from a time when TensorFlow had much more trouble with function retracing. I removed the warning entirely.
ImportError: cannot import name 'ImageGPTFeatureExtractor' from 'transformers' (unknown location)
Author: loukasilias
Pull request: no

Hi all,

I am running the script in kaggle and face the error mentioned below:

```
----> 1 from transformers import ImageGPTFeatureExtractor, ImageGPTModel

ImportError: cannot import name 'ImageGPTFeatureExtractor' from 'transformers' (unknown location)

```
How could I fix this error?
Thank you!

Comments:
Hi,

What's the version of Transformers you have?

Hi,
4.5.1.
Do I need to upgrade ?

ImageGPT was released in v4.13 I believe

Yes, you are right.
Thank you very much!
Update modeling_wav2vec2.py
Author: peregilk
Pull request: yes

@patrickvonplaten 

With very tiny sound files (less than 0.1 seconds) the num_masked_span can be too long. The issue is described in issue 15366 and discussed with @patrickvonplaten. This can be an issue with custom datasets that contains sentences with small words like "OK", "Yes" etc.



Comments:
_The documentation is not available anymore as the PR was closed or merged._
Notify user if group_by_length won't be used
Author: stefan-falk
Pull request: no

@sgugger @stas00 (as suggested in [15196](https://github.com/huggingface/transformers/issues/15196#issuecomment-1024143208))

It is just a minor issue but it could prevent some head-scratching:

Setting `group_by_length` to `True` during training has, as far as I can see, no effect if the provided dataset is a `torch.utils.data.IterableDataset`, as can be seen in this line:

https://github.com/huggingface/transformers/blob/c4d1fd77fa52d72b66207c6002d3ec13cc36dca8/src/transformers/trainer.py#L646

Entering this branch will run the training without bucketing / grouping. 

Imo it would be best to raise an exception or, at the very least, print a warning message for the user. Grouping only happens in [`_get_train_sampler()`](https://github.com/huggingface/transformers/blob/c4d1fd77fa52d72b66207c6002d3ec13cc36dca8/src/transformers/trainer.py#L566:L628) which [is never reached](https://github.com/huggingface/transformers/blob/c4d1fd77fa52d72b66207c6002d3ec13cc36dca8/src/transformers/trainer.py#L646:L664) if said condition is true.



Comments:
Yes, that's a great idea! Will add something for that today.
Error when group_by_length is used with an IterableDataset
Author: sgugger
Pull request: yes

# What does this PR do?

Since `group_by_length` is not supported for `IterableDataset`s, we should raise an error at the trainer init when we detect that arg is set and the training set is an `IterableDataset`.

Fixes #15418

Comments:
_The documentation is not available anymore as the PR was closed or merged._
skip large generations pipeline test for XGLM
Author: patil-suraj
Pull request: yes

# What does this PR do?

Skip large generations pipeline test for XGLM since it uses sinusoidal positional embeddings which are resized on the fly.

Comments:
_The documentation is not available anymore as the PR was closed or merged._

Can we just add some TODO to fix better later in the comment in that case?

Merging to get the CI green.
Can't push a model to hub
Author: AigizK
Pull request: no

## Environment info
- `transformers` version: 4.16.1
- Platform: Linux-5.4.0-96-generic-x86_64-with-glibc2.29
- Python version: 3.8.10
- PyTorch version (GPU?): 1.10.0+cu113 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: <fill in>
- Using distributed or parallel set-up in script?: <fill in>

### Who can help
@patrickvonplaten, @anton-l

## Information

Model I am using: facebook/wav2vec2-xls-r-300m

The problem arises when using:
* [ ] my own modified scripts: (give details below)

The tasks I am working on is:
* [ ] an official GLUE/SQUaD task: speech-recognition-community-v2

## To reproduce

Steps to reproduce the behavior:

1. I use a modified jupiter notebook from this site: https://huggingface.co/blog/fine-tune-wav2vec2-english
2. Firstly a train was running with TrainingArguments(push_to_hub=True). It  worked, you can see results  here: https://huggingface.co/AigizK/wav2vec2-large-xls-r-300m-bashkir-cv7_opt/commits/main until the commit "Training in progress, step 94900"
3. Then my notebook has crashed
4. I ran all cells until trainer.train()
5. sent the current state to the repository without thinking(commits 293563110d31ba9610e4ad7bffd8b377beaf4cf5 and 3f6e999d7d2fdb4640fd1523bfca744681fcc2fc)
6. Then I run train from last checkpoint
7. When try to send result to hub but get error
8. 
![train-push-to-hub-bug](https://user-images.githubusercontent.com/1628540/151814762-4fb4eecb-1def-4ed8-9c49-cd1c2287f054.png)
9. I can resolve this issue only using this command
- repo = Repository(local_dir="xls-r-300m-ba_v2", clone_from="AigizK/wav2vec2-large-xls-r-300m-bashkir-cv7_opt")
- copy last model.bin to this folder
- repo.push_to_hub(commit_message="50 epochs")


When I asked in  the Discord from @patrickvonplaten  how i can resolve he wrote:
`Could you open an issue on Transformers for this? This looks like a library mismatch between transformers and huggingface_hub`
https://discord.com/channels/879548962464493619/930507803339137024/937665851878952990


Comments:
Gently pinging @sgugger here. Any idea what could be the problem here? I cannot really reproduce this error

Are you sure that in your second run you still had `push_to_hub=True` in your `TrainingArguments`? Because the `repo` arg not defined can only come from there I think.

@sgugger From Step3 i used only `push_to_hub=False`

So that's why you get an error. We will make it clearer, but you can't use `Trainer.push_to_hub` if `push_to_hub=False`.

Thank you. I thought that `push_to_hub` only affects during training.
[M2M100, XGLM] fix positional emb resize
Author: patil-suraj
Pull request: yes

# What does this PR do?

The sinusoidal position embeddings in M2M100 and XGLM are not correctly resized as the `max_pos` is computed in-correctly. Take into account the `past_key_values_length` when computing `max_pos`.

Comments:
_The documentation is not available anymore as the PR was closed or merged._

Looks good to me - a bit surprising to me that no one saw this earlier
Masking in T5Attention
Author: Arij-Aladel
Pull request: no

@patil-suraj    @patrickvonplaten    Hello! I was wondering why have you added mask in T5Attention to position_bias????? look at 
https://github.com/huggingface/transformers/blob/db7d6a80e82d66127b2a44b6e3382969fdc8b207/src/transformers/models/t5/modeling_t5.py#L510

Comments:
Hey, 

I think simply corresponds to how it is done in the original implementation. It essentially means that we don't add any **positional** information for tokens that are masked.

ok understand thanks!
How to update config after model inited?
Author: qishibo
Pull request: no

Hello everyone, I want to **change** the config [such as `dropout probability`] after bert inited, what should I do in transformers?

```python
# fixed seed
random.seed(args.seed)
torch.manual_seed(args.seed)
cudnn.deterministic = True

# init bert
config = AutoConfig.from_pretrained(model_name, hidden_dropout_prob=0.2, attention_probs_dropout_prob=0.2)
bert = BertModel.from_pretrained(model_name, config=config)

# then I want to change dropout_prob to 0 to run some other logits, but it seems invalid
bert.config.hidden_dropout_prob = 0
bert.config.attention_probs_dropout_prob = 0

# because out1 doesn't equals to out2 when I print them, but they should be the same when the dropout prob is 0
out1 = bert(**embeddings)
out2 = bert(**embeddings)
# out1 != out2
```

Comments:
Hi,

To turn off dropout, you should put your model in evaluation mode: `model.eval()`. 

 > To turn off dropout, you should put your model in evaluation mode: `model.eval()`.

thanks for reply, due to certain needs, what I want is to change `drop prob` during training. Can this be achieved?


This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md) are likely to be ignored.
ConvBertForQuestionAnswering hangs on 8x TPU cores using PyTorch / XLA
Author: hlynurd
Pull request: no

## Environment info
Python 3.7.3
torch==1.9.1
torch-xla @ https://storage.googleapis.com/tpu-pytorch/wheels/torch_xla-1.9-cp37-cp37m-linux_x86_64.whl
transformers==4.12.3


Models:

- ConvBERT @LysandreJik

## Information

Hi all, 

I would like to use ConvBertForQuestionAnswering on 8x tpu cores using pytorch/xla. It works for me on a single core, and changing the ConvBert model creation to Electra or Roberta works fine on both 1x and 8x cores.

```
import torch_xla.distributed.xla_multiprocessing as xmp
...
xmp.spawn(_mp_fn, args=(FLAGS,), nprocs=8, start_method='fork')
```

This hangs for me when nprocs=8 but not when nprocs=1. It stops at a forward pass of the model

`
self.backbone = ConvBertForQuestionAnswering.from_pretrained(model_path, config=config)
outputs = self.backbone.convbert(input_ids, attention_mask, token_type_ids)
`



Comments:
Hello! Could you show the script that you're using? Have you tried using `accelerate` or the `Trainer`, and does it fix any issue? Thank you, cc @sgugger 

Here's my script: https://gist.github.com/hlynurd/d9b43edbb1b318e666ff875258130bb5 I get the same problem if I adapt it for `accelerate`

And is the problem specific to ConvBert or do you have the same issue for all other models?

I only get the problem for ConvBert and only on 8 TPU cores. I have tried Electra and RoBERTa and both work well for 1 and 8 cores.

Sounds like a specific problem in convBERT then. Not sure anyone on the team will have time to investigate in depth in the coming weeks however, but if you manage to find the cause, please let us now.

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md) are likely to be ignored.

This issue persists for me.

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md) are likely to be ignored.

This issue persists for me.

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md) are likely to be ignored.
replace assert with exception for padding_side arg in `PreTrainedTokenizerBase` `__init__`
Author: SaulLu
Pull request: yes

# What does this PR do?

This PR propose to replace an assert inside `PreTrainedTokenizerBase`'s `__init__` method with a ValueError exception. I took also this opportunity to test this behavior as it wasn't tested in the existing test.

## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss 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 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).
- [x] 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. Would love to have your review @LysandreJik and @sgugger 

<!-- Your PR will be replied to more quickly if you can figure out the right person to tag with @

 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.

Models:

- albert, bert, xlm: @LysandreJik
- blenderbot, bart, marian, pegasus, encoderdecoder,  t5: @patrickvonplaten, @patil-suraj
- longformer, reformer, transfoxl, xlnet: @patrickvonplaten
- fsmt: @stas00
- funnel: @sgugger
- gpt2: @patrickvonplaten, @LysandreJik
- rag: @patrickvonplaten, @lhoestq
- tensorflow: @LysandreJik

Library:

- benchmarks: @patrickvonplaten
- deepspeed: @stas00
- ray/raytune: @richardliaw, @amogkam
- text generation: @patrickvonplaten
- tokenizers: @n1t0, @LysandreJik
- trainer: @sgugger
- pipelines: @LysandreJik

Documentation: @sgugger

HF projects:

- datasets: [different repo](https://github.com/huggingface/datasets)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Examples:

- maintained examples (not research project or legacy): @sgugger, @patil-suraj
- research_projects/bert-loses-patience: @JetRunner
- research_projects/distillation: @VictorSanh

 -->


Comments:
_The documentation is not available anymore as the PR was closed or merged._

> I think this is included in the other PR I just reviewed no?

@sgugger, indeed part of this PR was in the PR you just reviewed but I misunderstood narsil comment so I'll removed it from the other PR and merge this PR first. TL;DR, now the other PR is only about truncation and this one only about padding. :slightly_smiling_face:
[BartTokenizer] remove inheritance on RobertaTokenizer
Author: patil-suraj
Pull request: yes

# What does this PR do?

Continue making tokenizers independent. This PR refactors the `BartTokenizer` to remove dependency on `RobertaTokenizer`

Comments:
_The documentation is not available anymore as the PR was closed or merged._

Thanks for tackling this! Should we maybe also add some `# Copied from ...` statements here to make the code more robust to changes?
`Trainer.push_to_hub` always tries to push to the Hub
Author: sgugger
Pull request: yes

# What does this PR do?

As pointed out in #15431, when a user tries to call `Trainer.push_to_hub` with the corresponding training argument set to `False`, the call fails. However, the intent of the user calling that method is clear, so we should try to honor it.

This PR makes the call succeed, as long as it's possible to create the repo from the output dir (which will fail if the repo in which the user wants to push to the Hub already exists and output dir is not a local clone).

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Issue with long contexts or AutoTokenizer.. Unsure which one is it is more of
Author: vikramtharakan
Pull request: no

Having an issue where I used a QA model from transformers, tweaked the model in label studio making some annotations and then tried to load the model back again. The model is pulling out the correct answers but seemingly `handle_impossible_answers` isn't working because it gives an answer for every questions even when the question is irrelevant.. What's even weirder is that it doesn't do this in label studio's interface so seemingly this handle_impossible_answers is working on that side. My contexts I pass through the pipeline are also quite long

Made sure I have the most up to date transformers model, and the models were saved out with save_pretrained. 
```
# Inside some function code

model_to_save = model.module if hasattr(model, "module") else model  # Take care of distributed/parallel training  # noqa
# If we save using the predefined names, we can load using `from_pretrained`
model_to_save.save_pretrained(workdir)
self.tokenizer.save_pretrained(workdir)
```

And I end up seeing all the relevant files in a local dir as follows:
```
# In the model directory

job_result.json    special_tokens_map.json  tokenizer.json        train_data.json
config.json     pytorch_model.bin  tokenizer_config.json    train_data_info.json  vocab.txt
```

I then try and load that model using the exact same transformers model/tokenizer in the way I did before, except swapping it out for the local files. (Also read some bug about local path vs absolute paths when loading models and that made no difference either way for me)

```
model_path = "/some/path/to/model_dir/"
model = AutoModelForQuestionAnswering.from_pretrained(model_path)
tokenizer = AutoTokenizer.from_pretrained(model_path) 
QA = pipeline('question-answering', model=model, tokenizer=tokenizer)

# Other code...
#....

answers = QA(question=questions, context=context, top_k=1, max_answer_len=32, handle_impossible_answer=True)
```

The answers that I get out of here have an answer for every question, even when it doesn't need to be answered. I've tried loading the models multiple ways - the only way I got handle_impossible_answers to work as intended is if the tokenizer wasn't the AutoTokenizer that I had used here (swapped it out for Bert). But then the answers it gave me were complete garbage which was kind of expected. Anybody else run into this issue with AutoTokenizer??

If the context is short (most of the contexts I hit it with are fairly long) then it actually does do a good job of only pulling out the valid answers. So I'm not sure if this is a long context issue, a problem with AutoTokenizer, or even a problem with transformers.pipeline

Comments:
Update fine-tune docs
Author: stevhliu
Pull request: yes
Labels: name: Documentation

This is a first draft of the updated fine-tune tutorial. Main updates include:

- Preprocess a different dataset (users are probably very used to seeing `imdb` now) to include more diverse examples so users don't feel like they are doing the same thing over and over.
- Update the `Trainer` example to include evaluating accuracy before you fine-tune. It seems like a good practice to include evaluating metrics during training, so we should present it first. Let me know if this is not common or generally applicable, and we can revert it!
- Update Keras example to use `to_tf_dataset` to convert a dataset to a TensorFlow format (cc @Rocketknight1 please feel free to let me know if I'm missing anything!)

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Update tutorial docs
Author: stevhliu
Pull request: yes
Labels: name: Documentation

This is a first draft of tutorial docs for the `pipeline`, `AutoClasses`, and how to preprocess data. Main updates include:

- How to use the `pipeline` for image and vision tasks.
- Highlight the `AutoFeatureExtractor` and `AutoProcessor` for image, vision and multimodal tasks.
- Add tutorials for how to preprocess audio, vision, and multimodal data. I'd also really appreciate it if @patrickvonplaten or @anton-l could take a look at the audio tutorial, and if @NielsRogge could take a look at the vision and multimodal tutorials (thank you so much for your notebooks! ❤️ ).

Once we have a concept guide section, I think we should move this [section](https://huggingface.co/docs/transformers/master/en/preprocessing#everything-you-always-wanted-to-know-about-padding-and-truncation) about padding/truncation there as well as the summary pages about the tasks and models.

The preprocess document is also quite long now, so please let me know if you'd like me to create a separate page for each modality. I think this would make it easier for users to read and find what they're looking for.

Comments:
Thanks for the feedback y'all! I've also made a few additional changes:

- Rewrite multimodal tutorial with a different dataset (LJ Speech) because we can't use TIMIT.
- Add output image for preprocessed image so users can see what it looks like.

Let me know if there is anything else you'd like to see, otherwise I think we are ready to merge!