From: Nicolas Patry Date: Fri, 8 Aug 2025 12:33:40 +0000 (+0200) Subject: Fixing the version check for uint support in torch. (#643) X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=2b253406f8896a5589083f68d05e5fbda30778a6;p=safetensors.git Fixing the version check for uint support in torch. (#643) --- diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 27dc28c..dd716ee 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,13 +31,14 @@ repos: "--", "-Dwarnings", ] - - repo: https://github.com/psf/black - rev: 22.3.0 + - repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. + rev: v0.12.8 hooks: - - id: black - name: "Python (black)" - args: ["--line-length", "119", "--target-version", "py35"] - types: ["python"] + # Run the linter. + - id: ruff-check + # Run the formatter. + - id: ruff-format - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. rev: v0.11.11 diff --git a/bindings/python/py_src/safetensors/torch.py b/bindings/python/py_src/safetensors/torch.py index 49405bf..f2285e0 100644 --- a/bindings/python/py_src/safetensors/torch.py +++ b/bindings/python/py_src/safetensors/torch.py @@ -433,7 +433,7 @@ _SIZE = { _float8_e8m0: 1, _float4_e2m1_x2: 1, } -if Version(torch.__version__) > Version("2.0.0"): +if Version(torch.__version__) >= Version("2.3.0"): _SIZE.update( { torch.uint64: 8, @@ -456,7 +456,7 @@ _TYPES = { "F8_E4M3": _float8_e4m3fn, "F8_E5M2": _float8_e5m2, } -if Version(torch.__version__) > Version("2.0.0"): +if Version(torch.__version__) >= Version("2.3.0"): _TYPES.update( { "U64": torch.uint64,