summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2022-07-06 15:12:41 +0200
committerRicardo Wurmus <rekado@elephly.net>2022-07-06 17:16:15 +0200
commit563bb6eab1ac1a710a00800d2eeb076b64d89ff0 (patch)
tree14bbb55d413325231453f8db29fe220e358512a2 /gnu
parentd4d07ed92bd32ee141f96f1fde0bf8778994deaa (diff)
downloadguix-563bb6eab1ac1a710a00800d2eeb076b64d89ff0.tar.gz
gnu: Add python-torchvision.
* gnu/packages/machine-learning.scm (python-torchvision): New variable.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/machine-learning.scm45
1 files changed, 45 insertions, 0 deletions
diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 91b4a6d7d8..d2332b5485 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -2866,6 +2866,7 @@ high-level machine learning frameworks, such as TensorFlow Lite,
 TensorFlow.js, PyTorch, and MediaPipe.")
       (license license:bsd-3))))
 
+;; Please also update python-torchvision when updating this package.
 (define-public python-pytorch
   (package
     (name "python-pytorch")
@@ -3009,6 +3010,50 @@ Note: currently this package does not provide GPU support.")
 
 (define-public python-pytorch-for-r-torch python-pytorch)
 
+;; Keep this in sync with python-pytorch
+(define-public python-torchvision
+  (package
+    (name "python-torchvision")
+    (version "0.12.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/pytorch/vision")
+                    (commit (string-append "v" version))
+                    (recursive? #t)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0chjd6zs46136sg65z1c2g07a534dg72xpy20s3bx1prwmvyxp5v"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:tests? #false ;the test suite is expensive and there is no easy way
+                       ;to subset it.
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda* (#:key tests? #:allow-other-keys)
+             (when tests?
+               (invoke "pytest" "-vv")))))))
+    (inputs
+     (list libpng
+           libjpeg-turbo))
+    (propagated-inputs
+     (list python-numpy
+           python-typing-extensions
+           python-requests
+           python-pillow
+           python-pillow-simd
+           python-pytorch))
+    (native-inputs
+     (list which python-pytest))
+    (home-page "https://pytorch.org/vision/stable/index.html")
+    (synopsis " Datasets, transforms and models specific to computer vision")
+    (description
+     "The torchvision package consists of popular datasets, model architectures,
+and common image transformations for computer vision.")
+    (license license:bsd-3)))
+
 (define-public python-hmmlearn
   (package
     (name "python-hmmlearn")