noamaanMulla-03/transformers-issues huggingface dataset:
Clarification on Commercial License Impact of LayoutLMv3ImageProcessor within UdopProcessor
Author: Arjunexperion
Pull request: no

Hi team,

I have a question regarding licensing and commercial usage.

Since UdopProcessor internally uses LayoutLMv3ImageProcessor (as part of resizing, rescaling, normalizing document images, and applying OCR), and given that LayoutLMv3 itself is not licensed for commercial use, I would like to clarify:

➡️ If I use UdopProcessor for fine-tuning UDOP and plan to deploy it in a commercial setting, will the dependency on LayoutLMv3ImageProcessor affect the commercial viability of using UDOP?

In other words, does the inclusion of LayoutLMv3ImageProcessor within UdopProcessor impose any commercial licensing restrictions on the UDOP model?

Thank you in advance!

Comments:
Hey! This question should probably go to Microsoft rather than us, unfortunately, since they're the original creator of both models!
[docs] Fix image link
Author: stevhliu
Pull request: yes

Replaces the non-existent image url with a valid one, and also fix Gemma 3 docstring example

Comments:
Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. When it is ready for review, please click the `Ready for review` button (at the bottom of the PR page).

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

# What does this PR do?

update bot comment again, as a new CircleCI pipeline with a new trigger (by ready for review event) is added.

Comments:
Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. The CI will be paused while the PR is in draft mode. When it is ready for review, please click the `Ready for review` button (at the bottom of the PR page). This will assign reviewers.

@Rocketknight1 it's ready for review. I keep it as draft so not to trigger CI (no point to run CI for this PR)

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_36974). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
QuestionAnswering for Gemma 3
Author: DavidAdamczyk
Pull request: no
Labels: name: Feature request

### Feature request

I’m just checking out the Gemma 3 implementation in Hugging Face: https://github.com/huggingface/transformers/commit/50d3530aa04e7a7d003e6b255a98f79fd0447357, and I’m curious why there’s no implementation for Question Answering. Are there any architectural reasons for this, or has it just not been implemented yet?

I know there's an implementation of the LlamaForQuestionAnswering class, so I expected the code could be similar.

### Motivation

Given that it’s used in the source code for other architectures, I expect that Gemma 3 will support it as well.

### Your contribution

I’d like to submit a PR with a solution, but since I haven’t contributed to the HF codebase before, I’d need some guidance from a more experienced developer.

Comments:
Hey @DavidAdamczyk !

We didn't add the class because the official checkpoints do not include one tuned for question answering task. See similar request for adding Sequence Classification in https://github.com/huggingface/transformers/issues/36755#issuecomment-2728747863

I am happy to support QA for Gemma3, let's wait a bit to see how much interest we have from the community
🚨Deprecate legacy argument for image-text-to-text models and adopt new behavior by default
Author: yonigozlan
Pull request: yes

# What does this PR do?

The legacy kwarg, behavior and the corresponding warnings have been out in the library for a while. The original deprecation version was 5.0.0, but as it is causing issues with remote_code models such as https://github.com/huggingface/transformers/issues/36106 amongst others, it might be time to remove it now?
Other issue, the kwarg was removed from the image-text-to-text pipeline (inadvertently by me 😐) where it should be set to False by default, so right now the behavior in the pipeline for model that do use the legacy argument is not as it should be.
The models using the legacy kwarg are the following: Donut, Git, Pix2Struct.
They are quite old models, and hopefully users have had the time to see the deprecation warnings, but putting 🚨 as it will still change some default behaviors.


Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_36307). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Add ruff target-version
Author: cyyever
Pull request: yes

Target ruff to py3.9

Comments:
Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. The CI will be paused while the PR is in draft mode. When it is ready for review, please click the `Ready for review` button (at the bottom of the PR page). This will assign reviewers.

cc @ydshieh since I think this might affect the CI as well!
[bug] use_gather_object is not respected after the first eval in trainer
Author: ducha-aiki
Pull request: no

Hi,

Consider this as a mix of bug report and PR. Unfortunately, it would take too long for me to cook the toy example to reproduce, and the issue is quite simple and obvious enough.

So, there is a `use_gather_object` argument in TrainingArguments, allowing to use non-tensors in eval, or tensors with different shapes.
It is handled here:

https://github.com/huggingface/transformers/blob/main/src/transformers/trainer.py#L5103

```python3
        # create accelerator object
        self.accelerator = Accelerator(**args)
        # some Trainer classes need to use `gather` instead of `gather_for_metrics`, thus we store a flag
        self.gather_function = self.accelerator.gather_for_metrics

        if "use_gather_object" in inspect.signature(self.gather_function).parameters.keys():
            self.gather_function = functools.partial(
                self.gather_function, use_gather_object=self.args.eval_use_gather_object
            )
```

However, I have noticed, that after the first eval, the 2nd eval is crashing, while trying to concat batches with different shapes, as if the flag `eval_use_gather_object` stopped working. Indeed it does, because here in `evaluation_loop`, the `self.gather_function` is reset, and the `.eval_use_gather_object` is not used 
https://github.com/huggingface/transformers/blob/main/src/transformers/trainer.py#L4359

```python3
        # After all calls to `.gather_function`, reset to `gather_for_metrics`:
        self.gather_function = self.accelerator.gather_for_metrics
```

Suggested fix (I am using it myself): add the same line to use the flag. 
https://github.com/huggingface/transformers/blob/main/src/transformers/trainer.py#L4359

```
        if "use_gather_object" in inspect.signature(self.gather_function).parameters.keys():
            self.gather_function = functools.partial(
                self.gather_function, use_gather_object=self.args.eval_use_gather_object
            )
```

Comments:
Hi @ducha-aiki, thanks for the report ! I just reviewed your PR 

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.
byebye CircleCI TF jobs
Author: ydshieh
Pull request: yes

# What does this PR do?

I know it's sad but it's time.


Comments:
Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. The CI will be paused while the PR is in draft mode. When it is ready for review, please click the `Ready for review` button (at the bottom of the PR page). This will assign reviewers and trigger CI.

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_36998). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Recent update: configuration_eurobert.py not found -
Author: panwpalo
Pull request: no
Labels: name: bug

### System Info

It looks like the author introduced a new bug with the new update to Huggingface. (Updates was added 3 hours prior to this post)

the recent update to the Hugging
Could not locate the configuration_eurobert.py inside


    file = cached_files(path_or_repo_id=path_or_repo_id, filenames=[filename], **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "python3.11/site-packages/transformers/utils/hub.py", line 517, in cached_files
    raise EnvironmentError(
OSError: EuroBERT/EuroBERT-610m does not appear to have a file named ..processing_utils.py. Checkout 'https://huggingface.co/EuroBERT/EuroBERT-610m/tree/main'for available files.



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

from transformers import AutoTokenizer, AutoModelForMaskedLM

model_id = "EuroBERT/EuroBERT-210m"


tokenizer = AutoTokenizer.from_pretrained(model_id, local_only=True)
model = AutoModelForMaskedLM.from_pretrained(model_id, local_only=True)

text = "The capital of France is 
."
inputs = tokenizer(text, return_tensors="pt")
outputs = model(**inputs)

# To get predictions for the mask:
masked_index = inputs["input_ids"][0].tolist().index(tokenizer.mask_token_id)
predicted_token_id = outputs.logits[0, masked_index].argmax(axis=-1)
predicted_token = tokenizer.decode(predicted_token_id)
print("Predicted token:", predicted_token)
# Predicted token:  Paris



### Expected behavior

Loading the model.

Comments:
Hi @panwpalo, the code for EuroBERT is contained in the EuroBERT repo, not in `transformers`! I checked and they [merged a fix about 4 hours ago](https://huggingface.co/EuroBERT/EuroBERT-610m/commit/121b08d24828a0a91b7524b9c329020c98fd8329) that should hopefully resolve this problem.
[Utils] torch version checks optionally accept dev versions
Author: gante
Pull request: yes
Labels: name: for patch

# What does this PR do?

TL;DR adds a flag to optionally allow dev versions to pass version checks in `is_torch_greater_or_equal`

## Background

Up until a few days ago, `is_torch_greater_or_equal` diverged from the old `is_torch_greater_or_equal_than_2_X`: the former doesn't accept dev versions (e.g. `2.0.0.dev0123` fails against `is_torch_greater_or_equal(2.0)`) while the latter accepts them (e.g. `2.0.0.dev0123` passes against `is_torch_greater_or_equal_than_2_0`).

https://github.com/huggingface/transformers/pull/36654 standardizes the two, making `is_torch_greater_or_equal` accept dev versions.

However, this is a problem: device-specific images are often built with the dev version as their base version, and a dev version is not guaranteed to have the same features as a released version. For instance, in [this comment](https://github.com/huggingface/transformers/pull/36654#issuecomment-2738246922), the user got an error related to TP imports.

## Solution

Testing against dev is useful: it allows us to prepare features against the next torch release, and have them ready since day 0. As such, this PR adds optionality: we can specify whether we want an import guard excluding dev versions (default) or not.

Comments:
Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. When it is ready for review, please click the `Ready for review` button (at the bottom of the PR page).

@ArthurZucker if we do a v4.50.1 patch, let's include this as well 🙏 

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

@ArthurZucker This change is to fix something we broke last release, yes 😬  Last version, we changed the default check to happen against the base version, which includes all development commits before the actual release. This PR reverts it, but adds a flag to compare against the base version for nightly features.

On most cases the change would be okay but, on special devices (e.g. mobile gpus), the available torch versions are not based on actual releases 😢  This means that their torch "2.5" doesn't include all features released in "2.5", and now they are getting exceptions ([e.g.](https://github.com/huggingface/transformers/pull/36654#issuecomment-2738246922))

Okay thanks for clarifying!
Fix regression compressed-tensors
Author: SunMarc
Pull request: yes

# What does this PR do?

This PR fixes the compressed-tensors model loading as it was broken for some models by this [PR](https://github.com/huggingface/transformers/pull/36152). Impacted models are models with config attribute "quantization_status": "frozen" (e.g. this is the case for the FP8 model) because we defaulted `run_compressed` to be `True` in the config. Thus, it triggers an error immediately. 

Fixes https://github.com/huggingface/transformers/issues/36915

To reproduce: 

```python 
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("neuralmagic/Meta-Llama-3.1-8B-FP8")
model = AutoModelForCausalLM.from_pretrained("neuralmagic/Meta-Llama-3.1-8B-FP8")
```

Also maybe we shouldn't run the model with `run_compressed` in the case the model is frozen, but for the fp8 model, the weights are actually in fp8 format.


Comments:
Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. When it is ready for review, please click the `Ready for review` button (at the bottom of the PR page).

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

cc @rahul-tuli
ValueError: `run_compressed` is only supported for quantized_compressed models
Author: CanYing0913
Pull request: no
Labels: name: bug

### System Info

- `transformers` version: 4.50.0
- Platform: Linux-6.11.0-19-generic-x86_64-with-glibc2.39
- Python version: 3.10.16
- Huggingface_hub version: 0.29.3
- Safetensors version: 0.5.3
- Accelerate version: 1.5.2
- Accelerate config:    not found
- DeepSpeed version: not installed
- PyTorch version (GPU?): 2.6.0+cu124 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using distributed or parallel set-up in script?: <fill in>
- Using GPU in script?: <fill in>
- GPU type: NVIDIA GeForce RTX 3090

### Who can help?

@SunMarc  @MekkCyber 

### Information

- [ ] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

1. Install transformers v4.50
2. run the following:
```
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("neuralmagic/Meta-Llama-3.1-8B-FP8")
model = AutoModelForCausalLM.from_pretrained("neuralmagic/Meta-Llama-3.1-8B-FP8")
```
3. Got the result:
```
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/canying/miniforge3/envs/apq/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 573, in from_pretrained
    return model_class.from_pretrained(
  File "/home/canying/miniforge3/envs/apq/lib/python3.10/site-packages/transformers/modeling_utils.py", line 272, in _wrapper
    return func(*args, **kwargs)
  File "/home/canying/miniforge3/envs/apq/lib/python3.10/site-packages/transformers/modeling_utils.py", line 4422, in from_pretrained
    hf_quantizer.preprocess_model(
  File "/home/canying/miniforge3/envs/apq/lib/python3.10/site-packages/transformers/quantizers/base.py", line 215, in preprocess_model
    return self._process_model_before_weight_loading(model, **kwargs)
  File "/home/canying/miniforge3/envs/apq/lib/python3.10/site-packages/transformers/quantizers/quantizer_compressed_tensors.py", line 121, in _process_model_before_weight_loading
    raise ValueError("`run_compressed` is only supported for quantized_compressed models")
ValueError: `run_compressed` is only supported for quantized_compressed models
```

### Expected behavior

Using `transformers==4.47.0` and `transformers==4.49.0` resolves the issue. Is this a bug in the new version, or there are changes the model maintainer need to update its model accordingly?

Comments:
Thanks for the report ! This will be fixed here : https://github.com/huggingface/transformers/pull/36921


Hi @CanYing0913 

We'll likely have to update the model as it was saved incorrectly.
A temporary workaround would be to update the model's config.json, changing the status from `frozen` to `compressed`

Thanks!

@dsikka @SunMarc Thanks for the help!

Since the models config have been updated, I will close this issue !
Install `networkx==3.2.1` manually in some CircleCI jobs after #36957
Author: ydshieh
Pull request: yes

# What does this PR do?

Use `pip install networkx==3.2.1` in CircleCI config file to avoid some failures. Have no ideas why however.

Comments:
Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. The CI will be paused while the PR is in draft mode. When it is ready for review, please click the `Ready for review` button (at the bottom of the PR page). This will assign reviewers and trigger CI.

> Glad to have everything green again 🙏 migh be important to dig into the issue if you have the time to avoid similar stuff in the future!

I am guilty that I didn't build the new images and run the tests in #36957, I trusted `uv` but I feel being betrayed by it

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

Use `torch.expm1(x)` instead of `torch.exp(x) - 1`. It is more accurate for small values of `x`.

Comments:
Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. The CI will be paused while the PR is in draft mode. When it is ready for review, please click the `Ready for review` button (at the bottom of the PR page). This will assign reviewers and trigger CI.
Fix tensor dtype mismatch
Author: cyyever
Pull request: yes


Comments:
Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. The CI will be paused while the PR is in draft mode. When it is ready for review, please click the `Ready for review` button (at the bottom of the PR page). This will assign reviewers and trigger CI.

The tests are failing due to `AssertionError: Tensor-likes are not close!`. I will update the expected values (from our runner) and merge the PR. Thank you again!
Fix Optional type annotation
Author: cyyever
Pull request: yes

# What does this PR do?
Add Optional to some annotations for None default values.


## 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?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


## Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

<!-- Your PR will be replied to more quickly if you can figure out the right person to tag with @

 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.

Models:

- text models: @ArthurZucker
- vision models: @amyeroberts, @qubvel
- speech models: @eustlb
- graph models: @clefourrier

Library:

- flax: @gante and @Rocketknight1
- 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 @MekkCyber

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: @Rocketknight1
- PyTorch: See Models above and tag the person corresponding to the modality of the example.
- TensorFlow: @Rocketknight1

 -->


Comments:
Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. When it is ready for review, please click the `Ready for review` button (at the bottom of the PR page).
Fix get_device_properties
Author: ivarflakstad
Pull request: yes

Made a woopsie during a final refactoring

Comments:
Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. The CI will be paused while the PR is in draft mode. When it is ready for review, please click the `Ready for review` button (at the bottom of the PR page). This will assign reviewers and trigger CI.

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_36997). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Fix removing "cpu" from frozenset in bitsandbytes.py to allow better ROCm support.
Author: anadon
Pull request: yes

Related to https://github.com/bitsandbytes-foundation/bitsandbytes/issues/1573 and https://github.com/huggingface/transformers/issues/36949 , this resolves a bug in the biteandbytes integration, allowing ROCm/HIP support in bitsandbytes.

# What does this PR do?

Aims to fix a bug in the bitsandbytes integration on line 499 which used `frozenset.discard()`, which is not a existent function from frozenset.  This should better allow ROCm/HIP support.

Fixes #36949

## Who can review?

@SunMarc @MekkCyber

Comments:
Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. The CI will be paused while the PR is in draft mode. When it is ready for review, please click the `Ready for review` button (at the bottom of the PR page). This will assign reviewers.

Sorry about that!

Before getting merged, I'd like the bitsandbytes group to perform additional testing.


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