noamaanMulla-03/transformers-issues huggingface dataset:
Adding Megatron models.
Author: Narsil
Pull request: no
Labels: name: New model

# 🌟 New model addition

Is it feasible to add  Megatron models ? It seems the architecture is really just a GPT2, most of the work should be in creating the config, fusing layers from the available weights here: https://github.com/pytorch/fairseq/tree/master/examples/megatron_11b and making them available.

There are Nvidia's megatron (Bert and Gpt variants) and Facebook-11b megatron  (gpt variant)

If we stick to that then we can't run the model on a single GPU, so we should probably make sure this is compatible with: 

- https://github.com/huggingface/transformers/pull/9208
- https://github.com/huggingface/transformers/pull/9211

**Is keeping the current GPT2 architecture and using deepspeed's ZeRo and other parallelism schemes without touching original implementation feasible?**


## Model description

https://github.com/pytorch/fairseq/blob/e3c4282551e819853952284681e9ed60398c5c4a/examples/megatron_11b/README.md

<!-- Important information -->

## Open source status

* [x] the model implementation is available: https://github.com/ngoyal2707/Megatron-LM/blob/adb23324c222aad0aad89308e70302d996a5eaeb/mpu/transformer.py (Most of the work seems to be on Matrix parallelization)
* [x] the model weights are available: https://dl.fbaipublicfiles.com/fairseq/models/model_parallel/megatron_11b.tar.gz (Megatron 11b), https://github.com/NVIDIA/Megatron-LM#downloading-checkpoints (Nvidia's version, 3b and 8.3b don't seem to be available)
* [x] who are the authors: (mention them, if possible by @gh-username) Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper, Bryan Catanzaro https://arxiv.org/abs/1909.08053

https://developer.nvidia.com/blog/language-modeling-using-megatron-a100-gpu/

@stas00 @patrickvonplaten 


Comments:
Since DeepSpeed both integrates and uses Megatron-LM almost everywhere in its tutorials it most likely should just work. Of course, the devil is in the detail.

As I haven't had a chance to study/work with GPT2 yet, I will let others comment on the more important part of your query.

Any plans of adding MegatronT5? (https://github.com/NVIDIA/Megatron-LM/blob/main/megatron/model/t5_model.py)

As this is a really old thread, perhaps make a request in a new Issue, @jordiae?

And of course, if you're interested you're more than welcome to try and add it yourself. This is of course only an invitation.

> As this is a really old thread, perhaps make a request in a new Issue, @jordiae?
> 
> And of course, if you're interested you're more than welcome to try and add it yourself. This is of course only an invitation.

Got it! Posted here because the issue was open. Thanks.

Will close this issue as it's really kind of outdated.
Translation/training: italian translation training.mdx
Author: nickprock
Pull request: yes

# What does this PR do?

* added translation.mdx
* updated _toctree.yml

See issue: [#17459](https://github.com/huggingface/transformers/issues/17459)

## Before submitting
- [X] 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/main/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [X] 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.
- [X] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).


## Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@omarespejel @sgugger 

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

Hi @nickprock , I found these typos could you edit the file? Thanks!
- "benifici" --> "benefici"
- "stratergia" --> "strategia"
- "Addestranento" --> "Addestramento"
- "Le [Trainer] API supporta" --> "L'API [Trainer] supporta"
-  Here: "tutti gli iperparametri che puoi impostare" It doesn't seem so clear, I would maybe put it this way:  "tutti gli iperparametri che si possono calibrare". What do you think?
- "nonchè" --> "nonché"
- "funzione [accuratezza](https://huggingface.co/metrics/accuracy)" maybe I would keep the function names in English (i.e., with the original name)
- "maggiorni informazioni" --> "maggiori informazioni"
- "le Keras API" --> "l'API di Keras"
- "Sii sicuro" --> "Assicurati" (for gender neutrality)
- "sepecificare" --> "specificare"
- "Compila e fit" --> "Compilazione e adattamento"
- "Per gli utenti che preferiscono scrivere il loro personale ciclo di addestramento" --> "Per chi preferisse scrivere un proprio ciclo di addestramento personale"
- "pò di memoria" --> "po' di memoria"
- "perchè" --> "perché"
- "adesso sei pronto per addestrare!" --> "adesso possiamo addestrare!"  (for gender neutrality)

Thanks for the review @mfumanelli :pray:, I fixed them. 

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/main/CONTRIBUTING.md) are likely to be ignored.

I fixed and I'm waiting the review

cc @omarespejel
FSDP integration enhancements and fixes
Author: pacman100
Pull request: yes

# What does this PR do?

1. Fixes #17681 and https://github.com/pytorch/pytorch/issues/79605
2. integrates new features of FSDP to auto wrap transformer blocks and support for mixed precision

## 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/main/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/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


Comments:
_The documentation is not available anymore as the PR was closed or merged._
Update docs README with instructions on locally previewing docs
Author: snehankekre
Pull request: yes

# What does this PR do?
This small PR updates the README in `/docs/` with instructions on how to use `doc-builder` to locally preview the documentation before submitting a PR. The current docs say previewing is not possible. However, the `doc-builder` [repo](https://github.com/huggingface/doc-builder#previewing) contains previewing instructions.

## Before submitting
- [x] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [ ] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/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/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/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 who may be interested in your PR.

Documentation: @sgugger @stevhliu 

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

Thanks again for your contribution!
[From pretrained] Allow download from subfolder inside model repo
Author: patrickvonplaten
Pull request: yes

# What does this PR do?

<!--
Congratulations! You've made it this far! You're not quite done yet though.

Once merged, your PR is going to appear in the release notes with the title you set, so make sure it's a great title that fully reflects the extent of your awesome contribution.

Then, please replace this with a description of the change and which issue is fixed (if applicable). Please also include relevant motivation and context. List any dependencies (if any) that are required for this change.

Once you're done, someone will review your PR shortly (see the section "Who can review?" below to tag some potential reviewers). They may suggest changes to make the code even better. If no one reviewed your PR after a week has passed, don't hesitate to post a new comment @-mentioning the same persons---sometimes notifications get lost.
-->

<!-- Remove if not applicable -->

Currently it is not possible for `transformers` to download a model that is located inside a subfolder of a repo.
E.g. for diffusion pipelines, a transformer model is often only one part of a pipeline of models so it makes a lot of sense to save checkpoints inside folders of model repos, see: https://huggingface.co/fusing/latent-diffusion-text2im-large/tree/main/bert

Similarly for Dalle-mini where one would have a Bart and a VQ-VAE model inside the same repo.

The PR would allow the user to do the following (which fails on master currently):

```py
from transformers import BertModel
BertModel.from_pretrained("fusing/latent-diffusion-text2im-large", revision="d5eab56", subfolder="bert")
```

**🚨🚨 IMPORTANT 🚨🚨**:

This PR adds subfolder loading and saving functionality for both sharded and non-sharded PyTorch checkpoints. It should also work when loading a model with `from_tf=True` or `from_flax=True` - however this is currently not tested. I would be great if such tests could be added in a follow-up PR.

Also cc @julien-c FYI

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Use next-gen CircleCI convenience images
Author: ydshieh
Pull request: yes

# What does this PR do?

Use next-gen CircleCI convenience images.

From [CircleCI page](https://circleci.com/docs/circleci-images?utm_source=google&utm_medium=sem&utm_campaign=sem-google-dg--emea-en-dsa-maxConv-auth-brand&utm_term=g_-_c__dsa_&utm_content=&gclid=CjwKCAjwrNmWBhA4EiwAHbjEQJ4yXbmT654kFoIgTkjKea44E56-j7BGvVrqOkVAwCq97F_Je6EsohoC0OkQAvD_BwE):

*Legacy images with the prefix “circleci/” were deprecated on December 31, 2021. For faster builds, upgrade your projects with next-generation convenience images.*

It mentions [the following](https://circleci.com/docs/circleci-images?utm_source=google&utm_medium=sem&utm_campaign=sem-google-dg--emea-en-dsa-maxConv-auth-brand&utm_term=g_-_c__dsa_&utm_content=&gclid=CjwKCAjwrNmWBhA4EiwAHbjEQJ4yXbmT654kFoIgTkjKea44E56-j7BGvVrqOkVAwCq97F_Je6EsohoC0OkQAvD_BwE#next-generation-convenience-images): 
- Faster spin-up time (but I didn't measure the spin-up time)
- Improved reliability and stability 


There are some tiny things I observed: for example, running new images on GCP VM, I can use arrow up to get to the previous commands.

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

Can you just explain why this change is needed? What's better about them?

> Can you just explain why this change is needed? What's better about them?

Sorry, I forgot to mention them in the description. I updated it. My main motivation is to avoid the deprecated (on December 31, 2021) images).
TF: Add missing cast to GPT-J
Author: gante
Pull request: yes

# What does this PR do?

Adds a missing cast, which was breaking the tests for mixed precision (which, for some weird cause, was also causing subsequent tests to fail 🤔 ) 

All slow tests pass after this change.

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

Ah, that explains why following tests fail! Changing it 👍
Reduce console spam when using the KerasMetricCallback
Author: Rocketknight1
Pull request: yes

Right now, `KerasMetricCallback` calls `model.predict()` while iterating over the input dataset. This results in some unwanted console spam when using metrics that do not call `generate()` (because `predict()` always creates a progress bar). Replacing it with `predict_on_batch` removes the spam and also improves performance of the callback.

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Remove use_auth_token from the from_config method
Author: duongna21
Pull request: yes

# What does this PR do?

Fixes `TypeError: __init__() got an unexpected keyword argument 'use_auth_token'` in `run_mlm_flax.py`, `run_clm_flax.py`, `run_t5_mlm_flax.py`, `run_summarization_flax.py`, `run_image_classification.py` by removing the `use_auth_token` argument from the `from_config` method.

![imgur](https://i.imgur.com/SVtQTWY.png)

## Who can review?

cc potential reviewers: @patrickvonplaten, @sgugger, @patil-suraj



Comments:
_The documentation is not available anymore as the PR was closed or merged._
Argument inconsistency between processor and tokenizer
Author: qqaatw
Pull request: no
Labels: name: bug

### System Info

transformers on master

### Who can help?

@sgugger who modified the line lastly from git blame

### Information

- [ ] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

In `processing_utils.py`, to use the slow version, one needs to specify `use_fast=False` in `from_pretrained`,

https://github.com/huggingface/transformers/blob/d0acc9537829e7d067edbb791473bbceb2ecf056/src/transformers/processing_utils.py#L222-L226

while in `tokenization_utils_base.py`, to use the slow version, one needs to specify `from_slow=True` in `from_pretrained`

https://github.com/huggingface/transformers/blob/d0acc9537829e7d067edbb791473bbceb2ecf056/src/transformers/tokenization_utils_base.py#L1804-L1815

This inconsistency leads to strange usages. 

For example, when we want to use the slow version of LayoutLMv2 processor, we have to pass both arguments simultaneously:

```python
processor = LayoutLMv2Processor.from_pretrained("microsoft/layoutlmv2-base-uncased", use_fast=False, from_slow=True)
```



### Expected behavior

I suggest we change the option in  `processing_utils.py` from `use_fast` to `from_slow`.

Comments:
No `from_slow` is an internal argument that determines whether the tokenizer should be loaded from slow tokenizer files or a fast tokenizer file. That is why you're not finding it in the documentation for instance.

@sgugger  Oh thanks. I confused the purpose of `from_slow`. Now it looks that I can only use `use_fast=False` to get the slow version.
Is the addition of the 'OPTforSequenceClassification' class scheduled?
Author: penpaperkeycode
Pull request: no
Labels: name: Good First Issue

### Feature request

Is the addition of the 'OPTforSequenceClassification' class scheduled? 
Is someone handling it? 
When adding these functions, I wonder if it is possible to PR one by one, or if I have to PR all classes supported by other models.

### Motivation

Added function of OPT class, which is being actively discussed recently

### Your contribution

I personally use the forSequenceClassification class because I need it for my experiments, but I would like to inquire if I can contribute to the addition of the function.

Comments:
Don't think anyone is working on this yet (cc @younesbelkada), so feel free to contribute

Hey! We are not working on that as Niels mentioned 😉 
Opening a PR for each framework (`pytorch`, `tensorflow` and `flax`) is recommended. If you have any question about adding these models, feel free to reach out! 

@ArthurZucker  , @NielsRogge  I do not see anyone working on this so far.  I want to start contributing to huggingface with this good first issue. Can I go ahead and open a WIP PR for this issue ? 

Hi, yes you can definitely go ahead and we'll be happy to review it ! ;)
Please also double check with @penpaperkeycode if it is not already a WIP on their side 

@penpaperkeycode  as @younesbelkada  mentioned , can you please let me know if you are already working on the issue ? 

@VijayKalmath Sorry for late reply.
I tested OPT's 'forSequenceClassification' class and verified accuracy in MNLI-glue task. 
it looks good to me. But since this is my first huggingface PR, I need to figure out how to do it.

In addition, I am working on a conditional generation class, but there is no other work other than these two classes.


@younesbelkada @ArthurZucker I am new to the hugging face community and am looking to contribute, I looked through the first issue list but all issues seem to have pre existing contributors assigned, can I help with this one or is there another first issue I can dive into and help out with.  Thanks

Hey, it seems that this was already taken car of, see #18123, but thanks a lot for wanting to contribute! I am going to look for an issue that might be interesting for you :) 
BTW, you can also check the closed issues as some are close because of a lack of activity. I assigned myself to #17514 but have not had the time to really look into it! Feel free to fork `transformers` and create a branch for the fix !
Change to FlavaProcessor in PROCESSOR_MAPPING_NAMES
Author: ydshieh
Pull request: yes

# What does this PR do?

`FLAVAProcessor` in `PROCESSOR_MAPPING_NAMES` should be `FlavaProcessor`.

Not getting problem when using `AutoProcessor.from_pretrained`, but `PROCESSOR_MAPPING[FlavaConfig]` will fail

### Errors

```python
from transformers import PROCESSOR_MAPPING, FlavaConfig, CLIPConfig, LayoutLMv2Config

processor_types = PROCESSOR_MAPPING[CLIPConfig]
print(processor_types)

processor_types = PROCESSOR_MAPPING[LayoutLMv2Config]
print(processor_types)

# This fails
processor_types = PROCESSOR_MAPPING[FlavaConfig]
print(processor_types)
```

with errors

```bash
Traceback (most recent call last):
  File "C:\Users\33611\Desktop\Project\transformers\temp.py", line 9, in <module>
    processor_types = PROCESSOR_MAPPING[FlavaConfig]
  File "C:\Users\33611\Desktop\Project\transformers\src\transformers\models\auto\auto_factory.py", line 565, in __getitem__
    return self._load_attr_from_module(model_type, model_name)
  File "C:\Users\33611\Desktop\Project\transformers\src\transformers\models\auto\auto_factory.py", line 579, in _load_attr_from_module
    return getattribute_from_module(self._modules[module_name], attr)
  File "C:\Users\33611\Desktop\Project\transformers\src\transformers\models\auto\auto_factory.py", line 539, in getattribute_from_module
    return getattribute_from_module(transformers_module, attr)
  File "C:\Users\33611\Desktop\Project\transformers\src\transformers\models\auto\auto_factory.py", line 539, in getattribute_from_module
    return getattribute_from_module(transformers_module, attr)
  File "C:\Users\33611\Desktop\Project\transformers\src\transformers\models\auto\auto_factory.py", line 539, in getattribute_from_module
    return getattribute_from_module(transformers_module, attr)
  [Previous line repeated 986 more times]
  File "C:\Users\33611\Desktop\Project\transformers\src\transformers\models\auto\auto_factory.py", line 538, in getattribute_from_module
    transformers_module = importlib.import_module("transformers")
  File "C:\Users\33611\miniconda3\envs\py39\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load
  File "<frozen importlib._bootstrap>", line 157, in __enter__
  File "<frozen importlib._bootstrap>", line 183, in _get_module_lock
  File "<frozen importlib._bootstrap>", line 59, in __init__
RecursionError: maximum recursion depth exceeded while calling a Python object

Process finished with exit code 1

```

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

Test error is unrelated - merge now

```
error: failed to fetch some objects from 'https://user:hf_94wBhPGp6KrrTH3KDchhKpRxZwd6dmHWLL@hub-ci.huggingface.co/__DUMMY_TRANSFORMERS_USER__/test-trainer-step.git/info/lfs
```
[WIP] DETR TF implementation
Author: amyeroberts
Pull request: yes
Labels: name: New model

name: WIP

# What does this PR do?

Add TF implementation of DETR model

Dependent on the TF implementation of ResNets being merged in to provide a backbone: https://github.com/huggingface/transformers/pull/17427


## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [ ] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/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/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/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 who may be interested in your PR.

<!-- 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.

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_17739). All of your documentation changes will be reflected on that endpoint.
Skip test_multi_gpu_data_parallel_forward for BEiT and Data2VecVision
Author: ydshieh
Pull request: yes

# What does this PR do?

Similar to #17890 and #17864, BEiT and `Data2VecVision` use `add_module` and cause problem for this test.

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