noamaanMulla-03/transformers-issues huggingface dataset:
[`TFxxxxForSequenceClassifciation`] Fix the eager mode after #25085
Author: ArthurZucker
Pull request: yes

# What does this PR do?
Fixes https://github.com/huggingface/transformers/issues/25743 and one of our CI that triggered this

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

Taking this one!

Should be ready for review @ArthurZucker - tests pass for me now. The cause was using the static shape instead of the dynamic shape, it's probably the single most common source of TF bugs for us!

I can't approve my own PR! Hahah feel free to merge if the slow tests pass 😉
Safe import of rgb_to_id from FE modules
Author: amyeroberts
Pull request: yes

# What does this PR do?

Small change which makes `rgb_to_id` importable from the feature extraction modules. Previously this was removed and moved to the `image_transforms` module. However, this was a breaking change and should have been more safely handled with a warning telling users how to update their code. 

This was flagged in this issue: https://huggingface.co/facebook/detr-resnet-50-panoptic/discussions/6#6537952c25f780fed22f6285


## 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?

Comments:
_The documentation is not available anymore as the PR was closed or merged._
Add fuyu device map
Author: SunMarc
Pull request: yes

# What does this PR do ? 
This PR adds the possibility to use fuyu model with `device_map="auto"`. 
I ran some tests on my side and it works with multigpu and cpu offload. I am not writing any accelerate tests as they will be contained in a future `FuyuModelTest` class which will inherit from `ModelTesterMixin`. 

cc @younesbelkada 

Comments:
_The documentation is not available anymore as the PR was closed or merged._
cannot import name 'SeamlessM4TModel' from 'transformers'
Author: druskacik
Pull request: no

### System Info

transformers 4.34.1
python 3.10.12
Windows

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

I am trying to use the HuggingFace implementation of the SeamlessM4T model available here: https://huggingface.co/facebook/hf-seamless-m4t-medium .

However, importing `SeamlessM4TModel` from `transformers` raises an `ImportError`:

```python
from transformers import AutoProcessor, SeamlessM4TModel

>>> ImportError                               Traceback (most recent call last)
Cell In[5], line 1
----> 1 from transformers import AutoProcessor, SeamlessM4TModel

ImportError: cannot import name 'SeamlessM4TModel' from 'transformers' (C:\Users\rober\.conda\envs\product_scanner\lib\site-packages\transformers\__init__.py)
```

I use the latest `transformers` version, `4.34.1`.

### Expected behavior

Expected behaviour is to import the `SeamlessM4TModel` without an error.

Comments:
Hey, that is expected as it is not part of the latest release. Make sure to install using `pip install git+https://github.com/huggingface/transformers.git`
translate `preprocessing.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

Here is the translation of preprocessing.md

Best

@stevhliu 

Hi, Thansk for your review. I just notice that you have merge the PR(`pipeline_tutorial.md`). So I just solve the merge conflicts problem.

Would you mind having a check again?

Best

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

> Thanks, just one more minor change and we can merge!

Hi, thanks for your review and suggestion. Sorry that I missed some mirror problem.

Best
Translate `pipeline_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

I just updated my translation work. Here is a guileline during my translation:
- Keep some terminology in English format. Those workds appears in amounts of class files or other documents. I think it's better to keep it in original format rather give a chinese translation.


@stevhliu Thansk for your review. I just fix these two problems. Would you mind having a check again?
And for another PR of preprocessing.md, I will update it after this PR is merged. Both PRs changes `_toctree.yml`, there may be some merge conflict problem.
Best

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_26954). All of your documentation changes will be reflected on that endpoint.
Fix config silent copy in from_pretrained
Author: patrickvonplaten
Pull request: yes

# What does this PR do?

Some model's copy the config in the __init__ . We need to make sure that after we init the model we're still using the correct config.

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

> Thanks, was there an issue related to this somewhere? 🤗

Yeah in bart flash attention
Add MoLFormer
Author: hoffmansc
Pull request: yes

# What does this PR do?

Add MoLFormer model from IBM (`MolformerModel`, `MolformerForMaskedLM`, `MolformerForSequenceClassification`, etc.). MoLFormer is trained on a large corpus of small molecules represented by SMILES strings with a masked language modeling objective, fast linear attention, and rotary positional embeddings.

Closes #26966


## 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.
- [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).
- [X] Did you write any new necessary tests?


## Who can review?

Models:

- text models: @ArthurZucker and @younesbelkada

Comments:
Hey! Thanks for opening a PR, this model looks like a prefect candidate for [`code on the hub`](https://huggingface.co/docs/transformers/custom_models) under the IBM organization like [this one](https://huggingface.co/ibm/mpt-7b-instruct2)! We would love to help you 🤗 

I see, thanks for the tip. I think I got it working [here](https://huggingface.co/ibm/MoLFormer-XL-both-10pct) so I'll close this now.
Add MoLFormer model
Author: hoffmansc
Pull request: no
Labels: name: New model

### Model description

MoLFormer is a large-scale chemical language model designed with the intention of learning a model trained on small molecules which are represented as SMILES strings. MoLFormer leverages Masked Language Modeling and employs a linear attention Transformer combined with rotary embeddings.

Published in Nature Machine Intelligence:
> ... Experiments show that utilizing the learned molecular representation outperforms existing baselines on downstream tasks, including supervised and self-supervised graph neural net baselines and language models, on several classification and regression tasks from ten benchmark datasets while performing competitively on two others. Further analyses, specifically through the lens of attention, demonstrate that MoLFormer trained on chemical SMILES indeed learns the spatial relationships between atoms within a molecule.

### Open source status

- [X] The model implementation is available
- [X] The model weights are available

### Provide useful links for the implementation

Paper: [NMI version](https://rdcu.be/c12D0), [arXiv version](https://arxiv.org/abs/2106.09553)
Code: https://github.com/IBM/molformer
Weights: https://ibm.box.com/v/MoLFormer-data

Comments:
[docs] Performance docs refactor p.2
Author: MKhalusova
Pull request: yes

This PR continues performance docs refactor in the transformers docs. It focuses mainly on the "Efficient Training on Multiple GPUs" doc and contains the following changes:
* Improves clarity and readability
* Adds links to Accelerate where relevant
* Removes a duplicated chunk of content
* Resolves some formatting issues

Comments:
_The documentation is not available anymore as the PR was closed or merged._
/lib64/libcrypto.so.10: version `OPENSSL_1.0.2' not found when install transformers using  conda
Author: liumilan
Pull request: no

conda create -n transformer python=3.8.0
conda activate transformer
conda install -c huggingface transformers
conda install PyTorch=1.10
conda install -c anaconda openssl
and when i run from from transformers import pipeline ，it will report 
/lib64/libcrypto.so.10: version `OPENSSL_1.0.2' not found (required by /home/work/anaconda3/envs/transformer/lib/python3.8/site-packages/tokenizers/tokenizers.cpython-38-x86_64-linux-gnu.so)

how to fix it 

Comments:
ImportError: cannot import name 'SeamlessM4TModel' from 'transformers' 
Author: mwzkhalil
Pull request: no

### System Info

I encountered an ImportError when trying to import 'SeamlessM4TModel' from the 'transformers' library, 
Code:
`from transformers import AutoProcessor, SeamlessM4TModel

processor = AutoProcessor.from_pretrained("facebook/hf-seamless-m4t-large")
model = SeamlessM4TModel.from_pretrained("facebook/hf-seamless-m4t-large")`

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

nan

### Expected behavior

nan

Comments:
![image](https://github.com/huggingface/transformers/assets/77918472/fe3160d3-1f57-4123-8a62-4618a813d653)


A duplicate of #27036, please make sure you install form source 🤗
adding smaller or equal rather than greater
Author: MostHumble
Pull request: yes

according to description : "`num_beam_groups` has to be an integer smaller or equal than `num_beams` and `num_beams` has to be"
                f" divisible by `num_beam_groups`, but is {num_beam_groups} with `num_beams` being {num_beams}."






## 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.
- [ 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:
`num_beam_groups` has to be smaller than `num_beams`, thus if `num_beam_groups > num_beams` the error should be thrown -- I believe the original code is correct :)
[docstring] fix incorrect llama docstring: encoder -> decoder
Author: ztjhz
Pull request: yes

# What does this PR do?

Fixes the erroneous reference from "encoder" to "decoder" in the llama docstring.

<!--
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.
-->



## 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.

@zphang @ydshieh @abzdel


Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_27071). All of your documentation changes will be reflected on that endpoint.
[`docs`] Add `MaskGenerationPipeline` in docs
Author: younesbelkada
Pull request: yes

# What does this PR do?

As requested on the Hub here: https://huggingface.co/facebook/sam-vit-base/discussions/3#65389abb67325b6218f92719 currently there is no documentation about `MaskGenerationPipeline` for SAM model

`MaskGenerationPipeline` was also missing on the main init.

cc @ArthurZucker 

Comments:
_The documentation is not available anymore as the PR was closed or merged._
🌐 [i18n-ZH] Translate custom_models.md into Chinese
Author: yyLeaves
Pull request: yes

# What does this PR do?
Translate custom_models.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_27065). All of your documentation changes will be reflected on that endpoint.
Added hindi language code in language list
Author: AaryaBalwadkar
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 -->

Added hindi language code in language list in .github/workflows/build_documentation.yml and .github/workflows/build_pr_documentation.yml.
Fixes # 26837


## 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] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).


## Who can review?

@stevhliu and @MKhalusova please review this PR.


Comments:
Closing since this is fixed in #26837
Fix TypicalLogitsWarper tensor OOB indexing edge case
Author: njhill
Pull request: yes

This can be triggered fairly quickly with low precision e.g. `bfloat16` and `typical_p=0.99`.

@gante 

Comments:
I'm going to be honest - I don't fully understand the code here!

The array `last_ind` is created as:
`last_ind = (cumulative_probs < self.mass).sum(dim=1)`

This is the sum of a boolean array, which should be strictly nonnegative, because boolean arrays only contain 0 and 1 values. Therefore, I don't understand why the original line `last_ind[last_ind < 0] = 0` or the replacement using `torch.clamp_` are necessary - I don't see how you'd get negative values without an integer overflow, and if we're getting an integer overflow we should be using bigger integer dtypes, not fixing it with value clamping.

Do you know why this is necessary in the first place?

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

@Rocketknight1 good point, I hadn't considered whether the existing check was valid/redundant, I guess it's [always been there](https://github.com/huggingface/transformers/pull/15504).

I guess it would make more sense if the prior line was `last_ind = (cumulative_probs < self.mass).sum(dim=1) - 1`, perhaps that was originally intended but left out. I'll update this PR accordingly.

I guess this will actually mean a subtle change in behaviour, but I'm fairly sure it's what was originally intended. Not sure whether this is ok though w.r.t. transformers policies around this kind of thing...

cc @gante here - I think you might know better than me what the code is doing!

Thanks @gante @Rocketknight1, I've now rebased and added a commit with the explicit `min` arg suggestion.

Thank you for the fix @njhill 💪
Minimal model for writing tests.
Author: pafi-code
Pull request: no

# 🚀 Feature request

Add minimal models that satisfy different transformers interfaces.

## Motivation

I'd like to write some tests for a project that uses the transformers package in the background. To test my functionality I somehow need to use a transformers model (or a mock). However typically the models that are available are pretty huge, which typically causes bitbucket pipelines (or what ever CI pipeline) to fail due to memory limitations of the docker container.

Thus it would be really cool if you could provide minimal models that satisfy the transformers interfaces such that the `transformers.Trainer` object can use it for example.

If something like that is already available I couldn't really find it, but let me know if there is something.

Cheers :beer: 


Comments:
Do the models available on https://huggingface.co/hf-internal-testing fit your use-case? That's what we use internally for our testing with dummy models.

These are randomly instantiated, however. They should only be used for mock testing.

Thanks, this is exactly what I was looking for! Are these not meant to be found, or did I just not search good enough? :smile: 

They're used for our internal testing and not really intended for public usage, so we don't really communicate about it. Now that we're aware that some users may find them useful, we should do a better job of advertising them :)

Alright! Thanks for letting me know! :beer: 

This is extremely useful, thank you!  I was looking for a way to ensure that connecting a transformer's encoding to our downstream models was working without downloading a giant model, even if it's not giving useful results.

However, as of March 2023, the models do not show up in searches, even if you specifically search for `hf-internal-testing`.  

This page is empty, for example:

https://huggingface.co/models?search=hf-internal-testing

As is this one:

https://huggingface.co/models?search=hf-internal-testing%20roberta

Is that something you could fix?  I understand you probably don't want to show the models all of the time, such as when someone is searching for a bert they actually want to use.  Perhaps it would work to change it so that if a search shows nothing at all, but some internal testing models matched, then the internal testing models show up

causal mistral doesn't work with peft:

```
E           RuntimeError: Error(s) in loading state_dict for PeftModelForCausalLM:
E               size mismatch for base_model.model.model.layers.0.self_attn.q_proj.lora_A.default.weight: copying a param with shape torch.Size([32, 4096]) from checkpoint, the shape in current model is torch.Size([32, 32]).
E               size mismatch for base_model.model.model.layers.0.self_attn.q_proj.lora_B.default.weight: copying a param with shape torch.Size([4096, 32]) from checkpoint, the shape in current model is torch.Size([32, 32]).
```

Hey @earonesty feel free to open a new issue with a reproducer if you want some help.