]> khamidou — GitHub mirrors - safetensors.git/commitdiff
Fixing the version check for uint support in torch. (#643)
authorNicolas Patry <patry.nicolas@protonmail.com>
Fri, 8 Aug 2025 12:33:40 +0000 (14:33 +0200)
committerGitHub <noreply@github.com>
Fri, 8 Aug 2025 12:33:40 +0000 (14:33 +0200)
.pre-commit-config.yaml
bindings/python/py_src/safetensors/torch.py

index 27dc28c05172d21dd92c6ef1d266fd2214a7fab9..dd716eed89b87bfc3348fceaf69285e0f7c8b438 100644 (file)
@@ -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
index 49405bf3f84d5d8cf9f5e86452fc1593d48fa641..f2285e0f0d10dbdc31fef92496ccfe859a64aa4e 100644 (file)
@@ -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,