noamaanMulla-03/transformers-issues huggingface dataset:
Can't set attribute 'device'
Author: cuongnm71
Pull request: no
Labels: name: wontfix

I'm BERT finetunning, came across this problem
Here is my config, i'm running on 3rd GPU:
```json
BertConfig {
  "attention_probs_dropout_prob": 0.1,
  "device": "cuda:3",
  "directionality": "bidi",
  "hidden_act": "gelu",
  "hidden_dropout_prob": 0.1,
  "hidden_size": 768,
  "initializer_range": 0.02,
  "intermediate_size": 3072,
  "layer_norm_eps": 1e-12,
  "max_position_embeddings": 512,
  "model_type": "bert",
  "num_attention_heads": 12,
  "num_hidden_layers": 12,
  "output_hidden_states": true,
  "output_past": true,
  "pad_token_id": 0,
  "pooler_fc_size": 768,
  "pooler_num_attention_heads": 12,
  "pooler_num_fc_layers": 3,
  "pooler_size_per_head": 128,
  "pooler_type": "first_token_transform",
  "type_vocab_size": 2,
  "use_pooler": true,
  "vocab_size": 105879,
  "weight_class": [
    1,
    1
  ]
}
```
and here is the output error in terminal:
```
Traceback (most recent call last):
  File "main.py", line 50, in <module>
    model = BERTQa.from_pretrained(args.folder_model, config=config)
  File "/home/dle/anaconda3/envs/phobert/lib/python3.7/site-packages/transformers/modeling_utils.py", line 622, in from_pretrained
    model = cls(config, *model_args, **model_kwargs)
  File "/dstore/home/dle/phobert/QA_PhoBERT/ZaloBert.py", line 10, in __init__
    self.device = 'cuda:3'
  File "/home/dle/anaconda3/envs/phobert/lib/python3.7/site-packages/torch/nn/modules/module.py", line 638, in __setattr__
    object.__setattr__(self, name, value)
AttributeError: can't set attribute
```


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.


I met the same issue, have you fixed?  Thanks.
Problems when producing distilBERT
Author: SSFWL496
Pull request: no
Labels: name: bug

### System Info

```shell
Hello！I am training a distilBert from scratch following scripts under examples/distillation.
```


### Who can help?

_No response_

### Information

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

### Tasks

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

### Reproduction

And got error when running the scripts below：
```
python scripts/token_counts.py \
    --data_file data/binarized_text.bert-base-uncased.pickle \
    --token_counts_dump data/token_counts.bert-base-uncased.pickle \
    --vocab_size 30522
```

### Expected behavior

```shell
The error I got is:

Traceback (most recent call last):
  File "scripts/token_counts.py", line 44, in <module>
    data = pickle.load(fp)
EOFError: Ran out of input
```

Could you help me resolve this?
```


Comments:
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.
AutoTokenizer fails to do_lower_case
Author: pratyushmaini
Pull request: no

If we use the AutoTokenizer library, this still does not work. 

```
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("roberta-base", do_lower_case=True)
tokenizer.do_lower_case = True
print(tokenizer.tokenize("Huggingface"))
```

_Originally posted by @pratyushmaini in https://github.com/huggingface/transformers/issues/9122#issuecomment-1152939838_

Comments:
>>> print(tokenizer.tokenize("Huggingface"))
['Hug', 'ging', 'face']

Hey @pratyushmaini 👋  Following our bug submission template yields better outcomes -- we have many issues and requests coming in, and we need the help of the community to maximize our usefulness :) One of the fields of the template is `Who can help?`, where you can find the right person to tag on your issue.

https://github.com/huggingface/transformers/blob/main/.github/ISSUE_TEMPLATE/bug-report.yml

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.
Add custom config to quicktour
Author: stevhliu
Pull request: yes
Labels: name: Documentation

This PR updates the quicktour to include a section for building custom configurations that creates a randomly initialized model. Other changes include:

- Added a brief section for `Trainer`.
- Switched back to the code switcher (instead of code blocks) for some code examples which showed essentially the same thing and didn't have drastically different text associated with them. I think this will reduce the amount of scrolling and improve user experience.
- Minor maintenance work to improve conciseness.

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

Oops, sorry about all the changes! How about we keep the custom config section here and rollback all the other changes, which we can discuss in a separate issue?

Yes please!
Add support for Sagemaker Model Parallel >= 1.10 new checkpoint API
Author: viclzhu
Pull request: yes

# What does this PR do?
This PR adds support for Sagemaker Model Parallel >= 1.10's new checkpoint API as well as keeping SMP < 1.10 functionality.

* Support loading checkpoints saved with SMP < 1.10 in SMP < 1.10 and SMP >= 1.10

* Support loading checkpoints saved with SMP >= 1.10 in SMP >= 1.10

## 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?

<!-- 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._

Thanks for iterating on this PR! It looks like a lot of CI failures are fixed on the mian branch. Could you do a quick rebase so we can make sure this PR does not break anything?

It looks like GitHub did not like this rebase as it know shows 290 files changed. Could you open a clean new PR after fixing the merge conflicts?

> It looks like GitHub did not like this rebase as it know shows 290 files changed. Could you open a clean new PR after fixing the merge conflicts?

Yeah, will do!

New clean PR at #18221!
Add support for Sagemaker Model Parallel >= 1.10 new checkpoint API
Author: viclzhu
Pull request: yes

# What does this PR do?
This PR adds support for Sagemaker Model Parallel >= 1.10's new checkpoint API while keeping SMP < 1.10 functionality.

* Support loading checkpoints saved with SMP < 1.10 in SMP < 1.10 and SMP >= 1.10

* Support loading checkpoints saved with SMP >= 1.10 in SMP >= 1.10

## 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?

<!-- 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._
Better messaging and fix for incorrect shape when collating data.
Author: CakeCrusher
Pull request: yes

# What does this PR do?

I ran into an error related to an incorrect shape of inputs when using DataCollatorForSeq2Seq. I learned it had to do with having excessively nested inputs  for my features. The error message was not particularly useful.

This PR adds an assertion checking for incorrectly shaped inputs to be collated. The assertion also provides a solution by suggesting to use `remove_excess_nesting` util.
`remove_excess_nesting` removes excessive nesting from features within a `DatasetDict`.

Fixes #15505


## 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?
- [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.
- [ ] 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?
@stas00 


Comments:
_The documentation is not available anymore as the PR was closed or merged._
Translation/debugging
Author: nickprock
Pull request: yes

# What does this PR do?

* added debugging.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 @mfumanelli 

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Fix TrainingArguments help section
Author: sgugger
Pull request: yes

# What does this PR do?

A typo was introduced in #18134 with a trailing comma that has nothing to do here. It broke the `--help` for all example scripts, as reported in #18222, this PR fixes it and adds a type annotation.

Fixes #18222

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Make errors for loss-less models more user-friendly
Author: sgugger
Pull request: yes

# What does this PR do?

A common mistake beginners encounter is trying to fine-tune with the `Trainer` one of the AutoModel which do not have any head, and can't be fine-tuned directly. This PR makes the Trainer error at init when it received one such model, and also adds a more helpful error message when the outputs of the model don't have a loss.

Comments:
_The documentation is not available anymore as the PR was closed or merged._
NLLB model file for the 600M model
Author: Olubayode
Pull request: no

1. Please where can I locate the  MODEL_FILE i.e  the Path to python file containing the model architecture. I believe the model architecture file will contain only one class definition extended from torch.nn.modules.
2. Please where can I locate  the Handler file that can be use for TorchServe inference logic. 

Please me out with the location to the model_File and handler file 

Comments:
Hi,

The 600 million parameter model can be found here: https://huggingface.co/facebook/nllb-200-distilled-600M.

The weights of the model can be found in the "files and versions" tab (check the "pytorch_model.bin" file): https://huggingface.co/facebook/nllb-200-distilled-600M/tree/main.

Closing this issue as I feel like this has been answered, feel free to reopen.
Italian/model sharing
Author: mfumanelli
Pull request: yes

# What does this PR do?
Italian translation of model_sharing.mdx
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?

@omarespejel 
@sgugger 

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Italian/accelerate
Author: mfumanelli
Pull request: yes

# What does this PR do?

Italian translation of accelerate.mdx
See issue: 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).

@omarespejel 
@sgugger 

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

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.
Update notification service
Author: ydshieh
Pull request: yes

# What does this PR do?

~~**Let me run a dummy test before merge**~~

- Fix failure report blocks (the tables) with too long text (might happen for past CI) - similar to #17630
  - A complete version of (long) tables are saved as artifacts 
- Still send successful report if it is not push CI (we are close to 0 failure now)

A dummy run with very long blocks

https://github.com/huggingface/transformers/runs/7094507618?check_suite_focus=true

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

To make this PR visible again, @LysandreJik .

**More context**: this is mainly for past CI - the summary table(s) could be very long as there are many more test failures.

**Update**: I will  try to save a complete table as an artifacts, so we have it.




PR ready again for review.

Perfect!
[SegFormer] TensorFlow port
Author: sayakpaul
Pull request: yes

This PR adds the SegFormer model in TensorFlow (probably the first Transformer-based segmentation model in TensorFlow for which we have PT weights available). 

## TODOs

- [x] Write the foundation components
- [x] Write the image classification layer
- [x] Write components w.r.t semantic segmentation
- [x] Write the semantic segmentation layer
- [x] Add code examples after `call()` methods where relevant
- [x] Write tests
- [x] Modify other related utilities 
- [x] Create Space to allow users to try out the models (preferably with ONNX to reduce the time?)
- [x] Create a Colab Notebook

The final two points are unrelated to the merging of this PR. 

Cc: @deep-diver

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

Hey @sayakpaul! The code quality error comes from a new release from `black`. Rebasing on `main` should solve the issue as you'll benefit from https://github.com/huggingface/transformers/pull/17918.

@Rocketknight1 @sgugger this PR is now ready for your review. Some things to note:

* This is the first segmentation model on the TF side that has pre-trained segmentation checkpoints available. Hopefully, it serves as a good foundation for devs contributing TF segmentation models in the future. 
* @deep-diver and I will work on creating a Space and Colab notebook (for off-the-shelf inference and fine-tuning) to allow users to take advantage of a state-of-the-art segmentation model like this one in TF via `transformers`.  

~@NielsRogge even though the error in the CI is coming from `run_tests_pipelines_tf` it seems like the PT test is what is originating the error. Do you mind taking a look?~

Yes @Rocketknight1's comments are needed [here](https://github.com/huggingface/transformers/pull/17910#discussion_r910724119) as well. 

Yes, I'm sorry! I went deep on a couple of PRs yesterday and today - one for `datasets`, the other for XLA in `transformers`, and haven't had time to review this properly yet. I'll get to it ASAP, though!

Thanks, @gante. There were no changes except that. Those were reviewed and approved by @Rocketknight1 and @ydshieh.
Fix `no_trainer` CI
Author: muellerzr
Pull request: yes
Labels: name: Tests

name: Examples

name: bug

# What does this PR do?

This PR fixes the no_trainer tests silently failing due to a similar reason in Accelerate [here](https://github.com/huggingface/accelerate/pull/517)

- Adds a new way to call subprocess that properly contains the stack trace raised in the error
- Reduces the passing result needed for the image classification example, as on a single GPU it reaches 62.5% but on multi gpu it hits 60%

Requires https://github.com/huggingface/accelerate/pull/547 to be merged first


## 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?


## 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.

@sgugger 

Comments:
_The documentation is not available anymore as the PR was closed or merged._
[TRACKER] Add BLOOM Meg-DS optimizer states
Author: younesbelkada
Pull request: no

### Feature request

Add BLOOM Meg-DS optimizer state on the Hub. Feature request from: https://twitter.com/Asuna_FPS_/status/1549137254588633093?s=20&t=FhO7Tlv01Gn6r_inZGyBug

Comments:
Currently uploading here: https://huggingface.co/bigscience/bloom-optimizer-states

Closing since the models have been added on the forementioned repo