noamaanMulla-03/transformers-issues huggingface dataset:
Default behaviour in `TextClassificationPipeline` for regression problem type
Author: subhalingamd
Pull request: no
Labels: name: Feature request

### Feature request

The `AutoModelForSequenceClassification` class also supports problem_type=regression. I am not sure if it is popularly used but I believe that function_to_apply in `TextClassificationPipeline` should behave as if it is set to "none"  for this case?

### Motivation

Currently, the "sigmoid" function is also applied for regression tasks which, in my opinion, might not be the correct default behaviour.

### Your contribution

I believe this can be handled by adding an additional condition for `self.model.config.problem_type == "regression"` before [this](https://github.com/huggingface/transformers/blob/38f9f10dd9240619ea17fb6c7acb51b3bc592232/src/transformers/pipelines/text_classification.py#L195) line.

Comments:
cc @Rocketknight1 WDYT? 

Hi @subhalingamd, when doing regression tasks, `num_labels` should usually be 0, right? If that is set, then the function to applied will be `NONE`.

Hi @Rocketknight1, that doesn't seem to be the case. The regression score is represented by LABEL_0 by default.
Indeed, `num_labels == 1` is used as the criteria for assigning problem_type as regression [[example](https://github.com/huggingface/transformers/blob/7bae833728c76345caa04a334368684ed2e77f66/src/transformers/models/bert/modeling_bert.py#L1716)].

@subhalingamd hm, good point! Let me see what we can do. Do you have an example of a text regression model on the Hub I can test with?

Actually, after investigating a bit more, I think checking for `problem_type == "regression"` as you suggested is the right strategy. Would you be willing to make that PR?

sure, i can do that

Great, thank you!
Fix default behaviour in TextClassificationPipeline for regression problem type
Author: subhalingamd
Pull request: yes

# What does this PR do?

For `problem_type=="regression"`, set default behaviour for `function_to_apply` to "none" in `TextClassificationPipeline`.

Fixes #33973

## 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#create-a-pull-request),
      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).
- [x] Did you write any new necessary tests?


## Who can review?
@Rocketknight1


Comments:
I'm not sure if this change requires adding new tests and/or updating anything under `docs/`. Could you please help? I have updated the docstrings in the file.

sure, i can add them. changing the pr to draft till then.

@Rocketknight1 I have added a test case to `test_small_model_pt()`. Hope this works.

LGTM now! Pinging @LysandreJik for core maintainer review.

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

Merged, thanks for the PR @subhalingamd!
Add support for inheritance from class with different suffix in modular
Author: yonigozlan
Pull request: yes

# What does this PR do?
Add support for inheritance from class with different suffix in modular, fixes https://github.com/huggingface/transformers/issues/33900#issuecomment-2391616600

Useful when we want to create a model for a certain task, extending another model used for a different task, as is the case for `ColPaliForRetrieval` and `PaliGemmaForConditionalGeneration` in https://github.com/huggingface/transformers/pull/33736

Not sure if that's in the spirit of modular or if it's the best way to do this though!

<!--
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 -->

Fixes #33900

## Who can review?

cc @ArthurZucker , @tonywu71 
<!-- 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, @qubvel
- speech models: @ylacombe, @eustlb
- graph models: @clefourrier

Library:

- flax: @sanchit-gandhi
- generate: @zucchini-nlp (visual-language models) or @gante (all others)
- pipelines: @Rocketknight1
- tensorflow: @gante and @Rocketknight1
- tokenizers: @ArthurZucker
- trainer: @muellerzr and @SunMarc
- chat templates: @Rocketknight1

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:
No I hadn't seen those changes sorry about that, I have added them now.
Also added a dummy example very similar to what we're trying to do with ColPali!
Preserve `ModelOutput` object for compute_metrics evaluation loop in trainer
Author: qubvel
Pull request: yes

# What does this PR do?

### Preserve `ModelOutput` for evaluation loop
**Motivation**: During the evaluation, the trainer returns tuples instead of `ModelOutput` objects, however, image_processors expect `ModelOutput` for the postprocessing of predictions. This significantly reduces the generalization of training scripts for different models of the same type.

**Solution**: Introduced training argument `eval_preserve_model_output`. If set to `True`, then `ModelOutput` objects are preserved and passed to `compute_metrics`, otherwise model outputs are converted to tuples. `False` by default for BC.


### Fix discrepancies in return type for `batch_eval_metrics`

Current `main` behavior:
- if `batch_eval_metrics=True` on **device** (e.g. GPU) torch tenors are passed to the `compute_metrics` function
- if `batch_eval_metrics=False` **CPU** numpy arrays are passed to the `compute_metrics` function

Suggested behavior:
- Tensors are always moved to the CPU
- If training argument `eval_numpify_tensors=True`, then tensors are converted to numpy arrays, otherwise returned as torch tensors (`True` by default for BC)

This change is breaking for `batch_eval_metrics=True` but in favor of making outputs consistent, `batch_eval_metrics` was introduced in #28769 (about a month ago), I guess we can still change its behavior.



## Who can review?


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

Just for clarity, at the moment, on `main` we have the following behavior:

"Evaluation" stage
 - `batch_eval_metrics=True` -> do **NOT** return model outputs from evaluation_loop (save memory), compute metrics on each batch separately
 - `batch_eval_metrics=False` -> do return model outputs from evaluation_loop, compute metrics on all batches of dataset at once
 
"Prediction" stage
 - `batch_eval_metrics=True` -> do return model outputs from evaluation_loop (NOT save memory), compute metrics on each batch separately
 - `batch_eval_metrics=False` -> do return model outputs from evaluation_loop, compute metrics on all batches of dataset at once

Sounds reasonable, for evaluation, we are interested in `metrics` and can drop outputs to save memory. For prediction, we cannot drop outputs and save memory (alternatively we can `yield` predictions after each batch).


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.

@muellerzr or @SunMarc can you please have a look at this PR?
Fix optuna ddp hp search
Author: SunMarc
Pull request: yes

# What does this PR do ? 

Fixes https://github.com/huggingface/transformers/issues/27487
This PR fixes an issue with optuna hp search when using DDP. The issue was that we didn't parsed pass the correct item to `pickle.loads` when we perform boardcasting with torch. cc @sywangyi as you were the one who integrated it ! 
The following test is passing with ddp with this PR: `test_trainer.py::TrainerHyperParameterOptunaIntegrationTest:test_hyperparameter_search`

Otherwise, we were getting the following traceback: 

```
[rank1]: Traceback (most recent call last):
[rank1]:   File "test_local.py", line 83, in <module>
[rank1]:     trainer.hyperparameter_search(direction="minimize", hp_space=hp_space, hp_name=hp_name, n_trials=4)
[rank1]:   File "/home/marc/transformers/src/transformers/trainer.py", line 3420, in hyperparameter_search
[rank1]:     best_run = backend_obj.run(self, n_trials, direction, **kwargs)
[rank1]:   File "/home/marc/transformers/src/transformers/hyperparameter_search.py", line 72, in run
[rank1]:     return run_hp_search_optuna(trainer, n_trials, direction, **kwargs)
[rank1]:   File "/home/marc/transformers/src/transformers/integrations/integration_utils.py", line 275, in run_hp_search_optuna
[rank1]:     args = pickle.loads(bytes(args_main_rank))
[rank1]: _pickle.UnpicklingError: pickle data was truncated
```

Comments:
@ArthurZucker it's because it's the whole `TrainingArgs` object. Fairly certain we can't safetensors a general object..? (so not really much we can do about that/not sure the warning is *too* warranted)

I think that's still a thing when we want to perform broadcasting:
```
torch.distributed.broadcast_object_list(object_list, src=0, group=None, device=None)[[source]](https://pytorch.org/docs/stable/_modules/torch/distributed/distributed_c10d.html#broadcast_object_list)
Broadcasts picklable objects in object_list to the whole group.

Similar to [broadcast()](https://pytorch.org/docs/stable/distributed.html#torch.distributed.broadcast), but Python objects can be passed in. Note that all objects in object_list must be picklable in order to be broadcasted.
```
fix DAC slow test
Author: kamilakesbi
Pull request: yes
Labels: name: run-slow

# What does this PR do?

This PR aims to fix the slow test `test_integration_24khz` in DAC, recently added with PR #31494. 



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

@kamilakesbi To run the slow model tests, you need to add the `run-slow` label to the PR. The order has to be label, then commit, so you'll need to push a `[run_slow]` commit again

@kamilakesbi To run the slow tests for this model, you need to pass the model name in the commit message i.e. `[run_slow] dac`

Hey @kamilakesbi, many thanks for opening this PR!
Do you think you'll be able to finish it? If not, it would be of a tremendous help if you could provide a simple snippet on the original DAC library so that I can take a look myself!


supersede by #34088
`AutoModel` class for `image-text-to-text` models
Author: merveenoyan
Pull request: no
Labels: name: Feature request

### Feature request

It would be nice to get a standard `AutoModel` class for `image-text-to-text` models (since @molbap is standardizing the processor) 

### Motivation

@NielsRogge noticed that in model repositories the automatic snippets fallback to `AutoModelForPreTraining` because these models don't exist in `PIPELINE_TAGS_AND_AUTO_MODELS` (due to lack of `AutoClass`) More importantly it would be nice to load it to a single class.

### Your contribution

I haven't checked what it takes to implement an `AutoClass` when model classes exist in different names for the same task but if decided I don't mind looking into it and taking a stab.

Comments:
First attempt was at #29572, but is awaiting standardization of processors which is tracked at https://github.com/huggingface/transformers/issues/31911

cc @zucchini-nlp re VLMs 

Another blocker was that some models need custom processing code to be moved into their processors. I started #32059 and will get to work on checking which models need additional processing to standardize the inputs and outputs :).

The PR for auto mapping was merged recently, guess we an close this?

Yes this was added in https://github.com/huggingface/transformers/pull/32472
🌐 [i18n-KO] Translated `vivit.md` to Korean
Author: mreraser
Pull request: yes

<!-- PR의 제목은 "🌐 [i18n-KO] Translated `<your_file>.md` to Korean" 으로 부탁드립니다 -->
# What does this PR do?

Translated the `vivit.md` file of the documentation to Korean.
Thank you in advance for your review. 

Part of https://github.com/huggingface/transformers/issues/20179

## Before reviewing
- [x] Check for missing / redundant translations (번역 누락/중복 검사)
- [x] Grammar Check (맞춤법 검사)
- [x] Review or Add new terms to glossary (용어 확인 및 추가)
- [x] Check Inline TOC (e.g. `[[lowercased-header]]`)
- [x] Check live-preview for gotchas (live-preview로 정상작동 확인)

## Who can review? (Initial)

<!-- 1. 위 체크가 모두 완료된 뒤에만 N조 팀원들에게 리뷰 요청하는 아래 주석을 노출해주세요! 차례대로 1 ~ 5조 -->
May you please review this PR?
@yijun-lee, @mreraser, @jungnerd, @cjfghk5697
<!-- @win2dvp21, @enchantee00, @fabxoe, @1kmmk1, @junejae -->
<!-- @SeungAhSon, @Jwaminju, @thsamajiki, @4N3MONE, @jungnerd -->
<!-- @mjk0618, @cjfghk5697, @ahnjj, @JinukHong, @nuatmochoi -->
<!-- @010kim, @chhaewxn, @boyunJang, @jeongiin, @harheem -->

## 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?

## Who can review? (Final)
Hello @stevhliu !  May you please review this PR? Thank you! 

Have a nice day :)

Comments:
Hello! @yijun-lee, @jungnerd, @cjfghk5697
May I kindly ask for your review? Thank you for your consistent reviews 🤗 

LGTM! Thanks for your translation 👍🏻

Yes it's fine to me @stevhliu!
🌐 [i18n-KO] Translated `quantization/overview.md` to Korean
Author: 4N3MONE
Pull request: yes

# What does this PR do?

Translated the `overview.md` file of the documentation to Korean.
Thank you in advance for your review. 

Part of https://github.com/huggingface/transformers/issues/20179

## Before reviewing
- [x] Check for missing / redundant translations (번역 누락/중복 검사)
- [x] Grammar Check (맞춤법 검사)
- [x] Review or Add new terms to glossary (용어 확인 및 추가)
- [x] Check Inline TOC (e.g. `[[lowercased-header]]`)
- [ ] Check live-preview for gotchas (live-preview로 정상작동 확인)

## Who can review? (Initial)

@junejae, @Jwaminju, @010kim, @boyunJang 


## 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).
- [x] Did you write any new necessary tests?

## Who can review? (Final)
<!-- @stevhliu May you please review this PR? -->

Comments:
🌐 [i18n-KO] Translated `gemma2.md` to Korean
Author: yijun-lee
Pull request: yes

<!-- PR의 제목은 "🌐 [i18n-KO] Translated `gemma2.md` to Korean" 으로 부탁드립니다 -->
# What does this PR do?

Translated the `gemma2.md` file of the documentation to Korean.
Thank you in advance for your review.

Part of https://github.com/huggingface/transformers/issues/20179

## Before reviewing
- [x] Check for missing / redundant translations (번역 누락/중복 검사)
- [x] Grammar Check (맞춤법 검사)
- [x] Review or Add new terms to glossary (용어 확인 및 추가)
- [x] Check Inline TOC (e.g. `[[lowercased-header]]`)
- [ ] Check live-preview for gotchas (live-preview로 정상작동 확인)

## Who can review? (Initial)

<!-- 1. 위 체크가 모두 완료된 뒤에만 N조 팀원들에게 리뷰 요청하는 아래 주석을 노출해주세요! 차례대로 1 ~ 5조 -->
May you please review this PR?
@jungnerd, @cjfghk5697, @yijun-lee, @mreraser


## 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#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? (Final)

<!-- 2. N조 팀원들과 리뷰가 끝난 후에 아래 주석을 노출해주세요! -->
@stevhliu May you please review this PR?

Comments:
LGTM!

LGTM 🚀
🌐 [i18n-KO] Translated `trainer_utils.md` to Korean
Author: yijun-lee
Pull request: yes

<!-- PR의 제목은 "🌐 [i18n-KO] Translated `<your_file>.md` to Korean" 으로 부탁드립니다 -->
# What does this PR do?

Translated the `trainer_utils.md` file of the documentation to Korean.
Thank you in advance for your review.

Part of https://github.com/huggingface/transformers/issues/20179

## Before reviewing
- [x] Check for missing / redundant translations (번역 누락/중복 검사)
- [x] Grammar Check (맞춤법 검사)
- [x] Review or Add new terms to glossary (용어 확인 및 추가)
- [x] Check Inline TOC (e.g. `[[lowercased-header]]`)
- [ ] Check live-preview for gotchas (live-preview로 정상작동 확인)

## Who can review? (Initial)

<!-- 1. 위 체크가 모두 완료된 뒤에만 N조 팀원들에게 리뷰 요청하는 아래 주석을 노출해주세요! 차례대로 1 ~ 5조 -->
May you please review this PR?
@jungnerd, @cjfghk5697, @yijun-lee, @mreraser


## 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?

## Who can review? (Final)

<!-- 2. N조 팀원들과 리뷰가 끝난 후에 아래 주석을 노출해주세요! -->
@stevhliu May you please review this PR?

Comments:
LGTM 😎

LGTM 🚀
Adds the Molmo vision-language models
Author: chrisc36
Pull request: yes

# What does this PR do?

Adds the Molmo vision language models. This code is intended to replace the remote code used for the molmo models, such as [here](https://huggingface.co/allenai/Molmo-7B-D-0924).

## 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#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.
- [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?

Comments:
Duplicate of #33962 ?
IDEFICS: support inputs embeds
Author: zucchini-nlp
Pull request: yes

# What does this PR do?

Fixes https://github.com/huggingface/transformers/issues/34033 and enables tests for VLMs. Prev tests were all skipped because we had a hard check for CausalLM Mapping

Comments:
I am trying to make sure that IDEFICS models start using library standards, and hopefully after we enable generation tests it will be easier to catch those bugs when adding the model 🤗 

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