diff mbox series

[bug#63088,2/3] gnu: Add neural networks for Leela Chess Zero.

Message ID 845cc1e6b38e26aba3c99c4934c4d2f9c6e2b6e2.1694519893.git.zamfofex@twdb.moe
State New
Headers show
Series [bug#63088,1/3] gnu: Add lc0. | expand

Commit Message

zamfofex Sept. 12, 2023, 11:58 a.m. UTC
* gnu/packages/lc0.scm (make-lc0-nn): New procedure.
* gnu/packages/lc0.scm (lc0-t2, lc0-t1, lc0-t1-512, lc0-t1-256)
(lc0-611246, lc0-791556, lc0-815383): New variables.
---
 gnu/packages/lc0.scm | 76 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)

Comments

Liliana Marie Prikler Sept. 12, 2023, 5:07 p.m. UTC | #1
Am Dienstag, dem 12.09.2023 um 08:58 -0300 schrieb zamfofex:
> * gnu/packages/lc0.scm (make-lc0-nn): New procedure.
> * gnu/packages/lc0.scm (lc0-t2, lc0-t1, lc0-t1-512, lc0-t1-256)
> (lc0-611246, lc0-791556, lc0-815383): New variables.
> ---
>  gnu/packages/lc0.scm | 76
> ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 76 insertions(+)
> 
> diff --git a/gnu/packages/lc0.scm b/gnu/packages/lc0.scm
> index e19436c381..1cda2efd1c 100644
> --- a/gnu/packages/lc0.scm
> +++ b/gnu/packages/lc0.scm
> @@ -17,7 +17,10 @@
>  ;;; along with GNU Guix.  If not, see
> <http://www.gnu.org/licenses/>.
>  
>  (define-module (gnu packages lc0)
> +  #:use-module (guix build utils)
>    #:use-module (guix build-system meson)
> +  #:use-module (guix build-system trivial)
> +  #:use-module (guix download)
>    #:use-module (guix gexp)
>    #:use-module (guix git-download)
>    #:use-module (guix packages)
> @@ -69,3 +72,76 @@ (define-public lc0
>  is necessary to use Leela Chess Zero and should be installed
> separately.")
>      (home-page "https://lczero.org")
>      (license license:gpl3+)))
> +
> +(define (make-lc0-nn name file-name url hash description)
> +  (package
> +    (name (string-append "lc0-" name))
> +    (version "0")
> +    (source (origin
> +              (method url-fetch)
> +              (uri url)
> +              (file-name (string-append "lc0-" file-name))
> +              (sha256
> +               (base32
> +                hash))))
> +    (build-system trivial-build-system)
> +    (arguments
> +     (list #:builder (with-imported-modules '((guix build utils))
> +                                            #~(let ((share (string-
> append (assoc-ref
> +                                                                    
>        %outputs
> +                                                                    
>        "out")
> +                                                           
> "/share/lc0/")))
> +                                                (use-modules (guix
> build utils))
> +                                                (mkdir-p share)
> +                                                (copy-file (assoc-
> ref
> +                                                            %build-
> inputs
> +                                                           
> "source")
> +                                                           (string-
> append
> +                                                            share
> +                                                            #$file-
> name))))))
> +    (synopsis "Pretrained neural network for Leela Chess Zero")
> +    (description description)
> +    (home-page "https://lczero.org")
> +    (license license:gpl3+)))
> +
> +(define-public lc0-t2
> +  (make-lc0-nn "t2" "t2-768.pb.gz"
> +  
> "https://storage.lczero.org/files/networks-contrib/t2-768x15x24h-swa-
> 5230000.pb.gz"
You might want to search for ways to shorten these urls.  E.g. Define a
procedure (lc0-network "short-name")
> +   "126305hby24k5agxiixadp1lcgmv8drm1dkpb4jf5jzq7k4m855w"
> +   "T2 is currently one of the best neural network for Leela Chess
> Zero, superceeding the neural network T1."))
> +
> +(define-public lc0-t1
> +  (make-lc0-nn "t1" "t1-768.pb.gz"
> +  
> "https://storage.lczero.org/files/networks-contrib/t1-768x15x24h-swa-
> 4000000.pb.gz"
> +   "0zm9v91gfnm69n4x2fckair24fypjrwiip3j86ylsqncsi1sh5nq"
> +   "T1 is currently one of the best neural network for Leela Chess
> Zero, however it was superceeded by the neural network T2."))
> +
> +(define-public lc0-t1-512
> +  (make-lc0-nn "t1-512" "t1-512.pb.gz"
> +  
> "https://storage.lczero.org/files/networks-contrib/t1-512x15x8h-disti
> lled-swa-3395000.pb.gz"
> +   "1s4pq06qkdpaq0a4z6j5qqnf6h7njpmwh7i0v7qh6bmhwlcibnqz"
> +   "This is a smaller version of the T1 neural network, which is
> currently one of the best neural network for Leela Chess Zero."))
> +
> +(define-public lc0-t1-256
> +  (make-lc0-nn "t1-256" "t1-256.pb.gz"
> +  
> "https://storage.lczero.org/files/networks-contrib/t1-256x10-distille
> d-swa-2432500.pb.gz"
> +   "01ilar7y2nf3kfkq3x77n4jxlvqdpgddjsham2wz4dmdx35ac9xw"
> +   "This is a smaller version of the T1 neural network, which is
> currently one of the best neural network for Leela Chess Zero."))
> +
> +(define-public lc0-611246
> +  (make-lc0-nn "611246" "611246.pb.gz"
> +  
> "https://storage.lczero.org/files/networks/7ca2381cfeac5c280f304e7027
> ffbea1b7d87474672e5d6fb16d5cd881640e04"
> +   "0rapfvjqqrhydhp8a6r3skmjci2dc2yxz912bglv9yd9k00l9rww"
> +   "This is an official neural network of a “main run” of the Leela
> Chess Zero project that was finished being trained in January of
> 2022."))
> +
> +(define-public lc0-791556
> +  (make-lc0-nn "791556" "791556.pb.gz"
> +  
> "https://storage.lczero.org/files/networks/f404e156ceb2882470fd8c032b
> 8754af0fa0b71168328912eaef14671a256e34"
> +   "03b9xl9vkiihdilz5dzcpg6g4inb6n4k5gs911i3gbd8h9sh9ixi"
> +   "This is an official neural network of the Leela Chess Zero
> project that was finished being trained in April of 2022."))
> +
> +(define-public lc0-815383
> +  (make-lc0-nn "815383" "815383.pb.gz"
> +  
> "https://storage.lczero.org/files/networks/8af6098d6fb76e2bef6ef9ee87
> e61fadcb99f0b789013a72953a95ad10a9e933"
> +   "09gm8lgaick60rn4x9h9w5sxdqivr4ign73viviadw1gj7wsbnsg"
> +   "This is an official neural network of a “main run” of the Leela
> Chess Zero project.  The network was finished being trained in
> September of 2023."))

Cheers
diff mbox series

Patch

diff --git a/gnu/packages/lc0.scm b/gnu/packages/lc0.scm
index e19436c381..1cda2efd1c 100644
--- a/gnu/packages/lc0.scm
+++ b/gnu/packages/lc0.scm
@@ -17,7 +17,10 @@ 
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages lc0)
+  #:use-module (guix build utils)
   #:use-module (guix build-system meson)
+  #:use-module (guix build-system trivial)
+  #:use-module (guix download)
   #:use-module (guix gexp)
   #:use-module (guix git-download)
   #:use-module (guix packages)
@@ -69,3 +72,76 @@  (define-public lc0
 is necessary to use Leela Chess Zero and should be installed separately.")
     (home-page "https://lczero.org")
     (license license:gpl3+)))
+
+(define (make-lc0-nn name file-name url hash description)
+  (package
+    (name (string-append "lc0-" name))
+    (version "0")
+    (source (origin
+              (method url-fetch)
+              (uri url)
+              (file-name (string-append "lc0-" file-name))
+              (sha256
+               (base32
+                hash))))
+    (build-system trivial-build-system)
+    (arguments
+     (list #:builder (with-imported-modules '((guix build utils))
+                                            #~(let ((share (string-append (assoc-ref
+                                                                           %outputs
+                                                                           "out")
+                                                            "/share/lc0/")))
+                                                (use-modules (guix build utils))
+                                                (mkdir-p share)
+                                                (copy-file (assoc-ref
+                                                            %build-inputs
+                                                            "source")
+                                                           (string-append
+                                                            share
+                                                            #$file-name))))))
+    (synopsis "Pretrained neural network for Leela Chess Zero")
+    (description description)
+    (home-page "https://lczero.org")
+    (license license:gpl3+)))
+
+(define-public lc0-t2
+  (make-lc0-nn "t2" "t2-768.pb.gz"
+   "https://storage.lczero.org/files/networks-contrib/t2-768x15x24h-swa-5230000.pb.gz"
+   "126305hby24k5agxiixadp1lcgmv8drm1dkpb4jf5jzq7k4m855w"
+   "T2 is currently one of the best neural network for Leela Chess Zero, superceeding the neural network T1."))
+
+(define-public lc0-t1
+  (make-lc0-nn "t1" "t1-768.pb.gz"
+   "https://storage.lczero.org/files/networks-contrib/t1-768x15x24h-swa-4000000.pb.gz"
+   "0zm9v91gfnm69n4x2fckair24fypjrwiip3j86ylsqncsi1sh5nq"
+   "T1 is currently one of the best neural network for Leela Chess Zero, however it was superceeded by the neural network T2."))
+
+(define-public lc0-t1-512
+  (make-lc0-nn "t1-512" "t1-512.pb.gz"
+   "https://storage.lczero.org/files/networks-contrib/t1-512x15x8h-distilled-swa-3395000.pb.gz"
+   "1s4pq06qkdpaq0a4z6j5qqnf6h7njpmwh7i0v7qh6bmhwlcibnqz"
+   "This is a smaller version of the T1 neural network, which is currently one of the best neural network for Leela Chess Zero."))
+
+(define-public lc0-t1-256
+  (make-lc0-nn "t1-256" "t1-256.pb.gz"
+   "https://storage.lczero.org/files/networks-contrib/t1-256x10-distilled-swa-2432500.pb.gz"
+   "01ilar7y2nf3kfkq3x77n4jxlvqdpgddjsham2wz4dmdx35ac9xw"
+   "This is a smaller version of the T1 neural network, which is currently one of the best neural network for Leela Chess Zero."))
+
+(define-public lc0-611246
+  (make-lc0-nn "611246" "611246.pb.gz"
+   "https://storage.lczero.org/files/networks/7ca2381cfeac5c280f304e7027ffbea1b7d87474672e5d6fb16d5cd881640e04"
+   "0rapfvjqqrhydhp8a6r3skmjci2dc2yxz912bglv9yd9k00l9rww"
+   "This is an official neural network of a “main run” of the Leela Chess Zero project that was finished being trained in January of 2022."))
+
+(define-public lc0-791556
+  (make-lc0-nn "791556" "791556.pb.gz"
+   "https://storage.lczero.org/files/networks/f404e156ceb2882470fd8c032b8754af0fa0b71168328912eaef14671a256e34"
+   "03b9xl9vkiihdilz5dzcpg6g4inb6n4k5gs911i3gbd8h9sh9ixi"
+   "This is an official neural network of the Leela Chess Zero project that was finished being trained in April of 2022."))
+
+(define-public lc0-815383
+  (make-lc0-nn "815383" "815383.pb.gz"
+   "https://storage.lczero.org/files/networks/8af6098d6fb76e2bef6ef9ee87e61fadcb99f0b789013a72953a95ad10a9e933"
+   "09gm8lgaick60rn4x9h9w5sxdqivr4ign73viviadw1gj7wsbnsg"
+   "This is an official neural network of a “main run” of the Leela Chess Zero project.  The network was finished being trained in September of 2023."))