noamaanMulla-03/transformers-issues huggingface dataset:
translate model_sharing.md and llm_tutorial.md to chinese
Author: jiaqiw09
Pull request: yes

# What does this PR do?

Part of  #26803 

## 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? _not necessary_


## Who can review?
@stevhliu

Comments:
@stevhliu

Hi,

Here are last two files of Tutorials section. And I have a problem to translate `moving parts`in llm_tutorial.md.
I think `moving parts` means "there are many things that must all happen for success. But only one thing must go wrong for failure."  And it's very hard to be translated as it is not direct by words.  Do you think it's reasonable to translate it to "components are complex and closely related "

Best

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_27283). All of your documentation changes will be reflected on that endpoint.

@stevhliu hi, I just fix the review and keep "moving parts" translation.

Best
Smangrul/fix failing ds ci tests
Author: pacman100
Pull request: yes

# What does this PR do?
1. Currently 2 DeepSpeed tests are failing with the error `E   AssertionError: False is not true : [zero3] /tmp/tmp5ddklgb9/checkpoint-5/pytorch_model.bin is not found`. This is because of the recent change of switching to `safetensors` as a default. This PR fixes the concerned tests.


Comments:
_The documentation is not available anymore as the PR was closed or merged._
[`CodeLlamaTokenizer`] Nit, update __init__ to make sure the AddedTokens are not normalized because they are special
Author: ArthurZucker
Pull request: yes

# What does this PR do?
Bridges the gap between the slow and fast version follow the updates in #26570 (similar updates were done to Llama)


Comments:
_The documentation is not available anymore as the PR was closed or merged._
Change thresh in test
Author: muellerzr
Pull request: yes

# What does this PR do?

Last little bit for the new accelerate dataloaders logic, the new results are at 0.51, *just* above our thresh so slightly tweaks the thresh to be passing.

(We will have our own CI running tests on examples etc here soon to catch these better :) ). IIRC these tests just verify it trains, which that thresh is 0.12 :)

Fixes # (issue)

Failing test on CPU CI


## 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.

@amyeroberts 

Comments:
_The documentation is not available anymore as the PR was closed or merged._
pyproject pytest config
Author: diegovalenzuelaiturra
Pull request: no

probably

`[tool.pytest.ini_options]` instead of `[tool.pytest]`

https://github.com/huggingface/transformers/blob/88832c01c8a962b653874c4ce4ed8df5783ac5cd/pyproject.toml#L21-L23

Comments:
cc @ydshieh 

@diegovalenzuelaiturra Thank you a lot!

I opened a draft PR #27366: we need to check if everything still run as expected. 

Reference: https://docs.pytest.org/en/stable/reference/customize.html
Put doctest options back to `pyproject.toml`
Author: ydshieh
Pull request: yes

# What does this PR do?

Put doctest options back to `pyproject.toml`.

Fix #27345

Checked with a run https://github.com/huggingface/transformers/actions/runs/6800607292. The list of failing doctests is the same as before, so we are good with this change.

Comments:
Need to check run results: https://github.com/huggingface/transformers/actions/runs/6799119065

_The documentation is not available anymore as the PR was closed or merged._
Pin huggingface_hub
Author: amyeroberts
Pull request: yes

# What does this PR do?

Currently tests are failing on `test_torch` CI run e.g. [this one](https://app.circleci.com/pipelines/github/huggingface/transformers/77707/workflows/ababd81d-2704-4b31-914d-15784acfad8e/jobs/989825).

The tests failing relating to the recent release of the hub are: 
```
FAILED tests/models/auto/test_modeling_auto.py::AutoModelTest::test_cached_model_has_minimum_calls_to_head - AssertionError: 0 != 1
FAILED tests/models/auto/test_tokenization_auto.py::AutoTokenizerTest::test_cached_tokenizer_has_minimum_calls_to_head - AssertionError: 0 != 1
``` 

Pinning until tests are resolved. 


Comments:
Thanks a lot!

Looks like we still get 0.19 ...

😫 

`accelerate`!

```
  Attempting uninstall: huggingface-hub
    Found existing installation: huggingface-hub 0.17.3
    Uninstalling huggingface-hub-0.17.3:
      Successfully uninstalled huggingface-hub-0.17.3
  Attempting uninstall: accelerate
    Found existing installation: accelerate 0.24.1
    Uninstalling accelerate-0.24.1:
      Successfully uninstalled accelerate-0.24.1
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
tokenizers 0.14.1 requires huggingface_hub<0.18,>=0.16.4, but you have huggingface-hub 0.19.0 which is incompatible.
transformers 4.36.0.dev0 requires huggingface-hub<=0.18.0,>=0.16.4, but you have huggingface-hub 0.19.0 which is incompatible.
Successfully installed accelerate-0.25.0.dev0 huggingface-hub-0.19.0 urllib3-2.0.7
```

I guess the quick but dirty way is to install huggingface_hub specific version in `.circleci/create_circleci_config.py` after the line 

pip install -U --upgrade-strategy eager git+https://github.com/huggingface/accelerate

(or ask @muellerzr to make change in `accelerate`)

OK, shall we pin our accelerate version then to unblock and then make transformers accelerate compatible?

cc @muellerzr  and @ArthurZucker as it looks like it involves `tokenizers` as well

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

The thing is, the hub version isn't pinned in accelerate: https://github.com/huggingface/accelerate/blob/main/setup.py. I might be misunderstanding pip, but I don't see why it couldn't downgrade? 

In `accelerate`, no pin, so 

```
pip install -U --upgrade-strategy eager git+https://github.com/huggingface/accelerate
```
will upgrade to the latest available one, even the dependencies I believe.

Or I can try to remove `--upgrade-strategy eager`. Let me know.

But maybe 

> if there is only 2 failing tests due to huggingface_hub  0.19, let's skip them for nonw maybe and wait 
[@Lucain](https://huggingface.slack.com/team/U03QTE7PET0) ’s patch maybe?



Opened a PR to skip the tests here: https://github.com/huggingface/transformers/pull/27393
use `pytest.mark` directly
Author: ydshieh
Pull request: yes

# What does this PR do?

#25598 uses `from pytest import mark` which breaks the function `get_test_classes` as the test module would have `mark` as attribute, and 
```
getattr(attr_value, "all_model_classes", [])
```
gives an `'MarkDecorator'` object (while `attr_value` is the `pytest.mark`).

This PR `import pytest` and use `@pytest.mark` to avoid the issue.

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

Would just using `pytest.mark.flash_attn_test` instead of importing `from pytest import mark` work? This looks like a complex workaround for a feature which is just a nice-to-have e.g. (comments [here](https://github.com/huggingface/transformers/pull/25598/files#r1331411143) and [here](https://github.com/huggingface/transformers/pull/25598/files#r1332676490))

Thanks for the great suggestion ! It works, and I will apply the same changes to all related test files.
Add Flash Attention 2 support to Bark
Author: ylacombe
Pull request: yes

# What does this PR do?

Following a recent series of PRs and issues to improve Bark, this PR aims to add FA2 support to Bark.  Bark self-attention class supports both causal and non-causal attention but otherwise changes are minimal.

I've also taken the opportunity to switch to  `_prepare_4d_attention_mask` instead of manually creating the 4d attention mask.


Benchmarks are currently running at the moment to measure speed/memory gains!

cc @sanchit-gandhi and @amyeroberts  

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

Thanks for the quick review, I've addressed your comments :hugs: 

Merging ! thanks for the quick reviews!
Skip flaky accelerate test
Author: amyeroberts
Pull request: yes

# What does this PR do?

Skipping another flaky accelerate tests until values have been aligned with accelerate library 

cc @muellerzr 

Comments:
@amyeroberts can you link to a failure? I thought #27378 fixed it :( (I tried to run every combo to see what that value would be)

@muellerzr Sure! Here's two CI runs with the test failing after rebasing on main: 
* https://app.circleci.com/pipelines/github/huggingface/transformers/77801/workflows/57ee7a82-f95d-43e2-8431-44420be74491/jobs/991432
* https://app.circleci.com/pipelines/github/huggingface/transformers/77800/workflows/147b815d-30df-41c9-90ad-5013a78e0e1c/jobs/991478

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

Ah pytorch test, got it. I'll see if I can recreate this and see during the alignment PR what that looks like

I can recreate locally it failing with 0.51 (same as the accelerate example that fixed), I can't recreate this 0.67 result :( 

> I can recreate locally it failing with 0.51 (same as the accelerate example that fixed), I can't recreate this 0.67 result :(

@ydshieh In this case - what would you recommend? Hold off until we can replicate and know we've found all the issues? 

re; slack: this is not the right issue. tl;dr the way we install the git pip dependencies does not actually grab the latest main commit, a different fix is needed. 

https://github.com/huggingface/transformers/pull/27404 will solve this in full :)
Use editable install for git deps
Author: muellerzr
Pull request: yes

# What does this PR do?

This PR solves the issue https://github.com/huggingface/transformers/pull/27398 tried to address, but instead was an even more subtle bug that has existed in the workflow:

When using a cache (such as any PR that has been opened and ran), if a git installed dependency (such as `accelerate`) is installed with `--upgrade-strategy eager` (so as to install the latest dependency versions of the library) it will *ignore* the actual library itself!

The solution to this (tested locally a number of times) is to use an editable install. `pip freeze` will finally show the right versions meaning it was actually installed to the latest versions.

Steps to try yourself:

1. `pip uninstall accelerate`
2. `pip install --upgrade-strategy eager git+https://github.com/huggingface/accelerate@4f100318f499cff48b62555ca7d96ad97d7cb9be`
3. `pip freeze | grep "accelerate"` (should show the `4f1...` commit)
4. `pip install --upgrade-strategy eager git+https://github.com/huggingface/accelerate@main#egg=accelerate`
5. `pip freeze | grep "accelerate"` (will **still** show the `4f1...` commit)
6. `pip install -e --upgrade-strategy eager git+https://github.com/huggingface/accelerate@main#egg=accelerate`
7. `pip freeze | grep "accelerate"` (will **finally** show the right commit)


## 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.

@ydshieh @amyeroberts 

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Fix RequestCounter to make it more future-proof
Author: Wauplin
Pull request: yes

Related to https://github.com/huggingface/transformers/pull/27389 and https://github.com/huggingface/transformers/pull/27393 (cc @amyeroberts @ydshieh).

The problem came from the fact that `transformers` test suite was trying to mock `huggingface_hub.utils.get_session` which is an internal method that I sometimes move/adapt for my needs. It shouldn't change much in the future but to make it more future-proof I chose to intercept the `urllib3` debug logs directly. It's not perfect as urllib3 might change their logs + we could use `pytest.caplog` instead but at this stage I think we are fine.

I also unskipped the 2 tests that were previously failing. 

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

I will merge once something on main is fixed. (should be soon)
Final fix of the accelerate installation issue
Author: ydshieh
Pull request: yes

# What does this PR do?

Fixfixfix

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

Still get `@4f100318f499cff48b62555ca7d96ad97d7cb9be`, I will check check!!!!!!

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_27408). All of your documentation changes will be reflected on that endpoint.
Transformers version 4.35.0 is breaking PEFT 0.0.6 -- IndexError
Author: alexsherstinsky
Pull request: no

### System Info

Hello,

With the Transformers version 4.35.0 and PEFT version 0.6.0 -- when running a model with `input_ids` and `attention_mask` as arguments, the IndexError exception occurs in "peft/tuners/adaption_prompt/utils.py:45":

```
model(input_ids=model_inputs, attention_mask=attention_masks).get("logits")
```

raises `"IndexError: tuple index out of range"`.

Thank you.

### 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

An LLM with the `adaptation_prompt` PEFT strategy, executing the `forward` method.

### Expected behavior

Running without exceptions.

Comments:
cc @younesbelkada 

This should be fixed in https://github.com/huggingface/peft/pull/1084 
Would it makes sense to have a patch release on PEFT side @BenjaminBossan @pacman100 ?

Thank you very much for jumping on this so fast!  If you decide to make a patch, please notify herein -- as I am watching this issue.  Thanks again!

We just made a patch release on PEFT side: https://github.com/huggingface/peft/releases/tag/v0.6.1 that should resolve the issue! let us know if all goes well by installing `peft==0.6.1` 

@younesbelkada Thank you so much -- going to try it now!  Will close the issue once tests pass in our repository.  Appreciated!

The fix for both `transformers` and `peft` has been confirm.  Thank you all!

Great ! Thanks @alexsherstinsky !!
Run all tests if `circleci/create_circleci_config.py` is modified
Author: ydshieh
Pull request: yes

# What does this PR do?

This file is also a central file related to tests. If it has some modification and only this file, currently no test job defined in it would run. (`empty` job). We have been cheated by green CI those were actually empty.

Let's run all tests in this case.

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Add config.rope_dim to LLaMA
Author: xunkai55
Pull request: yes

# What does this PR do?

This PR enables partial RoPE that can be applied to Llama variants / siblings.

It's discussed that only applying a half of positional encodings could lead to slight improvements on model performance. Example: https://github.com/lucidrains/x-transformers/issues/40

## 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.
- [ ] (Not Applicable?) 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?

@ArthurZucker  @younesbelkada 

Thanks for reviewing! Please let us know if there are any concerns or missing components.

Comments:
Ooops, we just found that we are sending a PR from `main` branch.

To avoid any confusions we're closing this PR and creating a new one later.
[i18n-<languageCode>] Translating docs to <languageName>
Author: Lena43
Pull request: no

<!--
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 <languageName>-speaking community 🌐 (currently 0 out of 267 complete)

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 `<languageCode>` inside the [source folder](https://github.com/huggingface/transformers/tree/main/docs/source).
* Register your translation in `<languageCode>/_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/).

## Get Started section

- [ ] [index.md](https://github.com/huggingface/transformers/blob/main/docs/source/en/index.md) https://github.com/huggingface/transformers/pull/20180
- [ ] [quicktour.md](https://github.com/huggingface/transformers/blob/main/docs/source/en/quicktour.md) (waiting for initial PR to go through)
- [ ] [installation.md](https://github.com/huggingface/transformers/blob/main/docs/source/en/installation.md).

## Tutorial section
- [ ] [pipeline_tutorial.md](https://github.com/huggingface/transformers/blob/main/docs/source/en/pipeline_tutorial.md)
- [ ]  [autoclass_tutorial.md](https://github.com/huggingface/transformers/blob/master/docs/source/autoclass_tutorial.md)
- [ ]  [preprocessing.md](https://github.com/huggingface/transformers/blob/main/docs/source/en/preprocessing.md)
- [ ]  [training.md](https://github.com/huggingface/transformers/blob/main/docs/source/en/training.md)
- [ ]  [accelerate.md](https://github.com/huggingface/transformers/blob/main/docs/source/en/accelerate.md)
- [ ]  [model_sharing.md](https://github.com/huggingface/transformers/blob/main/docs/source/en/model_sharing.md)
- [ ]  [multilingual.md](https://github.com/huggingface/transformers/blob/main/docs/source/en/multilingual.md)

<!--
Keep on adding more as you go 🔥
-->

Comments:
Hey @Lena43, what language would you like to help kickstart a translation in?

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.
typo: list to tuple
Author: pavloshushkov
Pull request: yes

Using a tuple in this case is more optimal

Comments:
Hello @pavloshushkov 

What is this change?

@LysandreJik Using "in" with sets is more efficient than using it with lists or other non-set containers.

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.