noamaanMulla-03/transformers-issues huggingface dataset:
Issue in resuming finetuning Llama 3.1 Instruct Model
Author: Rishav-hub
Pull request: no

When I run the below script, I am not able to resume it.

trainer.train(resume_from_checkpoint = "/content/drive/MyDrive/001_projects/exigent/Contract Management and Extraction (CME)/main_data/001_CML_3/CMS_models/phase_6/llama_models/tuning_Llama_3-1_8B_instruct_phase_6_exp_with_sys_prompt/checkpoint-21450/") # tuning_Llama_3-1_8B_instruct_phase_6_exp_with_sys_prompt


```
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-61-9126eb228050>](https://localhost:8080/#) in <cell line: 0>()
----> 1 trainer.train(resume_from_checkpoint = "/content/drive/MyDrive/001_projects/exigent/Contract Management and Extraction (CME)/main_data/001_CML_3/CMS_models/phase_6/llama_models/tuning_Llama_3-1_8B_instruct_phase_6_exp_with_sys_prompt/checkpoint-21450/") # tuning_Llama_3-1_8B_instruct_phase_6_exp_with_sys_prompt

2 frames
[/usr/local/lib/python3.11/dist-packages/trl/trainer/sft_trainer.py](https://localhost:8080/#) in train(self, *args, **kwargs)
    449             self.model = self._trl_activate_neftune(self.model)
    450 
--> 451         output = super().train(*args, **kwargs)
    452 
    453         # After training we make sure to retrieve back the original forward pass method

[/usr/local/lib/python3.11/dist-packages/transformers/trainer.py](https://localhost:8080/#) in train(self, resume_from_checkpoint, trial, ignore_keys_for_eval, **kwargs)
   2134         if resume_from_checkpoint is not None:
   2135             if not is_sagemaker_mp_enabled() and not self.is_deepspeed_enabled and not self.is_fsdp_enabled:
-> 2136                 self._load_from_checkpoint(resume_from_checkpoint)
   2137             # In case of repeating the find_executable_batch_size, set `self._train_batch_size` properly
   2138             state = TrainerState.load_from_json(os.path.join(resume_from_checkpoint, TRAINER_STATE_NAME))

[/usr/local/lib/python3.11/dist-packages/transformers/trainer.py](https://localhost:8080/#) in _load_from_checkpoint(self, resume_from_checkpoint, model)
   2842                     if hasattr(model, "active_adapters"):
   2843                         active_adapters = model.active_adapters
-> 2844                         if len(active_adapters) > 1:
   2845                             logger.warning("Multiple active adapters detected will only consider the first adapter")
   2846                         active_adapter = active_adapters[0]

TypeError: object of type 'method' has no len()

```

Comments:
Hi @Rishav-hub, you'll need to provider a reproducer script that we can run for us to diagnose this one!

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.
AMD CI tracking issue
Author: ivarflakstad
Pull request: no

Tracking issue for efforts related to CI running on AMD hardware.

Intended to record overall progress.

### Status

CI on AMD is running.
There are several different categories of failed tests that need to be addressed.

It's worth noting that many of these failed tests are not due to bugs, but rather that the test case is opinionated. For example a test can fail because the expected logits do not match the result, but different hardware can produce different logits and still be correct.
This is known to transformers and techniques to address this are already in place.

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.
Cannot load siglip2 processor
Author: hello-peiqi
Pull request: no
Labels: name: bug

### System Info

`processor = AutoProcessor.from_pretrained("google/siglip2-base-patch16-224")` raises 
```
File ~/miniforge3/envs/*/lib/python3.10/site-packages/transformers/models/siglip/tokenization_siglip.py:139, in SiglipTokenizer.get_spm_processor(self)
    137 def get_spm_processor(self):
    138     tokenizer = spm.SentencePieceProcessor(**self.sp_model_kwargs)
--> 139     with open(self.vocab_file, "rb") as f:
    140         sp_model = f.read()
    141         model_pb2 = import_protobuf()

TypeError: expected str, bytes or os.PathLike object, not NoneType
```

I tried few latest transformers versions but none of them works.

### 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 AutoProcessor, AutoModel
processor = AutoProcessor.from_pretrained("google/siglip2-base-patch16-224")
```

### Expected behavior

```
File ~/miniforge3/envs/*/lib/python3.10/site-packages/transformers/models/siglip/tokenization_siglip.py:139, in SiglipTokenizer.get_spm_processor(self)
    137 def get_spm_processor(self):
    138     tokenizer = spm.SentencePieceProcessor(**self.sp_model_kwargs)
--> 139     with open(self.vocab_file, "rb") as f:
    140         sp_model = f.read()
    141         model_pb2 = import_protobuf()

TypeError: expected str, bytes or os.PathLike object, not NoneType
```

Comments:
Same issue here. Tried both `4.49.0` and `4.41.2`. Don't get this issue with SigLip v1

> Same issue here. Tried both `4.49.0` and `4.41.2`. Don't get this issue with SigLip v1

Tried these two versions but still got the problem. 

Same here

https://github.com/huggingface/transformers/issues/36475 Try this.

PR shared by @Sierkinhane works for me! Close this issue.
Unable to load siglip2
Author: PlatJack
Pull request: no
Labels: name: bug

### System Info

- `transformers` version: 4.50.0.dev0
- Platform: macOS-14.7.2-arm64-arm-64bit-Mach-O
- Python version: 3.13.1
- Huggingface_hub version: 0.27.1
- Safetensors version: 0.5.2
- Accelerate version: 1.3.0
- Accelerate config:    not found
- DeepSpeed version: not installed
- PyTorch version (GPU?): 2.6.0 (False)
- 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?: No

### Who can help?

@qubvel 

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

from transformers import AutoProcessor, AutoModel

model = AutoModel.from_pretrained("google/siglip2-base-patch16-naflex").eval()
processor = AutoProcessor.from_pretrained("google/siglip2-base-patch16-naflex")

### Expected behavior

The model should get loaded.

Comments:
Hi, I'm also running into this issue. How did you fix this?

> Hi, I'm also running into this issue. How did you fix this?

Actually I just realised I was using another virtual environment in which I hadn't updated the transformers package. As soon as I switched to the one which I needed to use, the model loading started working.

Thanks for the response! Could I please ask what version of transformers is working for you?
On MoE implementation in HuggingFace
Author: Neo9061
Pull request: no

On the Mixtral MoE implementation, I saw it mentioned that it is equivalent to `standard MoE with full capacity (no
    dropped tokens)`. I just wonder where the token dropless logic is implemented?

Code reference: https://github.com/huggingface/transformers/blob/2c2495cc7b0e3e2942a9310f61548f40a2bc8425/src/transformers/models/mixtral/modeling_mixtral.py#L89C28-L90C20

CC @ArthurZucker if you have any insights. Thank you!


Comments:
Hey! The doc is probably a bit outdated / was I think copy pasted from original code! 
But basically as you can see on the code, there is no `capacity` and there is no `dropout`, so all tokens get assign to an expert. 

I'll close this as it's not a bug but we can keep the conversation 😉
🚨🚨🚨 Fix sdpa in sam and refactor relative position embeddings
Author: geetu040
Pull request: yes
Labels: name: Vision

# What does this PR do?

This PR
- fixes `SamVisionSdpaAttention` when `output_attentions=True`, fall back to eager implementation
- refactors position embeddings in both attention layers to a single function
- fixes tensorflow related tests: [runs/13544413658](https://github.com/huggingface/transformers/actions/runs/13544413658)
- reflects these changes in `TFSamVisionSdpaAttention` and `GotOcr2VisionAttention`

Previously discussed here: https://github.com/huggingface/transformers/pull/36248#issuecomment-2684436952

### 🚨 Breaking changes

`add_decomposed_rel_pos` public method of `*Attention` module was replaced with `get_decomposed_rel_pos` method, which will return pos embedding instead of adding it to the attention weights

## Who can review?

@amyeroberts, @qubvel, @zucchini-nlp 


Comments:
Hi @geetu040, thanks for opening the PR!

run-slow: sam

This comment contains run-slow, running the specified jobs: This comment contains run-slow, running the specified jobs:

models: ['models/sam']
quantizations: [] ...

run-slow: sam

Hi @qubvel , I have fixed the failing tests at [runs/13544413658](https://github.com/huggingface/transformers/actions/runs/13544413658). This PR is ready for review now and can you please run slow tests again?

run-slow: sam

This comment contains run-slow, running the specified jobs: This comment contains run-slow, running the specified jobs:

models: ['models/sam']
quantizations: [] ...

@qubvel the custom tests have passed now, the failing ones seem unrelated

Nice! Thanks for fixing

Lets wait for those tests being fixed on main, and then merge it

cc @ArthurZucker for approval: changing `add_decomposed_rel_pos` to `get_decomposed_rel_pos`, which is a public method of a module

@ArthurZucker a soft ping, since this blocks the failing tests in other PRs: https://github.com/huggingface/transformers/pull/36248, https://github.com/huggingface/transformers/pull/36493

Hi @qubvel, would it be possible to ping someone else for this? It seems that @ArthurZucker is quite busy and might not have had a chance to review it.  

Since this is blocking other PRs (https://github.com/huggingface/transformers/pull/36248 and https://github.com/huggingface/transformers/pull/36493), it would be great if we could get it merged. Otherwise, if this will take some time, I can merge this branch into the other PRs and continue working from there.  

cc @molbap or @zucchini-nlp if you have bandwidth

Added a section in PR initial message with breaking change description, merging
enable/disable compile for quants methods
Author: SunMarc
Pull request: yes

# What does this PR do ? 

This PR disables compile if the quantization method do not support it. List to be found [here](https://huggingface.co/docs/transformers/en/quantization/overview). Need to add follow up PRs to allow compile or not for each method + add tests. Only torchao and bnb have the tests for now. 

Fixes https://github.com/huggingface/transformers/issues/36485#issuecomment-2694752380

cc @gante let me know what you think about that. I wanted to still have an easy way to not `disable_compile` if we wanted.

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

Thanks @SunMarc! This was on my mind as I ran into this last week :)

Let me know if this is better @gante !
Add GGUF support to T5-Encoder
Author: Isotr0py
Pull request: yes

# What does this PR do?

Fixes https://github.com/huggingface/transformers/pull/33389#issuecomment-2718782338
- [x] Add GGUF support to T5-encoder
- [ ] Add model conversion test


## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [ ] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#create-a-pull-request),
      Pull Request section?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


## Who can review?

@SunMarc @MekkCyber

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:
Thanks @Isotr0py SG 🔥  ! Just have a small question

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

Hi @SunMarc . I don't know why this code has been removed since there are many models overwrite the generate method. This PR fixed this kind of model. The following codes will be break without this PR:
```python
from transformers import pipeline

pipe = pipeline("text-to-speech", "suno/bark")
pipe("hello")
```

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).

It seems that we also need to change tests. I'd like to have your opinion on it. Should we skip the tests or refactor the custom generate? cc @gante 

Not sure too, I couldn't find the PR that removed it so tagging @gante 

Hi there 👋 

The docstring of `can_generate` was clarified more recently to
```
Returns whether this model can generate sequences with `.generate()` from the `GenerationMixin`.
```

This is not the always case for Bark, which doesn't share functionality with `GenerationMixin` in some classes. There is bug, however -- Bark requires a generation config, and we usually don't load a generation config when `can_generate()` returns `False`. I'm looking into a workaroud.

@jiqing-feng #36587 should be merged instead 🤗 

> @jiqing-feng #36587 should be merged instead 🤗


@gante  @SunMarc 
Thanks! I fixed more models by your method and also add tests to avoid it breaks in the future.

Please review this change.

Hi @gante . Already fixed!

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

Hi @gante @SunMarc . Can we merge this PR?
[MINOR:TYPO] Update hubert.md
Author: cakiki
Pull request: yes

- typo fix (wave2vec instead of hubert)
- make code snippet copiable and runnable

# What does this PR do?

- Fix typo (wave2vec instead of hubert)
- Make code snippet copiable and runnable (torch wasn't imported and `device` wasn't set)

## Before submitting
- [x] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [ ] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#create-a-pull-request),
      Pull Request section?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


## Who can review?

@stevhliu @Vaibhavs10 

<!-- 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).

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_36733). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
[CI] remove redundant checks in `test_eager_matches_sdpa_inference`
Author: gante
Pull request: yes

# What does this PR do?

Follow-up to #36650 

Removes redundant test cases in `test_eager_matches_sdpa_inference`, related to `output_attentions`.

SDPA has special attention mask preparation (e.g. see [here](https://github.com/huggingface/transformers/blob/e3af4fec91bdac3381e07f6e60fb8b74c3957c11/src/transformers/models/llama/modeling_llama.py#L657)) but, when we pass `output_attentions`, SDPA reverts to eager attention. That means that mask preparation for SDPA + `output_attentions` must be the same as eager. In #30652 we added a `for` loop to test the cases with `output_attentions in (True, False)`, resulting in 24 new subtests. 

That's testing overkill, all we need to check is to confirm that we're preparing the attention mask correctly with `output_attentions=True`. This PR removes all but 1 of the redundant tests.

@ydshieh with this PR, both CPU and GPU CI is faster than in `v4.49.0` 🤗 

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

Added a code link in the PR header for the special attention mask manipulation with SDPA + `output_attentions=True`, for future reference 👍
[docs] Update README
Author: stevhliu
Pull request: yes

- Updates README to include more recent models for tasks
- Rearranges order of the sections to be more logical (installation -> quickstart)
- Hides some examples in dropdown menus to keep the doc clean
- Removes the [Learn more](https://github.com/huggingface/transformers#learn-more) section since the docs will be refactored soon

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

Merging now and we can update later :)