noamaanMulla-03/transformers-issues huggingface dataset:
[Pipeline-asr] `batch_size` ignored when using a single file
Author: ArthurZucker
Pull request: no

This is not a very important issue but when using the `asr` pipeline, if you give a single audio file that you want to `chunk`, and provide both a `batch_size` and `chunk_lenght_s`, the pipeline still runs sequentially. 

Reproducing script : 

```python 
from transformers import pipeline
from datasets import load_dataset
import datasets
ds = load_dataset("common_voice", "ja", split="test", streaming=True)
ds = ds.cast_column("audio", datasets.Audio(sampling_rate=16_000))
input_speech = next(iter(ds))["audio"]["array"]

pipe = pipeline("automatic-speech-recognition","facebook/wav2vec2-base-960h")
pipe(input_speech, return_timestamps ="char", chunk_length_s = 30, stride_length_s=[3,3], batch_size = 1024, device = 0)
```

(thanks @Narsil  for the hack with `pipe([input_speech], return_timestamps ="char", chunk_length_s = 30, stride_length_s=[3,3], batch_size = 1024, device = 0)`

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.

Unstale

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.
Fix inclusion of non py files in package
Author: sgugger
Pull request: yes

# What does this PR do?

This PR fixes the inclusion of non py files in the transformer package. The setup was missing `include_package_data=True`.

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_21546). All of your documentation changes will be reflected on that endpoint.
Fix from_pretrained API with config and state_dict
Author: sgugger
Pull request: yes

# What does this PR do?

The `from_pretrained` method documents its possible to pass along `pretrained_model_name_or_path=None` as long the user provides a `config` and a `state_dict`. This API was not tested and broke, this PR fixes that and adds a test.

Fixes #21526 

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Added with torch.no_grad() to XLM-Roberta integration test 
Author: katiele47
Pull request: yes

# What does this PR do?

Fixes #14642 

## 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?

@ydshieh @LysandreJik 

Comments:
_The documentation is not available anymore as the PR was closed or merged._
No metric log calculation and output after using newest version.
Author: chungdz
Pull request: no

Hello,

I met a problem that with the same code, the Trainer in huggingface was not calculating metrics using the compute_metric function and outputed the metric logs.

When I using the older version (4.22.0) Trainer the output is like: 
![image](https://user-images.githubusercontent.com/24776624/217948354-12180c97-2100-4e93-a9d7-e365a55bc848.png)

However with new version of Trainer (4.26.1), there're only few outputs:
![image](https://user-images.githubusercontent.com/24776624/217948542-ccc3dfb7-42fa-4240-90e9-306a4f2b7464.png)

No loss and metrics define by my own function. It's really confusing and I don't konw how to solve it. Please help.  

Comments:
We can't magically help you without knowing the code you are running. Please follow the issue template.

Write in template in [new issue](https://github.com/huggingface/transformers/issues/21553).
Added with torch.no_grad() to Camembert integration test
Author: katiele47
Pull request: yes

# What does this PR do?

Fixes #14642 

## 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?

@ydshieh Please let me know if there are any problems!

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Remove CLI spams with Whisper FeatureExtractor
Author: qmeeus
Pull request: yes

# What does this PR do?
Whisper feature extractor representation includes the MEL filters, a list of list that is represented as ~16,000 lines. This needlessly spams the command line. I added a `__repr__` method that replaces this list with a string `<array of shape (80, 201)>`


## 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.
@ArthurZucker 


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

Hey, thanks for the contribution! I agree with you, wee should not save the filters as they just depend on the parameters with which they were created, which is why I would be in favor of simply adding the following : 

```python
    def to_dict(self) -> Dict[str, Any]:
        """
        Serializes this instance to a Python dictionary.

        Returns:
            `Dict[str, Any]`: Dictionary of all the attributes that make up this configuration instance.
        """
        output = copy.deepcopy(self.__dict__)
        output["feature_extractor_type"] = self.__class__.__name__
        if "mel_filters" in output:
            del output["mel_filters"]
        return output
```
Also cc @sanchit-gandhi this seems very logitcal to me

Yes indeed, I think this solution is better

For the remaining failing test, I suggest you rebase on main 😉 

You can also modify the test to make the CI go green 😉
Add _mp_fn to run_mae.py for XLA testing
Author: steventk-g
Pull request: yes

Testing MAE ViT on TPU https://github.com/GoogleCloudPlatform/ml-testing-accelerators/pull/771

Based on update required to `run_glue.py` in https://github.com/huggingface/transformers/pull/4146

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Some issues on summarization example
Author: Shentao-YANG
Pull request: no

@patil-suraj 
Thanks for the beautiful example in `main/examples/pytorch/summarization`. I do, however, have the following issues with the `run_summarization_no_trainer.py` file.
1. The flag `--max_length` seems not used. 
2. The checking `check_min_version("4.26.0.dev0")` seems ahead of the current release of `4.25.1`
3. This file does not have the flags no `test_file`, `max_train/eval/predict_samples`, while `run_summarization.py` has.
4. Also it will be helpful to add the functionality of gradient norm clipping.

Thanks for your help.

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.
There should partial forward in pretrained BERT and RoBERTa models
Author: shashwat1002
Pull request: no

### Feature request

There should be a way to to send inputs to specific encoder layers and finish the forward partially. 

For example, there should be a way to send input hidden states to the fourth encoder layer, and get all hidden states after that through forward computation.



### Motivation

This kind of thing is required in causal intervention.


### Your contribution

I can submit a PR to this effect.

Comments:
Each of those models is defined in its own modeling file that you can modify to suit your needs. This is why we have a one file per model policy in Transformers :-)

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.
[docs] translating.md needs an update
Author: wonhyeongseo
Pull request: no

Dear 🤗  HuggingFace Team,

I would like to suggest updating the guide for issues in the following sections:
- 🗞️ Open an issue
  - [x] As of now, there is no template called `Translation template` while opening an issue. Instead I had to copy-paste issues made by the community. https://github.com/huggingface/transformers/pull/20199
  - [ ] To view the translated documentation in the _first_ PR for a new language, one should first update line 18 of `build_documentation.yml` and line 17 of `build_pr_documentation.yml` from `.github/workflows` to include their language code. This should be expained in the guide, ideally in a separate section called `Open a pull request`.
- 📋 Copy-paste the English version with a new language code
  - [ ] It should be made clear that this step is only needed for the first PR, and subsequent PRs can get the documents they want translated from `en` separately, with updates to `_toctree.yml` done in tandem.
- 📚 etc.
  - [ ] For non-alphabet languages, translators must put in a custom link as shown [here](https://github.com/huggingface/doc-builder#writing-documentation-for-hugging-face-libraries:~:text=a%20way%20to%20customize%20the%20anchor%20link) (screenshot included below). <hr/>
![image](https://user-images.githubusercontent.com/29195190/201503131-4bf8eed6-e5df-475d-b545-a983b424174d.png)

As a possible solution we could:
- refactor the document to 2 sections: `New languages` and `In-progress languages` 
- add more content regarding how the first pull request should be done
- and account for non-alphabet languages by providing a small sidenote

Thank you so much for this wonderful library.

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.

Sorry for the drag in progress, but may you please put the `WIP` tag to this issue as well? Thank you @sgugger.

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 am working on this issue.

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.
[Tests] Improve flax test_attention_outputs
Author: Shubhamai
Pull request: yes

# What does this PR do?

A copy of https://github.com/huggingface/transformers/pull/20701 by [NielsRogge](https://github.com/NielsRogge) for making corresponding changes in flax. These changes are also necessary for passing tests in [flax convnext implementation PR](https://github.com/huggingface/transformers/pull/21485). 

## 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?

@sanchit-gandhi

Comments:
_The documentation is not available anymore as the PR was closed or merged._
[from_pretrained] extend `torch_dtype="auto"` to look up `config.torch_dtype` first, expand docs
Author: stas00
Pull request: yes

1. As discussed at https://huggingface.slack.com/archives/C01N44FJDHT/p1675880091973589 this PR proposes to expand the `from_pretrained` documentation of how `torch_dtype`'s different values impact the model loading.
2. next `torch_dtype="auto"` was expanded to first look up `config.torch_dtype` and if it's not there try to derive it from weights.
3. fixed a bug that was polluting the config object when `torch_dtype="auto"`
4. Tests were expanded to test the new functionality and the bug.



Comments:
_The documentation is not available anymore as the PR was closed or merged._
[Tasks] Adds image captioning 
Author: sayakpaul
Pull request: yes

This PR adds a guide on image captioning introducing a brand new section for tasks: Multimodal :) 

The idea was originated by @NielsRogge and the PR builds on top of his great work [here](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/GIT/Fine_tune_GIT_on_an_image_captioning_dataset.ipynb). 

An interactive Colab Notebook that was used to develop the task guide is available [here](https://colab.research.google.com/drive/1sLiSY2ixv52yqlw9EUW6BPwCq9XPLc9R?usp=sharing).

Not bad quality, eh?

![image](https://user-images.githubusercontent.com/22957388/217499831-c41ac0f5-2e9c-4b89-aab9-3db96d0066cb.png)

Generated caption: 

> a drawing of a pink and blue pokemon 

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Goodbye to Blip-2 doctests
Author: ydshieh
Pull request: yes

# What does this PR do?

Blip-2 causes GPU OOM on doctest, and potentially causes some subsequential tests failing (as the GPU is not in good state, but I didn't verify thoroughly).

This PR tries to avoid this situation, despite the added lines is not really meant to be in a doc for users.

Comments:
> I don't think the doctests should run on a 2.7b-parameter model, that's not a good use of our resources. So the doctest should be skipped if there is not a smaller checkpoint available.

It could be run with FP16 + the changes in this PR. In terms of resources, the machine is always on, so I don't see the waste. Could you elaborate a bit more regarding your thought on the resources (while we can make it fit into the T4 GPUs eventaully)

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

OK, I agree! Will skip

cc @NielsRogge for information

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_21566). All of your documentation changes will be reflected on that endpoint.
[deepspeed] deal with models w/o `config.hidden_size`
Author: stas00
Pull request: yes

This PR 
1. extends the deepspeed integration config setup to models that use `config.hidden_sizes` instead of `config.hidden_size` 
2. and while at it adds a check so that it only ever tries to figure hidden size if it's actually needed. 
3. and if the model config has neither of the 2 attributes - a proper assert is used.

Fixes: https://github.com/huggingface/transformers/issues/21342

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

cc: @pacman100 - you may probably want to sync this special case with accelerate, right?
Replace input_values_processing with unpack_inputs
Author: amyeroberts
Pull request: yes

# What does this PR do?

Updates Hubert and Wav2Vec2 to use the repo standard `unpack_inputs` decorator instead of `input_values_processing`. Previously, TensorFlow models use `input_values_processing`, a function which processed inputs ready to be passed to the TF layers. This was removed and replaced with unpack inputs, see #16051. For some reason, wav2vec2 wasn't part of this update. [A bug was reported](https://github.com/huggingface/transformers/issues/16051#issuecomment-1067938180), but the conversation and details can't be found in the discord 😢 

This PR also updates any relevant tests: 
* Adds `unittest.skip` decorator so tests are marked as skipped rather than passed
* Modifies batch sizes for tests that were previously skipped for OOM to make sure logic is fully tested. 
* Adds back tests which shouldn't have been skipped. This caught the issue with loss not being calculated (see below)

**Note:** The loss calculation for `TFHubertForCTC` wasn't being calculated properly. Without the `unpack_inputs` decorator, when `model.fit` was being called, `labels` were passed into the model as part of the `input_values` dictionary. These were then processed and [part of the `inputs` dictionary](https://github.com/huggingface/transformers/blob/c35bb6de547f8839434c3d5772777c699e9595de/src/transformers/models/wav2vec2/modeling_tf_wav2vec2.py#L1645). However, `labels` was always [taken from the function kwargs](https://github.com/huggingface/transformers/blob/c35bb6de547f8839434c3d5772777c699e9595de/src/transformers/models/wav2vec2/modeling_tf_wav2vec2.py#L1677) and so loss calculation skipped. [This is why the previous test 'returned the wrong shape'](https://github.com/huggingface/transformers/blob/c35bb6de547f8839434c3d5772777c699e9595de/tests/models/hubert/test_modeling_tf_hubert.py#L328). The issue was resolved for `TFWav2Vec2ForCTC` in a previous PR #18014


## 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).
- [x] Did you write any new necessary tests?

Comments:
_The documentation is not available anymore as the PR was closed or merged._
improving contributing tests section
Author: Shubhamai
Pull request: yes

# What does this PR do?

Adds info about the `RUN_PT_FLAX_CROSS_TESTS` environment variable during testing. It took me some time to figure this out during testing flax models :sweat_smile: so figured it might come helpful to future :hugs:  contributors.    

## 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?
- [ ] 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._

Marvelous, thanks again!

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_21569). All of your documentation changes will be reflected on that endpoint.
adding a tip for deepspeed integration in multi-node environment
Author: izapolsk
Pull request: yes

This PR 
1. adds a tip for training in multi-node environment with deepspeed w/o shared filesystem
2. automatically configures deepspeed to inject:
```
{
  "checkpoint": {
    "use_node_local_storage": true
  }
}
```
when `--save_on_each_node` is passed.

-------------------
note from @stas00: I took this opportunity to expand much further these sections, as it has been long overdue!

Comments:
@stas00, could you please review  ? ^^

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

Maybe, it's also worth adding `use_node_local_storage: true` when `save_on_each_node=True` and use_node_local_storage isn't defined in deepspeed config file.

Great additions, @izapolsk!

> Maybe, it's also worth adding use_node_local_storage: true when save_on_each_node=True and use_node_local_storage isn't defined in deepspeed config file.

yes, please and thank you!

Also if you'd like it might be a good idea to update the doc to replace `torch.distributed.launch` with the new API of `torch.distributed.run` as the former is deprecated now since about a year. If you want to that is - if not, no worries, I can update it later.

We can also say expand your note that any launcher can be used, including `accelerate` I think (need to check though). i.e. the launcher is independent from the program it runs.

I'll do. thank you 

Please let me know when you finished editing and I will add a few more notes - as some users will be still using `launch`, so we should mentioned both. 

@stas00, please review

Excellent integration addition, @izapolsk - thank you for the initiative.

I took this opportunity to expand much further these sections, as it has been long overdue! Hope you don't mind that I did it in your PR. All your content is there, I just expanded the content a lot more.

Please let me know if it looks good to you and if you have any suggestions to make. (please note that I reverted to using the full `torch.distributed.run` way since it's easier for users who are transitioning from `torch.distributed.launch`)

p.s. I also edited the OP to reflect the changes.

awesome, thank you !