noamaanMulla-03/transformers-issues huggingface dataset:
Remove chameleon from CausalLM
Author: merveenoyan
Pull request: yes

as discussed internally @NielsRogge 
opened PRs to chameleon repos too

Comments:
@NielsRogge should I just add it [here](https://github.com/huggingface/transformers/blob/9e4ba843b72da9c3cea785feb85bd52047ede3a3/src/transformers/models/auto/modeling_auto.py#L701) instead, otherwise won't pass consistency checks and also it seemed suitable

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_32045). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Yes it would need to be added [here](https://github.com/huggingface/transformers/blob/765732e92c17a17682a5efd4aa4323e5ab01fe07/utils/check_repo.py#L157).

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.
[i18n-ar] Translating docs to Arabic
Author: strikoder
Pull request: no
Labels: name: WIP

Hi!

Let's bring the documentation to all the Arabic-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 `<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
- [ ] [readme.md](https://github.com/huggingface/transformers/edit/main/README.md)
- [ ] [index.md](https://github.com/huggingface/transformers/blob/main/docs/source/en/index.md) 
- [ ] [quicktour.md](https://github.com/huggingface/transformers/blob/main/docs/source/en/quicktour.md)
- [ ] [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)

Comments:
I will start translating the readme.md, then I will move to the tutorial section.

Hi,  @strikoder  السلام عليكم
We started translating Docs to Arabic if you want to participate check  #32435
Updated the custom_models.md changed cross_entropy code
Author: S-M-J-I
Pull request: yes

# What does this PR do?


<!--
Congratulations! You've made it this far! You're not quite done yet though.

Once merged, your PR is going to appear in the release notes with the title you set, so make sure it's a great title that fully reflects the extent of your awesome contribution.

Then, please replace this with a description of the change and which issue is fixed (if applicable). Please also include relevant motivation and context. List any dependencies (if any) that are required for this change.

Once you're done, someone will review your PR shortly (see the section "Who can review?" below to tag some potential reviewers). They may suggest changes to make the code even better. If no one reviewed your PR after a week has passed, don't hesitate to post a new comment @-mentioning the same persons---sometimes notifications get lost.
-->

<!-- Remove if not applicable -->

This PR corrects the `torch.nn.cross_entropy(..)` functions in all `custom_models.md`. The correct code is given be `torch.nn.functional.cross_entropy(..)`.

## 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#create-a-pull-request),
      Pull Request section?

@stevhliu

<!-- 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
- vision models: @amyeroberts
- speech models: @sanchit-gandhi
- graph models: @clefourrier

Library:

- flax: @sanchit-gandhi
- generate: @zucchini-nlp (visual-language models) or @gante (all others)
- pipelines: @Narsil
- tensorflow: @gante and @Rocketknight1
- tokenizers: @ArthurZucker
- trainer: @muellerzr and @SunMarc

Integrations:

- deepspeed: HF Trainer/Accelerate: @muellerzr
- ray/raytune: @richardliaw, @amogkam
- Big Model Inference: @SunMarc
- quantization (bitsandbytes, autogpt): @SunMarc

Documentation: @stevhliu

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

 -->


Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_33118). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Include documentation on linking to transformers docs with Intersphinx
Author: cthoyt
Pull request: no

I'm one of the maintainers of PyKEEN and we're adding a feature where you can use various transformers in combination with knowledge graph embedding models in https://github.com/pykeen/pykeen/pull/652. We're using sphinx to build our documentation and have out-links to various packages like numpy, but we haven't been able to figure out how to use the intersphinx configuration to link to transformers' docs. I spent a bit of time googling, but did not find any answers. Is this even possible? If so, could you include some information either here or in your docs themselves on what the objects.inv URL for your docs?

Comments:
Note that we do not use Sphinx anymore for our doc, since moving to https://huggingface.co/docs/transformers (we use raw markdown with some custom features on top of it, implemented in Svelte)

However (not at all familiar with Intersphinx so I'm shooting in the dark here) maybe there's a specification that we could implement to facilitate linking to specific classes or methods inside our documentation? Does anyone know more about this?

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

I got this working by adding the following to my `intersphinx_mapping` in the sphinx `conf.py`:
```python
intersphinx_mapping = {
    'datasets': ('https://huggingface.co/docs/datasets/master/en/', None),
    'transformers': ('https://huggingface.co/docs/transformers/master/en/', None),
} 
```
The key is that there's an `objects.inv` file in each of these directories, which is what sphinx needs.

Just an update for anyone that stumbles upon this: use `main` instead of `master` in the URL (the git branch name changed, although it does redirect now but may break in the future)
add warning when using 4-bit opti + non constant LR 
Author: SunMarc
Pull request: yes

# What does this PR do ? 

This PR adds a warning for users who uses 4bit optim + non constant LR as this might slow down the training. Not sure if we should set it to info level instead. I will need to check how big is the impact 

cc @winglian as you experienced that 

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_32942). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Not needed anymore since this has been fixed !
CI: add torchvision to the consistency image
Author: gante
Pull request: yes

# What does this PR do?

See title :) 

I'm expanding our doc checker to check the docstrings of methods (in addition to the docstring of the classes) in [this PR](https://github.com/huggingface/transformers/pull/32320). To check whether a documented method exists, the easiest solution is to load a class and check if it has the method. To load the class, we need the dependencies in the docker image.

Currently, the CI in the updated check PR is complaining about the lack of `torchvision`: https://app.circleci.com/pipelines/github/huggingface/transformers/101545/workflows/7939d2ec-284f-4353-81b5-db3fbbc4ed25/jobs/1353577

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_32941). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Test: add higher `atol` in `test_forward_with_num_logits_to_keep`
Author: gante
Pull request: yes

# What does this PR do?

#31292 added `test_forward_with_num_logits_to_keep`. The test needs a higher atol at least for modern CUDA devices, it was failing locally on my end.

[Forward pass in the lm head with different shape due to `num_logits_to_keep` -> different order of FP operations (maybe different optimal kernels too) -> slightly different output. See [this comment](https://github.com/huggingface/transformers/issues/25420#issuecomment-1775317535) for more info.]

FYI @Cyrilvallez 

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_33093). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Thanks for fixing and pointing that out! I had no idea that input shape only could impact outputs of linear layers so significantly for lower precisions. Very good thing to keep in mind in the future.
Do you know why the test did not fail on the CIs when I committed? I must be missing something on how the tests are automatically run/what tests are actually run

@Cyrilvallez 

> Do you know why the test did not fail on the CIs when I committed? 

Our CI on push runs on a machine without GPUs :D CPU computations tend to be less sensible to these tiny fluctuations

![Screenshot 2024-08-23 at 15 21 18](https://github.com/user-attachments/assets/cbc24902-9f95-4e6f-b3bf-1e084f7ab679)
Log additional test metrics with the CometCallback.
Author: Lothiraldan
Pull request: yes

# What does this PR do?

This PR updates the CometCallback to log metrics when checking performance using the test dataset.
It also updates the CometCallback to use the same metric naming convention as WandbCallback and MLflowCallback.

I have been working with @alexkuzmik on this PR internally so he might answer any questions or feedback directly.

## Before submitting
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#create-a-pull-request),
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?

Comments:
Thanks for updating @Lothiraldan! 

The failing tests were because an issue we had with our test runners which should now be resolved. Could you push an empty commit to trigger a re-run? This should make everything green and mergeable :) 

@amyeroberts I deleted our fork by mistake, do you have the possibility to re-open this PR or should I open another one?

Hey @Lothiraldan, we unfortunately don't have the option to reopen the PR anymore

@LysandreJik @amyeroberts Ok I've opened this new PR https://github.com/huggingface/transformers/pull/33124, sorry about the noise again :bow:
mps: add `isin_mps_friendly`, a wrapper function for `torch.isin`
Author: gante
Pull request: yes

# What does this PR do?

`torch.isin` is not supported on `mps` devices on `torch<2.4`. 

Currently, we are handling it in three different ways:
1. Replace it by an equivalent operation
2. Throw an exception
3. Do nothing

This PR encapsulates the equivalent `torch.isin` operation (and the logic to trigger it) in a single function, `isin_mps_friendly`, and replaces all `torch.isin` calls by this function. This should make our codebase a little more `mps` friendly 🤗 


Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_33099). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
[mms tts] add uroman as a soft-dependency
Author: sanchit-gandhi
Pull request: no
Labels: name: Feature request

name: Audio

### Feature request

For MMS-TTS checkpoints in languages with non-Roman alphabets (e.g. Hindi), the user is required to perform an extra pre-processing step on the text inputs **outside** of the tokenizer: https://huggingface.co/docs/transformers/en/model_doc/mms#inference

This pre-processing step converts non-Roman text to a "Romanized" version. The tokenizer will throw a warning if the pre-processing is not applied, but will not perform it itself: https://github.com/huggingface/transformers/blob/82efc53513a51660e629c7eca8210af1d67df00b/src/transformers/models/vits/tokenization_vits.py#L174

The ["Uroman"](https://github.com/isi-nlp/uroman#uroman) package required for this pre-processing step previously only contained PERL scripts. Thus, the decision was made to omit this from the Transformers integration. However, The Uroman package has since been updated to include Python scripts and a PyPi package: https://github.com/isi-nlp/uroman#installation

We can now add `uroman` as an optional dependency for MMS-TTS checkpoints that have the attribute `is_uroman`, and perform the pre-processing directly within the tokenizer.

The [Wav2Vec2 Phonemize tokenizer](https://github.com/huggingface/transformers/blob/main/src/transformers/models/wav2vec2_phoneme/tokenization_wav2vec2_phoneme.py) demonstrates a similar design for the `phonemizer` package for the `do_phonemize` attribute.

### Your contribution

Happy to review any PRs!

Comments:
cc @ylacombe 

Hi @sanchit-gandhi I want to add this feature can you assign me.

Hey @nandwalritik, feel free to give it a try and ping us to review your progress!
quickfix documentation
Author: molbap
Pull request: yes

# What does this PR do?
Nit on documentation, wrong Mamba class is used.

Fixes #32561 
cc @ArthurZucker 


Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_32566). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

I think this should probably also switch to `Mamba2Config`? It's not actually used in that example, so maybe it should be removed instead, but it's probably bad to have the wrong one there.

Right on @SamPruden !
Fix of type mis-match error in make_log_bucket_position
Author: pinesnow72
Pull request: yes

Fix of type mis-match error in make_log_bucket_position

# What does this PR do?

This PR fixes the type mismatch error in the function of make_log_bucket_position in modeling_tf_deberta_v2.py

In the function, `log_pos` is type of float32 and computed with the following code:
```
    log_pos = (
        tf.math.ceil(
            tf.cast(tf.math.log(abs_pos / mid), tf.float32) / tf.math.log((max_position - 1) / mid) * (mid - 1)
        )
        + mid
```
In the tf.math.ceil(), the second `tf.math.log()` gives type of float64 and the third term `(mid-1)` gives type of int32. These terms cause type mismatch error when dividing or multiplying with the first term with type of float32. And the final 'add' term `mid` is also type of int32 and causes type mismatch error. So, all these terms should be casted to float32.

This PR fixes #31988 


## Before submitting
- [x] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [V] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#create-a-pull-request),
      Pull Request section?
- [V] 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?
@ArthurZucker


Comments:
Fixup py 38 type hints for mps friendly
Author: muellerzr
Pull request: yes

# What does this PR do?

With https://github.com/huggingface/transformers/pull/33099, we need to do a `from __futures__` to make sure we still support py 3.8 :) 

Fixes # (issue)


## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [ ] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#create-a-pull-request),
      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.

@gante @ArthurZucker 

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_33128). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
[torch.compile] Graph break+warning instead of error in _prepare_generation_config
Author: williamwen42
Pull request: yes

I ran into this error when attempting to `torch.compile` miniCPM (https://huggingface.co/openbmb/MiniCPM-Llama3-V-2_5).

I tracked changes back to this PR https://github.com/huggingface/transformers/pull/29443 and I think that we should be graph breaking (i.e. going ahead with `copy.deepcopy`) and issuing a warning in the case we need to, instead of crashing. But in the case where the copy doesn't need to be done, we can skip making the call in order to prevent the graph break.

cc @gante 

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.

Hi @williamwen42 👋 Thank you for opening this PR

The exception serves to nudge the users towards an equivalent solution that works, instead of enabling the code to run suboptimally (i.e. with a graph break).

Is there a use case that is prevented by the current exception that isn't solved by moving arguments to a `GenerationConfig`?

No use case off the top of my head, but I was trying to compile a publicly available model (not mine) and ran into the crash. I think warning + graph break is a better way to get things working, but also lets users know that they might want to consider changing code.

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.