noamaanMulla-03/transformers-issues huggingface dataset:
nodejs
Author: Goddard
Pull request: no

### System Info

Using npm i @xenova/transformers and basically just copying and pasting the example at https://huggingface.co/docs/transformers.js/tutorials/node results in this error

@xenova/transformers/src/utils/hub.js:188
        const headers = new Headers();

I get some warnings before that [Unable to load from local path @xenova/transformers/models/Xenova/distilbert-base-uncased-distilled-squad/tokenizer.json\": \"ReferenceError: Headers is not defined\""]

I looked at that location and it doesn't look like any directory for models exist.  I read the documentation and they are supposed to be downloaded automatically right?

This test was done with node 16 and permissions look fine.  Ran as a user on linux.

### 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

Install via npm then follow the node example - https://huggingface.co/docs/transformers.js/tutorials/node

### Expected behavior

Give a result

Comments:
cc @xenova 

Thanks for the ping @amyeroberts :)

@Goddard This error is because `Headers` (and `fetch`) are not global variables in Node 16. Although you could use a polyfill, we recommend upgrading to Node 18+.

Also, since Node 16 is EOL, we do not plan on adding backwards compatibility support.

> Thanks for the ping @amyeroberts :)
> 
> @Goddard This error is because `Headers` (and `fetch`) are not global variables in Node 16. Although you could use a polyfill, we recommend upgrading to Node 18+.
> 
> Also, since Node 16 is EOL, we do not plan on adding backwards compatibility support.

Good to know.  Thank you.
I added new doc string into the MusicGenAttention class.
Author: hisushanta
Pull request: yes

I added a comprehensive and informative docstring to the MusicGenAttention class. It describes each of the parameters in the class in detail.

And now see what looks like my doc-string.
![Screenshot from 2023-10-23 07-03-02](https://github.com/huggingface/transformers/assets/93595990/454d9fe4-bd1a-4a9b-9148-2240388ea02c)

## 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).
- [ ] Did you write any new necessary tests?




Comments:
i m ok

Hey! Thanks for the feedback. But the docstring is not copied content.

What I mean is that the reason why the CI are broken is because the module to which you are adding docstring uses the `# Copied from` statement, which enforces that the entire module is copied from the source! 

Would it be okay to close this pull request now?



Of course! 🤗
Convert script for llama2 is not correct
Author: fancyerii
Pull request: no

### System Info

- `transformers` version: 4.34.1
- Platform: Linux-4.15.0-213-generic-x86_64-with-glibc2.27
- Python version: 3.9.18
- Huggingface_hub version: 0.17.3
- Safetensors version: 0.4.0
- Accelerate version: 0.24.0
- Accelerate config:    not found
- PyTorch version (GPU?): 1.13.1+cu117 (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?

_No response_

### 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

```
TRANSFORM=`python -c "import transformers;print('/'.join(transformers.__file__.split('/')[:-1])+'/models/llama/convert_llama_weights_to_hf.py')"`
python ${TRANSFORM} --input_dir llama-2-7b-chat/ --model_size 7B --output_dir 7B-chat
```
in config.json, the max_position_embeddings is 2048(not 4096):

```
{
  "architectures": [
    "LlamaForCausalLM"
  ],

  "max_position_embeddings": 2048,
  "model_type": "llama", 
}
```

According to [this issue](https://github.com/facebookresearch/llama/issues/359), Word/position embedding after 2k is not converted correctly.

If that't rue, it's a very serious problem. 

### Expected behavior

correct convert llama2 and as [Daryl149](https://github.com/Daryl149) in that issue test ask question with correct answer's position large than 2k.

Comments:
Hey, it's not a very serious issue no, the max_position embedding can be changed in the config and all converted checkpoints online are working as expected. Unless you have the need to convert them yourself and don't change it, yes generating after 2k will deteriorate but pretty minimal. 

Please make sure you read the issue you linked as it has pretty much all the answers

Feel free to open a PR to change this in the [conversion script](https://github.com/ArthurZucker/transformers/blob/72e9bd23250811083e8b2a37fd6143779d85cc51/src/transformers/models/llama/convert_llama_weights_to_hf.py#L101-L104):
```diff
    if base > 10000.0:
        max_position_embeddings = 16384
    else:
-        max_position_embeddings = 2048
+        max_position_embeddings = 4096
```

So I need just modify the config.json and it's all ok? I am converting llama2 myself.

Yes even if you modify after conversion it's alright 

thanks
transformer bark error
Author: wanglg007
Pull request: no

### System Info

transformer bark error

### Who can help?

_No response_

### 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

1. use transformer's bark
2. python 3.8

### Expected behavior

![image](https://github.com/huggingface/transformers/assets/40556406/809535e1-a1fd-4a75-9720-bfd1ffe3cd06)


Comments:
Hey! According to the contribution guidelines we need a full reproducer to be able to help you! 

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.
transformers-v4.33.4., update it please
Author: brando90
Pull request: no

### Feature request

release transformers-v4.33.4.

### Motivation

> This should not be required after transformers-v4.33.4.

mistral needs it https://mistral.ai/news/announcing-mistral-7b/

### Your contribution

yes, happy to help, let me know

Comments:
We'll be releasing v4.34.0 tomorrow. Mistral cannot be added to v4.33 through a patch as this would not respect semantic versioning.

In the meantime, feel free to install from source: `pip install git+https://github.com/huggingface/transformers`

Do you think it will support dilated attention  ? I saw the mistral team mentioning longformer.

We're aiming for support on-par with the Mistral implementation in this release, yes!

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.

v4.34 with Mistral support was release last month. Closing this!
Fix slack report failing for doctest
Author: ydshieh
Pull request: yes

# What does this PR do?

By truncating the long reports.

The failing of the (a bit) many TF models is not related to `torch 2.2`. Previous we didn't see those failures, as `Blip2` causes OOM, and later tests may get more GPU memory due to this. (This is what I observed by re-run the doctest with different commits/torc versions).

Still need to figure if there is a way to avoid this.

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

Maybe we can send two reports instead of truncating? WDYT?

The problem (we currently have) is the category `API Examples failures` (modeling file, not md file) itself is too long (due to the failures from some tensorflow files), and itself has to be truncated already.

So sending 2 reports separately (for each category) won't work without truncating.

However if you mean: 2 reprots, but each can be truncated (if necessary) --> OK for me :-)

I meant that after truncating the first report, you could take the truncated text and send it over in a second report as a follow up. This way we would have all the information held in the reports

I made the `API Examples failures` and `MD Examples failures:` as independent slack `block`. Each report could be truncated.
(The limit of `3000` characters is for a single block)

See the following screenshot: (here there is no truncation, as I just ran 4 tests to see the output)

<img width="433" alt="Screenshot 2023-10-27 105256" src="https://github.com/huggingface/transformers/assets/2521628/dbd666eb-fcc3-4a5e-aa2c-bcb08d3e55f4">

(I didn't try to customize the `The following examples had failures` part for each category however - to keep it simple)
[`FA2`/ `Mistral`] Revert previous behavior with right padding + forward
Author: younesbelkada
Pull request: yes

# What does this PR do?

Addresses: https://github.com/huggingface/transformers/pull/26912#issuecomment-1783842424

As stated in that comment, https://github.com/huggingface/transformers/pull/27086 has mistakenly reverted https://github.com/huggingface/transformers/pull/26912 - this PR simply reverts it back

Comments:
_The documentation is not available anymore as the PR was closed or merged._
[`Trainer` / `GC`] Add `gradient_checkpointing_kwargs` in trainer and training arguments
Author: younesbelkada
Pull request: yes

# What does this PR do?

Partially fixes: https://github.com/huggingface/trl/pull/912

Following https://github.com/huggingface/transformers/pull/27020 it is important to propagate `gradient_checkpointing_kwargs` in `Trainer` as well

cc @ArthurZucker 


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

Also why does it *partially* fix the issue

It partially fixes the issue because I need https://github.com/huggingface/peft/pull/1036 to be merged to fix the bug with respect to PEFT models
Fix data2vec-audio note about attention mask
Author: gau-nernst
Pull request: yes

# What does this PR do?

Fixes #25621 

## 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.
- [ ] 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.

Models:

- text models: @ArthurZucker and @younesbelkada
- vision models: @amyeroberts
- speech models: @sanchit-gandhi
- graph models: @clefourrier

Library:

- flax: @sanchit-gandhi
- generate: @gante
- pipelines: @Narsil
- tensorflow: @gante and @Rocketknight1
- tokenizers: @ArthurZucker
- trainer: @muellerzr and @pacman100

Integrations:

- deepspeed: HF Trainer/Accelerate: @pacman100
- ray/raytune: @richardliaw, @amogkam
- Big Model Inference: @SunMarc
- quantization (bitsandbytes, autogpt): @SunMarc and @younesbelkada

Documentation: @stevhliu and @MKhalusova

HF projects:

- accelerate: [different repo](https://github.com/huggingface/accelerate)
- datasets: [different repo](https://github.com/huggingface/datasets)
- diffusers: [different repo](https://github.com/huggingface/diffusers)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Maintained examples (not research project or legacy):

- Flax: @sanchit-gandhi
- PyTorch: See Models above and tag the person corresponding to the modality of the example.
- TensorFlow: @Rocketknight1

 -->

@ylacombe 

Sorry for the late update. I was busy with something else. Finally got some time to do this quick doc update.

Comments:
LGTM as well! Thanks for the much clearer note here!

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_27116). All of your documentation changes will be reflected on that endpoint.
Fix some tests using `"common_voice"`
Author: ydshieh
Pull request: yes

# What does this PR do?

Fix some tests using `"common_voice"`.

Errors:
```
FileNotFoundError: https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-6.1-2020-12-11/en.tar.gz
```
and 
```
               This version of the Common Voice dataset is deprecated.
              You can download the latest one with
              >>> load_dataset("mozilla-foundation/common_voice_11_0", "en")
```
We can load the same dataset using `"mozilla-foundation/common_voice_6_1"`, but this requires passing `token` which is not good for testing purpose.

So I change it to `"mozilla-foundation/common_voice_11_0"` but update expected outputs.


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

That is in the plan :-)
[`tests` / `Quantization`] Fix bnb test
Author: younesbelkada
Pull request: yes

# What does this PR do?

Fixes the currently bnb failing test ([Link to failing job](https://github.com/huggingface/transformers/actions/runs/6680718296))

```
tests/quantization/bnb/test_mixed_int8.py::MixedInt8GPT2Test::test_get_keys_to_not_convert
```

The issue is related to the fact that currently the `trust_remote_code` version of MPT models cannot be loaded from transformers main since https://github.com/huggingface/transformers/pull/27086 removed some private methods from the modeling files, i.e. this simple script fails on main:

```python
from accelerate import init_empty_weights
from transformers import AutoModelForCausalLM, AutoConfig

model_id = "mosaicml/mpt-7b"
config = AutoConfig.from_pretrained(
    model_id, trust_remote_code=True, revision="72e5f594ce36f9cabfa2a9fd8f58b491eb467ee7"
)
with init_empty_weights():
    model = AutoModelForCausalLM.from_config(
        config, trust_remote_code=True, code_revision="72e5f594ce36f9cabfa2a9fd8f58b491eb467ee7"
    )
```

I raised an issue on the Hub https://huggingface.co/mosaicml/mpt-7b/discussions/83 so the issue should be hopefully fixed soon. I proposed to temporary skip the test for trust_remote_code version of MPT models and revert it back once that issue gets resolved. I believe that should be fine


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

Thanks! makes sense, adapted the test accordingly and made : https://github.com/mosaicml/llm-foundry/issues/703 to track the issue
Failed to import 'Wav2Vec2PhonemeEncoder' from 'transformers'
Author: Suryatejakalapala
Pull request: no

### System Info

- `transformers` version: 4.34.1
- Platform: Windows-10-10.0.23531-SP0
- Python version: 3.11.2
- Huggingface_hub version: 0.17.3
- Safetensors version: 0.4.0
- Accelerate version: not installed
- Accelerate config: not found
- PyTorch version (GPU?): 2.1.0+cpu (False)
- Tensorflow version (GPU?): 2.14.0 (False)
- 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?

_No response_

### Information

- [x] 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

Just Importing Error 

### Expected behavior

Cant import 

Comments:
Hi @Suryatejakalapala, thanks for raising this issue! 

I can't find any reference to the class `Wav2Vec2PhonemeEncoder` [in the library](https://github.com/search?q=repo%3Ahuggingface%2Ftransformers+Wav2Vec2PhonemeEncoder&type=code). Is there a particular example in docs or resources which uses this class? 

I am not familiar with the transformer library I got the phoneme_encoder from bard(AI) if there is smth wrong Sorry for wasting your time 

OK, it's likely Bard just hallucinated that class then 👍 

Ha thanks for the info then I am closing
🌐 [i18n-ZH] Translate serialization.md into Chinese
Author: yyLeaves
Pull request: yes

# What does this PR do?
Translate serialization.md into Chinese
part of #20095  
## Who can review?
Documentation: @stevhliu 
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.

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_27076). All of your documentation changes will be reflected on that endpoint.
Resize position embeddings in PreTrainedModel
Author: PaulLerner
Pull request: no

### Feature request

Add a method to resize position embeddings in PreTrainedModel, in the same way as there is `resize_token_embeddings` for word embeddings.

There are several ways to do that:
- retrain everything from scratch
- keep the pretrained embeddings but add new trained from scratch for the new positions (as done in `PreTrainedModel._get_resized_embeddings` if I understand correctly)
- same but initialize new positions by interpolating pretrained ones instead of random init

### Motivation

It would be nice to be able to resize position embeddings when the PreTrainedModel has too small `max_position_embeddings`.
I found several related issues:
- https://stackoverflow.com/questions/69820065/how-to-extend-a-pretrained-transformer-model-configured-with-small-max-position
- https://github.com/huggingface/transformers/issues/1978

### Your contribution

Willing to help :)
From what I can tell, most of the job is already done in `PreTrainedModel._get_resized_embeddings` 

Comments:
I have met the same 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.

I am also facing the same issue

is this issue resolved? Why was it closed?  I need to use different size, not, but I can't do it

It was closed automatically because no one answered after one month :man_shrugging: 


They exactly a PR for the same issue, but only for some models.
#13559
I think you can modify the resize_position_embeddings in your own model based on the example in this PR.
[i18n-jpTranslating `en/main_classes` folder docs to Japanese 🇯🇵
Author: rajveer43
Pull request: no
Labels: name: WIP

<!--
Note: Please search to see if an issue already exists for the language you are trying to translate.
-->

Hi!

Let's bring the documentation to all the Japanese-speaking community!

Who would want to translate? Please follow the 🤗 [TRANSLATING guide](https://github.com/huggingface/transformers/blob/main/docs/TRANSLATING.md). Here is a list of the files ready for translation. Let us know in this issue if you'd like to translate any, and we'll add your name to the list.

Some notes:

* Please translate using an informal tone (imagine you are talking with a friend about transformers 🤗).
* Please translate in a gender-neutral way.
* Add your translations to the folder called `ja` inside the [source folder](https://github.com/huggingface/transformers/tree/main/docs/source).
* Register your translation in `ja/_toctree.yml`; please follow the order of the [English version](https://github.com/huggingface/transformers/blob/main/docs/source/en/_toctree.yml).
* Once you're finished, open a pull request and tag this issue by including #issue-number in the description, where issue-number is the number of this issue. Please ping @stevhliu and @MKhalusova for review.
* 🙋 If you'd like others to help you with the translation, you can also post in the 🤗 [forums](https://discuss.huggingface.co/).


<!--
Keep on adding more as you go 🔥
-->


Comments:
Why isn't intermediate_size 4 * hidden_size for Llama as in paper?
Author: sytelus
Pull request: no

Llama paper uses 4 times hidden size for MLP's intermediate layer.  So, for 7B model,  `hidden_size=4096` should give us `intermediate_size=16384`. However, Llama config defaults it to `11008`.

https://github.com/huggingface/transformers/blob/722e9364916e527e8d46cbd828a1516bf6aaebd6/src/transformers/models/llama/configuration_llama.py#L47

Any idea why?

















































































Comments:
Oops my bad. It's because of SwiGLU.

```
INTERMEDIATE_SIZE_MAP = {
    "7B": 11008,
    "13B": 13824,
    "30B": 17920,
    "65B": 22016,
}
```

The intermediate_size is calculated as follows:

```
def compute_intermediate_size(n):
    return int(math.ceil(n * 8 / 3) + 255) // 256 * 256
```
Fix import of torch.utils.checkpoint
Author: NielsRogge
Pull request: yes

# What does this PR do?

When rebasing on main after #27124 was merged, I couldn't run any test as I got:

```
raise RuntimeError(
E   RuntimeError: Failed to import transformers.models.transfo_xl.modeling_transfo_xl because of the following error (look up to see its traceback):
E   module 'torch.utils' has no attribute 'checkpoint'
```
which was happening here:
```
src/transformers/modeling_utils.py:1886: in PreTrainedModel
    self, enable: bool = True, gradient_checkpointing_func: Callable = torch.utils.checkpoint.checkpoint
E   AttributeError: module 'torch.utils' has no attribute 'checkpoint'
```
My PyTorch version is 1.13.

Then I saw this fix: https://github.com/EleutherAI/gpt-neox/pull/85. So I applied the same.


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