noamaanMulla-03/transformers-issues huggingface dataset:
[i18n-<Transformers>] Translating docs to <Tibetain>
Author: OSUer600
Pull request: no
Labels: name: WIP

<!--
Note: Please search to see if an issue already exists for the language you are trying to translate.
-->

Hi!

Let's bring the documentation to all the <languageName>-speaking community 🌐 (currently 0 out of 267 complete)

Who would want to translate? Please follow the 🤗 [TRANSLATING guide](https://github.com/huggingface/transformers/blob/main/docs/TRANSLATING.md). Here is a list of the files ready for translation. Let us know in this issue if you'd like to translate any, and we'll add your name to the list.

Some notes:

* Please translate using an informal tone (imagine you are talking with a friend about transformers 🤗).
* Please translate in a gender-neutral way.
* Add your translations to the folder called `<languageCode>` inside the [source folder](https://github.com/huggingface/transformers/tree/main/docs/source).
* Register your translation in `<languageCode>/_toctree.yml`; please follow the order of the [English version](https://github.com/huggingface/transformers/blob/main/docs/source/en/_toctree.yml).
* Once you're finished, open a pull request and tag this issue by including #issue-number in the description, where issue-number is the number of this issue. Please ping @stevhliu and @MKhalusova for review.
* 🙋 If you'd like others to help you with the translation, you can also post in the 🤗 [forums](https://discuss.huggingface.co/).

## Get Started section

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

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

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


Comments:
mobilebert model card update
Author: Reshan123
Pull request: yes

# What does this PR do?
As suggested in this issue - [Model cards #36979](https://github.com/huggingface/transformers/issues/36979) - this PR updates the documentation of the MobileBERT model, which will now be aligned with the standardized format for all the docs.

## Who can review?
@stevhliu, please let me know if any changes are needed

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_37256). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Updated T5 model card with standardized format
Author: ShararehY
Pull request: yes

# What does this PR do?

Updated T5 model card with standardized format

Fixes #36979


## 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?
- [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?

 @stevhliu



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.

Hi @stevhliu , Thanks for the suggestions! I applied the changes, could you please review it again?

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_37261). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Improving expected test results
Author: ivarflakstad
Pull request: no

Several tests use the concept of "expected" results.
Sometimes the expected results are dependant on the environment.

We've used `torch.cuda.get_device_capability()` to differentiate between different cuda environments, and this has worked fairly well so far.
I recently started adding expected results for AMD devices ([ref](https://github.com/huggingface/transformers/pull/36535/files)) and realized we will be running into conflicts fairly soon and so we need a better approach.

My idea is to add a couple of utility concepts that can make expected results more generic.
The current solution is basically this:
```python
result = "2"
major, minor = torch.cuda.get_device_capability()
EXPECTED_RESULTS= {
    8: "1",
    9: "2",
}
assert result == EXPECTED_RESULTS[major]
```
I want to end up with functionality that looks like this:
```python
result = "2"
expectations = Expectations(
    Expectation.default("1"),
    Expectation(Properties("cuda", 8, 1), "2"),
    Expectation(Properties("cuda", 7, 0), "3"),
    Expectation(Properties("rocm"), "4"),
)
expected = expectations.find_expected()
assert result == expected.result
```
This is a best effort approach. If we are on cuda 7.5 we get "3", but if we are on rocm 7.0 we should get "4".
The `default` case should apply if the best result has a score of 0. In other words if we are on xpu we get "1".

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.
Revert #37031
Author: Cyrilvallez
Pull request: yes

# What does this PR do?

https://github.com/huggingface/transformers/pull/37031 caused much much longer loading times (see https://github.com/huggingface/transformers/issues/37160) basically causing going from ~3/4 min to 10+ hours for Deepseek R1.

I'm fully reverting for now.
I think (not completely sure) the issue is actually accessing the state dict over and over again, not so much the cloning (copying). I will investigate it later to see if I can re-add the fix without time overhead.

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_37178). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Thanks! Feel like it is from

> data_ptrs.add(model.state_dict()[param_name].data_ptr())

I might have an idea of fix. Will see later today or tomorrow.

The issue is probably that we are accessing the `state_dict` over and over again. DId you try to store the state_dict before the loop ?
Hf Xet extra
Author: LysandreJik
Pull request: yes

Adds the extra for hf_xet

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.

Will merge once green w/ offline approval from @ArthurZucker 

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

# What does this PR do?

As suggested in this issue - https://github.com/huggingface/transformers/issues/36979#issue-2947704577 - this PR updates the documentation of the ColPali model, which will now be aligned with the standardized format for all the docs.


## Who can review?

@stevhliu, please let me know if any changes are needed.


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 deepspeed loading (part 2)
Author: Cyrilvallez
Pull request: yes

# What does this PR do?



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_37306). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
feat: added hive model
Author: dustinwloring1988
Pull request: yes

Added a new model that I am working on. It will be trained on crowd sourced GPU compute.


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.
where can I download the pre-trained pytorch_model.bin files ? 
Author: Deep1994
Pull request: no

# ❓ Questions & Help

<!-- The GitHub issue tracker is primarly intended for bugs, feature requests,
     new models and benchmarks, and migration questions. For all other questions,
     we direct you to the Hugging Face forum: https://discuss.huggingface.co/ .
     You can also try Stack Overflow (SO) where a whole community of PyTorch and
     Tensorflow enthusiast can help you out. In this case, make sure to tag your
     question with the right deep learning framework as well as the
     huggingface-transformers tag: 
     https://stackoverflow.com/questions/tagged/huggingface-transformers 
     -->

## Details
<!-- Description of your issue -->

<!-- You should first ask your question on the forum or SO, and only if
     you didn't get an answer ask it here on GitHub. -->
**A link to original question on the forum/Stack Overflow**:

Comments:
You can go to the model hub, click on a model and select "List all files in model". These are links to the files.
![download_model](https://user-images.githubusercontent.com/30755778/92567770-2cb95080-f24c-11ea-88c1-008e98556a0e.gif)



hello
Lama4 scout. Any chance it could ever be in the browser?
Author: hpssjellis
Pull request: no
Labels: name: Feature request

### Feature request

@xenova  can the new 17B Lama 4 scout be loaded in the browser or is it much to big?  

here is the huggingface collrection:  

https://huggingface.co/collections/meta-llama/llama-4-67f0c30d9fe03840bc9d0164



### Motivation

Just a new model that might be able to load in the browser, but probably not

### Your contribution

I would make it more user friendly if it works. 

Already done a bunch

https://hpssjellis.github.io/my-examples-of-transformersJS/public/index.html

Comments:
Unable to save model after training with tensor parallel
Author: bursteratom
Pull request: no
Labels: name: bug

### System Info

Currently, attempting to save model after training with tensor parallel gives the `RuntimeError: Attempted to access the data pointer on an invalid python storage`, this is due to the state dict not properly gathered from the sharded tensors beforehand. 

Fix here: https://github.com/huggingface/transformers/pull/36434

![Image](https://github.com/user-attachments/assets/5a0052e2-548c-4486-977d-8c7c37d2bee9)

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

Train the model with tensor parallelism by parsing `tp_size >=2` into the trainer, make sure to specify `output_dir` for the model saving directory.

### Expected behavior

Model is saved upon completion of training.

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.
Issue with update
Author: rwood-97
Pull request: no
Labels: name: bug

### System Info

Ubuntu-latest, Windows-latest, python 3.12 and python 3.9



### Who can help?

Getting an error when running tests after update:

```
RuntimeError: Failed to import transformers.models.auto.feature_extraction_auto because of the following error (look up to see its traceback):
Failed to import transformers.generation.utils because of the following error (look up to see its traceback):
register_pytree_node() got an unexpected keyword argument 'flatten_with_keys_fn'
```

See [here](https://github.com/maps-as-data/MapReader/actions/runs/13898246744/job/39187701473) for recent rerun of previously passing test and then [here](https://github.com/maps-as-data/MapReader/actions/runs/13898246744/attempts/1) for the original passing test from a few days ago

Also see [here](https://github.com/maps-as-data/MapReader/pull/559) for recent PR showing all 4 matrix runs.

### Information

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

### Tasks

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

### Reproduction

Run tests as per github workflow file here: https://github.com/maps-as-data/MapReader/actions/runs/13898246744/workflow[](url)

### Expected behavior

Tests should pass as per [attempt 1](https://github.com/maps-as-data/MapReader/actions/runs/13898246744/attempts/1)  from a few days ago.

Comments:
I have exactly the same problem.

same problem i see too on linux. the problem seems to be with newest version 4.50.0 only. you can downgrade to 4.49.0 instead...

ValueError: The checkpoint you are trying to load has model type `gemma3` but Transformers does not recognize this architecture. This could be because of an issue with the checkpoint, or because your version of Transformers is out of date.

> same problem i see too on linux. the problem seems to be with newest version 4.50.0 only. you can downgrade to 4.49.0 instead...



I can confirm 4.49.0 works, 4.50.0 gives that error on linux.

> I can confirm 4.49.0 works, 4.50.0 gives that error on linux.

Hmmm weird my python cannot find it in 4.49, thank you for confirming

I've just added `!=4.50.0` to my setup.py and its now passing as expected:
https://github.com/maps-as-data/MapReader/commit/1f390cd5ce9d4671c9eedc975beb19f5b2b1eb6a


Thanks for reporting! The issue is in torch version - `flatten_with_keys_fn` is a valid keyword arg only from 2.3.0. I will open a PR to fix it

> I've just added `!=4.50.0` to my setup.py and its now passing as expected: [maps-as-data/MapReader@1f390cd](https://github.com/maps-as-data/MapReader/commit/1f390cd5ce9d4671c9eedc975beb19f5b2b1eb6a)

ye, i just use another version `pip install transformers==4.41.0` , it's also ok now

> same problem i see too on linux. the problem seems to be with newest version 4.50.0 only. you can downgrade to 4.49.0 instead...

I actually upgraded my 4.50.0 to  4.51.0. Now it's working.
Feat add hive model
Author: dustinwloring1988
Pull request: yes

added hive model a model trainied with crowd source gpu compute

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 test device spec relative path importing issue
Author: yao-matrix
Pull request: yes

**Symptom**
when run unit test `pytest -rA tests/deepspeed/test_deepspeed.py::TestDeepSpeedWithLauncher::test_clm_from_config_zero3_fp16` on XPU with `spec_xpu.py` by following this [doc](https://huggingface.co/docs/transformers/en/testing). Error with below log

> stderr: Traceback (most recent call last):
> stderr:   File "/.tests/transformers/examples/pytorch/language-modeling/run_clm.py", line 51, in <module>
> stderr:     from transformers.testing_utils import CaptureLogger
> stderr:   File "/.tests/transformers/src/transformers/testing_utils.py", line 2869, in <module>
> stderr:     device_spec_module = importlib.import_module(import_name)
> stderr:   File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
> stderr:     return _bootstrap._gcd_import(name[level:], package, level)
> stderr: ModuleNotFoundError: No module named 'spec_xpu' 

**Root Cause**
since `export TRANSFORMERS_TEST_DEVICE_SPEC="spec_xpu.py"` cannot adding absolute path by testing design, there is a implication that pytest cases are running in transformers root directory. While in this deepspeed case, one process will be launched by deepspeed in `tests/deepspeed` directory which break this assumption, so it cannot find `spec_xpu` module in its current folder(tests/deepspeed) or in PYTHONPATH, then the error arose.

**My Fix**
append `device_spec_dir` to `sys.path`.


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.

Makes sense to me but cc @ydshieh

LGTM, as long as it fixes the issue you mentioned. Could you also try another XPU test that is normally work with current transformers version, and make sure it still work with this PR? 

Thank you for contributing!

> LGTM, as long as it fixes the issue you mentioned. Could you also try another XPU test that is normally work with current transformers version, and make sure it still work with this PR?
> 
> Thank you for contributing!

I randomly picked a case `pytest -rA tests/models/emu3/test_modeling_emu3.py::Emu3IntegrationTest::test_model_generation` and it passed on XPU, so no regression here.

the ci failure seems not related to my change.
enable 2 types of case on XPU
Author: yao-matrix
Pull request: yes

enable 2 types of case on XPU:
1. test_resize_tokens_embeddings_with_deepspeed_multi_gpu
2. test_resize_embeddings_untied_with_deepspeed_multi_gpu

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.

cc @ydshieh
Device Movement Error with 4-bit Quantized LLaMA 3.1 Model Loading
Author: Pritidhrita
Pull request: no

### System Info

```shell
I'm running into a persistent issue when trying to load the LLaMA 3.1 8B model with 4-bit quantization. No matter what configuration I try, I get this error during initialization:

pgsql
Copy
CopyValueError: `.to` is not supported for `4-bit` or `8-bit` bitsandbytes models. Please use the model as it is, since the model has already been set to the correct devices and casted to the correct `dtype`.
```

### Information

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

### Tasks

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

### Reproduction

Environment:

Python: 3.10
Transformers: Latest version
PyTorch: Latest version
GPU: 85.05 GB memory available
CUDA: Properly installed and available
What I've tried:

Loading with a BitsAndBytesConfig:
python
Copy
bnb_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_use_double_quant=True,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_compute_dtype=torch.float16,
    llm_int8_has_fp16_weight=True
)

base_model = AutoModelForCausalLM.from_pretrained(
    "meta-llama/Llama-3.1-8B-Instruct",
    quantization_config=bnb_config,
    trust_remote_code=True,
    use_cache=True,
    device_map='auto',
    max_memory={0: "24GiB"}
)
Loading without device mapping:
python
Copy
model_kwargs = {
    "trust_remote_code": True,
    "load_in_4bit": True,
    "torch_dtype": torch.float16,
    "use_cache": True
}

### Expected behavior

```shell
Clearing CUDA cache and running garbage collection beforehand.
Experimenting with different device mapping strategies.
Even with an ample GPU memory (85.05 GB) and confirmed CUDA availability, I still can't seem to get the model to load without running into this device movement error. Other models load fine when using quantization, so I'm not sure what's special about this setup.

Any ideas on how to resolve this or work around the error? Thanks in advance for your help!
```

### Checklist

- [x] I have read the migration guide in the readme. ([pytorch-transformers](https://github.com/huggingface/transformers#migrating-from-pytorch-transformers-to-transformers); [pytorch-pretrained-bert](https://github.com/huggingface/transformers#migrating-from-pytorch-pretrained-bert-to-transformers))
- [ ] I checked if a related official extension example runs on my machine.

Comments:
cc @SunMarc @muellerzr 

try to use the latest transformers and bitsandbytes, but the model should load correctly as your script looks good. 

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.