We now require users to upgrade torch to at least v2.6 in order to use the function.
Author: mattdornfeld
Pull request: no
Labels: name: bug

### System Info

Ran into this bug https://github.com/huggingface/transformers/issues/38329. Tried installing from main to get access to this fix https://github.com/huggingface/transformers/pull/38376, but ran into this bug

```
(python) MacBookPro~/projects/bastet[embedding_app_python L|✚2…1] % python3 embeddingApp/embedding_app/main.py
Traceback (most recent call last):
  File "/Users/matthewdornfeld/projects/bastet/embeddingApp/embedding_app/main.py", line 30, in <module>
    model: EmbeddingModel = create_embedding_model()
                            ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matthewdornfeld/projects/bastet/embeddingApp/embedding_app/utils.py", line 9, in create_embedding_model
    return SentenceTransformer(configs.EMBEDDING_MODEL_NAME, cache_folder=str(configs.EMBEDDING_MODEL_CACHE_DIR))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matthewdornfeld/projects/bastet/embeddingApp/build/python/lib/python3.11/site-packages/sentence_transformers/SentenceTransformer.py", line 309, in __init__
    modules, self.module_kwargs = self._load_sbert_model(
                                  ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matthewdornfeld/projects/bastet/embeddingApp/build/python/lib/python3.11/site-packages/sentence_transformers/SentenceTransformer.py", line 1824, in _load_sbert_model
    module = module_class.load(module_path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matthewdornfeld/projects/bastet/embeddingApp/build/python/lib/python3.11/site-packages/sentence_transformers/models/CLIPModel.py", line 98, in load
    return CLIPModel(model_name=input_path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matthewdornfeld/projects/bastet/embeddingApp/build/python/lib/python3.11/site-packages/sentence_transformers/models/CLIPModel.py", line 18, in __init__
    self.model = transformers.CLIPModel.from_pretrained(model_name)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matthewdornfeld/projects/bastet/embeddingApp/build/python/lib/python3.11/site-packages/transformers/modeling_utils.py", line 314, in _wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matthewdornfeld/projects/bastet/embeddingApp/build/python/lib/python3.11/site-packages/transformers/modeling_utils.py", line 4695, in from_pretrained
    ) = cls._load_pretrained_model(
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matthewdornfeld/projects/bastet/embeddingApp/build/python/lib/python3.11/site-packages/transformers/modeling_utils.py", line 4954, in _load_pretrained_model
    load_state_dict(checkpoint_files[0], map_location="meta", weights_only=weights_only).keys()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matthewdornfeld/projects/bastet/embeddingApp/build/python/lib/python3.11/site-packages/transformers/modeling_utils.py", line 559, in load_state_dict
    check_torch_load_is_safe()
  File "/Users/matthewdornfeld/projects/bastet/embeddingApp/build/python/lib/python3.11/site-packages/transformers/utils/import_utils.py", line 1417, in check_torch_load_is_safe
    raise ValueError(
ValueError: Due to a serious vulnerability issue in `torch.load`, even with `weights_only=True`, we now require users to upgrade torch to at least v2.6 in order to use the function. This version restriction does not apply when loading files with safetensors.
```

I am on an x86 Mac and cannot upgrade to Torch 2.6

```
(python) MacBookPro~/projects/bastet % pip3 install torch==2.6.0
ERROR: Could not find a version that satisfies the requirement torch==2.6.0 (from versions: 2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.1.2, 2.2.0, 2.2.1, 2.2.2)
ERROR: No matching distribution found for torch==2.6.0
```

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

1. Install from main, version 4.1.0, 3.4.0, or 2.7.0 in PyPi. It seems like this change was pushed to every version?
2. Attempt to load SentenceTransformer("clip-ViT-B-32", cache_folder="/tmp/cache")
### Expected behavior

SentenceTransformer should load the clip model without a bug

Comments:
@mattdornfeld can you check with poetry or uv ?

Can you share the script to replicate

Hi @mattdornfeld, unfortunately there are security risks when loading PyTorch format checkpoints on older versions of Torch, so we probably won't remove that requirement! You should probably convert the checkpoint you want to `safetensors` by loading + resaving it (you can load/resave it with an older version of Transformers, or on a machine that can install Torch 2.6, e.g. Colab). Safetensors does not have these security risks, and is the default and recommended format for saving and loading model weights in modern `transformers`.

Hi, 
I am also experiencing this issue, however, I have Torch 2.6.0 installed. 

Specifically, I have Torch `2.6.0.dev20241112` build for mac m4 mps (verified in pip list as well as in the jupyter notebook below).

Running the following in jupyter notebook
```python
print( transformers.utils.import_utils.get_torch_version() )
print( transformers.utils.import_utils.is_torch_greater_or_equal("2.6") )
```
which outputs
```
2.6.0.dev20241112
False
```

Is this about my local torch version or the model being loaded?

Please let me know if I need to create a separate issue for this problem.

@mahimairaja @Rocketknight1 here is a minimum reproducible example. I'm getting an error simply try to load a model from Hugging Face. Installing sentence-transformers with uv does not fix the problem.

```python
# test.py
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("clip-ViT-B-32")
```

```
# create virtualenv with virtualenvwrapper
mkvirtualenv test -p python3.11
workon test
pip install uv
uv pip install sentence-transformers
python test.py
```

```
(test) MacBookPro~/projects/bastet[embedding_app_python L|✚3…1⚑1] % python3 test.py

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.2.6 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):  File "/Users/matthewdornfeld/projects/bastet/test.py", line 1, in <module>
    from sentence_transformers import SentenceTransformer
  File "/Users/matthewdornfeld/.virtualenvs/test/lib/python3.11/site-packages/sentence_transformers/__init__.py", line 9, in <module>
    from sentence_transformers.backend import (
  File "/Users/matthewdornfeld/.virtualenvs/test/lib/python3.11/site-packages/sentence_transformers/backend.py", line 11, in <module>
    from sentence_transformers.util import disable_datasets_caching, is_datasets_available
  File "/Users/matthewdornfeld/.virtualenvs/test/lib/python3.11/site-packages/sentence_transformers/util.py", line 17, in <module>
    import torch
  File "/Users/matthewdornfeld/.virtualenvs/test/lib/python3.11/site-packages/torch/__init__.py", line 1477, in <module>
    from .functional import *  # noqa: F403
  File "/Users/matthewdornfeld/.virtualenvs/test/lib/python3.11/site-packages/torch/functional.py", line 9, in <module>
    import torch.nn.functional as F
  File "/Users/matthewdornfeld/.virtualenvs/test/lib/python3.11/site-packages/torch/nn/__init__.py", line 1, in <module>
    from .modules import *  # noqa: F403
  File "/Users/matthewdornfeld/.virtualenvs/test/lib/python3.11/site-packages/torch/nn/modules/__init__.py", line 35, in <module>
    from .transformer import TransformerEncoder, TransformerDecoder, \
  File "/Users/matthewdornfeld/.virtualenvs/test/lib/python3.11/site-packages/torch/nn/modules/transformer.py", line 20, in <module>
    device: torch.device = torch.device(torch._C._get_default_device()),  # torch.device('cpu'),
/Users/matthewdornfeld/.virtualenvs/test/lib/python3.11/site-packages/torch/nn/modules/transformer.py:20: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/torch/csrc/utils/tensor_numpy.cpp:84.)
  device: torch.device = torch.device(torch._C._get_default_device()),  # torch.device('cpu'),
Traceback (most recent call last):
  File "/Users/matthewdornfeld/projects/bastet/test.py", line 3, in <module>
    model = SentenceTransformer("clip-ViT-B-32")
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matthewdornfeld/.virtualenvs/test/lib/python3.11/site-packages/sentence_transformers/SentenceTransformer.py", line 309, in __init__
    modules, self.module_kwargs = self._load_sbert_model(
                                  ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matthewdornfeld/.virtualenvs/test/lib/python3.11/site-packages/sentence_transformers/SentenceTransformer.py", line 1824, in _load_sbert_model
    module = module_class.load(module_path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matthewdornfeld/.virtualenvs/test/lib/python3.11/site-packages/sentence_transformers/models/CLIPModel.py", line 98, in load
    return CLIPModel(model_name=input_path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matthewdornfeld/.virtualenvs/test/lib/python3.11/site-packages/sentence_transformers/models/CLIPModel.py", line 18, in __init__
    self.model = transformers.CLIPModel.from_pretrained(model_name)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matthewdornfeld/.virtualenvs/test/lib/python3.11/site-packages/transformers/modeling_utils.py", line 309, in _wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matthewdornfeld/.virtualenvs/test/lib/python3.11/site-packages/transformers/modeling_utils.py", line 4252, in from_pretrained
    device_in_context = get_torch_context_manager_or_global_device()
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matthewdornfeld/.virtualenvs/test/lib/python3.11/site-packages/transformers/modeling_utils.py", line 322, in get_torch_context_manager_or_global_device
    default_device = torch.get_default_device()
                     ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matthewdornfeld/.virtualenvs/test/lib/python3.11/site-packages/torch/__init__.py", line 1938, in __getattr__
    raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
AttributeError: module 'torch' has no attribute 'get_default_device'
```

I cannot upgrade to Torch 2.6. It looks like that is not supported on Intel Macs.
```
(test) MacBookPro~/projects/bastet[embedding_app_python L|✚3…1⚑1] % uv pip install torch==2.6.0
Using Python 3.11.12 environment at: /Users/matthewdornfeld/.virtualenvs/test
  × No solution found when resolving dependencies:
  ╰─▶ Because torch==2.6.0 has no wheels with a matching platform tag (e.g., `macosx_15_0_x86_64`) and you require torch==2.6.0, we
      can conclude that your requirements are unsatisfiable.

      hint: Wheels are available for `torch` (v2.6.0) on the following platforms: `manylinux_2_28_aarch64`, `manylinux1_x86_64`,
      `macosx_11_0_arm64`, `win_amd64`
```

Also downgrading to older version of sentence-transformers does not address the problem. I tried running `uv pip install sentence-transformers==3.4.0` and still get the above error, which seems strange. Was this change pushed to old versions of the library as well?

> unfortunately there are security risks when loading PyTorch format checkpoints on older versions of Torch, so we probably won't remove that requirement

So is the plan to not support Intel macs anymore? That's probably a good 20% of your users. It will be helpful to find a solution for this that doesn't involve us all spending $2000 on new laptops :). Is it possible to make older versions of sentence-transformers work? I'm a little confused why I'm getting the error on versions of the library I successfully used before.

Oh I just realized that the exception is coming from the transformers library, not sentence-transformers. I was able to resolve by pinning
```
numpy==1.26.4
transformers==4.41.0
```
Still probably good to think about if you guys want to support Intel Macs. Will Pytorch eventually build newer wheels for Intel Macs? If not those users won't be able to upgrade to newer versions of the lib. I imagine I'm not the last person that's going to run into this problem.

Hi @mattdornfeld, I'll raise the issue internally. In general, we think support for Intel Macs has been dropped by Apple (no longer supported on the most recent MacOS) and so it's not too surprising that e.g. Torch is not building wheels for it anymore, but if it's a significant issue we'll see what we can do.

Also, to be clear, **older versions of Torch should still work for most tasks!** This is only an issue for **loading old and vulnerable checkpoints in PyTorch format**. The best solution is to get those checkpoints to update to safetensors, or to make your own safetensors clone of the repo. This can be done easily, e.g. by running this on Colab with Torch >= 2.6

```python
from transformers import AutoModelForCausalLM

model = AutoModelForCausalLM.from_pretrained("repo/with/old/weights")

model.push_to_hub("updated_repo")  # Will be saved under your username if you login with your token, and uses safetensors by default
```

Once you've done that, you can continue loading the model with older versions of torch, and not worry about the security vulnerability:

```python
from transformers import AutoModelForCausalLM

model = AutoModelForCausalLM.from_pretrained("your_username/updated_repo")
```

Also just realized @mattdornfeld's second issue is different from the first one! @mattdornfeld the specific issue with `torch.get_default_device()` in your second post should be resolved on `main`. This was an unintended regression (`torch.get_default_device()` only works on `torch >= 2.3`). Installing the latest version from `main` should resolve this

The "Due to a serious vulnerability issue in `torch.load`" issue will remain, though, and for that you'll need to convert the checkpoints to `safetensors`

SAME ISSUE HERE

![Image](https://github.com/user-attachments/assets/71903294-871a-409e-9456-5421d7ad928b)


SELECTED: input2
Florence2 using sdpa for attention
!!! Exception during processing !!! Due to a serious vulnerability issue in `torch.load`, even with `weights_only=True`, we now require users to upgrade torch to at least v2.6 in order to use the function. This version restriction does not apply when loading files with safetensors.
See the vulnerability report here https://nvd.nist.gov/vuln/detail/CVE-2025-32434
Traceback (most recent call last):
  File "C:\ComfyUI_windows_portable\ComfyUI\execution.py", line 361, in execute
    output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ComfyUI_windows_portable\ComfyUI\execution.py", line 236, in get_output_data
    return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ComfyUI_windows_portable\ComfyUI\execution.py", line 208, in _map_node_over_list
    process_inputs(input_dict, i)
  File "C:\ComfyUI_windows_portable\ComfyUI\execution.py", line 197, in process_inputs
    results.append(getattr(obj, func)(**inputs))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Florence2\nodes.py", line 152, in loadmodel
    model = Florence2ForConditionalGeneration.from_pretrained(model_path, attn_implementation=attention, torch_dtype=dtype).to(offload_device)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\transformers\modeling_utils.py", line 309, in _wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\transformers\modeling_utils.py", line 4574, in from_pretrained
    ) = cls._load_pretrained_model(
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\transformers\modeling_utils.py", line 4833, in _load_pretrained_model
    load_state_dict(checkpoint_files[0], map_location="meta", weights_only=weights_only).keys()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\transformers\modeling_utils.py", line 554, in load_state_dict
    check_torch_load_is_safe()
  File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\transformers\utils\import_utils.py", line 1417, in check_torch_load_is_safe
    raise ValueError(
ValueError: Due to a serious vulnerability issue in `torch.load`, even with `weights_only=True`, we now require users to upgrade torch to at least v2.6 in order to use the function. This version restriction does not apply when loading files with safetensors.
See the vulnerability report here https://nvd.nist.gov/vuln/detail/CVE-2025-32434







Seems downgrading to 4.50 works.

![Image](https://github.com/user-attachments/assets/705d6c2c-9a40-4b20-bc22-906fe631dc76)



I was also facing the same error while training Segformer.

```python
def get_model(configs):
    model = SegformerForSemanticSegmentation.from_pretrained(
        configs["MODEL_NAME"],
        num_labels=configs["NUM_CLASSES"],
        ignore_mismatched_sizes=True,
    )
    return model
```

```
File ~/.local/lib/python3.10/site-packages/transformers/utils/import_utils.py:1417, in check_torch_load_is_safe()
   [1415](https://file+.vscode-resource.vscode-cdn.net/home/jaykumaran/Downloads/~/.local/lib/python3.10/site-packages/transformers/utils/import_utils.py:1415) def check_torch_load_is_safe():
   [1416](https://file+.vscode-resource.vscode-cdn.net/home/jaykumaran/Downloads/~/.local/lib/python3.10/site-packages/transformers/utils/import_utils.py:1416)     if not is_torch_greater_or_equal("2.6"):
-> [1417](https://file+.vscode-resource.vscode-cdn.net/home/jaykumaran/Downloads/~/.local/lib/python3.10/site-packages/transformers/utils/import_utils.py:1417)         raise ValueError(
   [1418](https://file+.vscode-resource.vscode-cdn.net/home/jaykumaran/Downloads/~/.local/lib/python3.10/site-packages/transformers/utils/import_utils.py:1418)             "Due to a serious vulnerability issue in `torch.load`, even with `weights_only=True`, we now require users "
   [1419](https://file+.vscode-resource.vscode-cdn.net/home/jaykumaran/Downloads/~/.local/lib/python3.10/site-packages/transformers/utils/import_utils.py:1419)             "to upgrade torch to at least v2.6 in order to use the function. This version restriction does not apply "
   [1420](https://file+.vscode-resource.vscode-cdn.net/home/jaykumaran/Downloads/~/.local/lib/python3.10/site-packages/transformers/utils/import_utils.py:1420)             "when loading files with safetensors."
   [1421](https://file+.vscode-resource.vscode-cdn.net/home/jaykumaran/Downloads/~/.local/lib/python3.10/site-packages/transformers/utils/import_utils.py:1421)             "\nSee the vulnerability report here https://nvd.nist.gov/vuln/detail/CVE-2025-32434"
   [1422](https://file+.vscode-resource.vscode-cdn.net/home/jaykumaran/Downloads/~/.local/lib/python3.10/site-packages/transformers/utils/import_utils.py:1422)         )

ValueError: Due to a serious vulnerability issue in `torch.load`, even with `weights_only=True`, we now require users to upgrade torch to at least v2.6 in order to use the function. This version restriction does not apply when loading files with safetensors.
See the vulnerability report here https://nvd.nist.gov/vuln/detail/CVE-2025-32434
```

I had the same issue.

Downgrade to the transformers=4.49 solved the problem!

`pip install transformers==4.49`

downgraded but still has the same issue

> downgraded but still has the same issue

Yes — same here, downgraded transformer to v4.49.0 but still having the same issue.

> > downgraded but still has the same issue
> 
> Yes — same here, downgraded transformer to v4.49.0 but still having the same issue.



> downgraded but still has the same issue

Could you share your current PyTorch version?

My working setup is:
- python: 3.10.13
- torch: 2.3.1+cu118
- torchaudio: 2.3.1+cu118
- torchvision: 0.18.1+cu118

System: Mac (Intel)

- Python 3.11.6
- torch: 2.2.2
- torchaudio: 2.2.2
- torchvision: 0.17.2

> System: Mac (Intel)
> 
> * Python 3.11.6
> * torch: 2.2.2
> * torchaudio: 2.2.2
> * torchvision: 0.17.2

as referred to in https://github.com/huggingface/transformers/issues/38464#issuecomment-2922683746, it seems that some functions in `transformers` releases now require torch version `>2.3`. If you are on torch 2.2.x, you might still encounter issues even after downgrading `transformers`.
hope this helps!


transformers-4.44.0 works

Also confirming keeping transformers-4.44.0 , torch-2.4.1 works

Hi developer team,

We got the same issue.  Here is the working setup:

System: Ubuntu
- Python 3.10.18
- torch: 2.3.0
- transformers: 4.53.2

Now we can only downgrade the transformer version as mentioned above. 
Hope this can be fixed. Thanks!

> > System: Mac (Intel)
> > 
> > * Python 3.11.6
> > * torch: 2.2.2
> > * torchaudio: 2.2.2
> > * torchvision: 0.17.2
> 
> as referred to in [#38464 (comment)](https://github.com/huggingface/transformers/issues/38464#issuecomment-2922683746), it seems that some functions in `transformers` releases now require torch version `>2.3`. If you are on torch 2.2.x, you might still encounter issues even after downgrading `transformers`. hope this helps!

Hi, but on Mac(intel), it shows that, 
`
ERROR: Could not find a version that satisfies the requirement torch==2.3 (from versions: 2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.1.2, 2.2.0, 2.2.1, 2.2.2)
ERROR: No matching distribution found for torch==2.3
`
Is there any other way to solve this problem? My system version is the same as the one quoted

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.

> I had the same issue.
> 
> Downgrade to the transformers=4.49 solved the problem!
> 
> `pip install transformers==4.49`

Yes this worked for me aswell

> > > System: Mac (Intel)
> > > 
> > > * Python 3.11.6
> > > * torch: 2.2.2
> > > * torchaudio: 2.2.2
> > > * torchvision: 0.17.2
> > 
> > 
> > as referred to in [#38464 (comment)](https://github.com/huggingface/transformers/issues/38464#issuecomment-2922683746), it seems that some functions in `transformers` releases now require torch version `>2.3`. If you are on torch 2.2.x, you might still encounter issues even after downgrading `transformers`. hope this helps!
> 
> Hi, but on Mac(intel), it shows that, `ERROR: Could not find a version that satisfies the requirement torch==2.3 (from versions: 2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.1.2, 2.2.0, 2.2.1, 2.2.2) ERROR: No matching distribution found for torch==2.3` Is there any other way to solve this problem? My system version is the same as the one quoted

Try downgrading transformers to v4.49

This solved the issue for me:
```
>>> torch.__version__
'2.5.1+cu124'
>>> torchvision.__version__
'0.20.1+cu121'
>>> transformers.__version__
'4.50.0'
```

For ppl who are looking for walkarounds with `transformers>4.50`, may try patching `~/transformers/utils/import_utils.py` on your own. Works like a charm for me :)

> Eu tive o mesmo problema.
> 
> Fazer o downgrade para transformers=4.49 resolveu o problema!
> 
> `pip install transformers==4.49`

I was trying to run WAN2GP with CUDA 12.1, and this version worked perfectly — thank you so much!

> For ppl who are looking for walkarounds with `transformers>4.50`, may try patching `~/transformers/utils/import_utils.py` on your own. Works like a charm for me :)

do you have the patch?