| 1393 | |
| 1394 | |
| 1395 | def check_torch_load_is_safe() -> None: |
| 1396 | if not is_torch_greater_or_equal("2.6"): |
| 1397 | raise ValueError( |
| 1398 | "Due to a serious vulnerability issue in `torch.load`, even with `weights_only=True`, we now require users " |
| 1399 | "to upgrade torch to at least v2.6 in order to use the function. This version restriction does not apply " |
| 1400 | "when loading files with safetensors." |
| 1401 | "\nSee the vulnerability report here https://nvd.nist.gov/vuln/detail/CVE-2025-32434" |
| 1402 | ) |
| 1403 | |
| 1404 | |
| 1405 | def torch_only_method(fn: Callable) -> Callable: |