MCPcopy
hub / github.com/huggingface/transformers / check_torch_load_is_safe

Function check_torch_load_is_safe

src/transformers/utils/import_utils.py:1395–1402  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1393
1394
1395def 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
1405def torch_only_method(fn: Callable) -> Callable:

Calls 1