Message ID | c666b6b3bcf8652d875477fd6b5c8f2858b31077.1690500537.git.zamfofex@twdb.moe |
---|---|
State | New |
Headers | show |
Series | [bug#63088] Add Lc0. | expand |
> Note that, unlike Stockfish, Lc0 does run without the neural networks
Sorry, I meant to say “Lc0 does *not* run without the neural networks”. (“Not” is a fairly important word to have forgotten!)
Am Donnerstag, dem 27.07.2023 um 20:34 -0300 schrieb zamfofex: > Note that, unlike Stockfish, Lc0 does run without the neural > networks, so it would be necessary for the user to download or > otherwise acquire one by themself in order to use Lc0. This sentence looks semantically incorrect. > The user can choose an appropriate network in their chess GUI program > when configuring Lc0 in it. > > If this is more desireable, I can submit a patch without the trained > neural network, which would allow the user to choose whichever one > they might want. Providing a default, if it can be bootstrapped, but allowing the user to choose would be the best option. > Thanks in advance! > > * gnu/packages/games.scm (lc0): New variable. > --- > gnu/packages/games.scm | 58 > ++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 58 insertions(+) > > diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm > index cc6bef1114..21aa370701 100644 > --- a/gnu/packages/games.scm > +++ b/gnu/packages/games.scm > @@ -118,6 +118,7 @@ (define-module (gnu packages games) > #:use-module (gnu packages bash) > #:use-module (gnu packages bison) > #:use-module (gnu packages boost) > + #:use-module (gnu packages c) > #:use-module (gnu packages check) > #:use-module (gnu packages cmake) > #:use-module (gnu packages compression) > @@ -171,6 +172,7 @@ (define-module (gnu packages games) > #:use-module (gnu packages linux) > #:use-module (gnu packages llvm) > #:use-module (gnu packages lua) > + #:use-module (gnu packages machine-learning) > #:use-module (gnu packages man) > #:use-module (gnu packages maths) > #:use-module (gnu packages messaging) > @@ -10285,6 +10287,62 @@ (define-public stockfish > (home-page "https://stockfishchess.org/") > (license license:gpl3+)))) > > +(define lc0-neural-network > + (let ((hash > + > "f404e156ceb2882470fd8c032b8754af0fa0b71168328912eaef14671a256e34")) > + (origin > + (method url-fetch) > + (uri (string-append > "https://storage.lczero.org/files/networks/" > + hash)) > + (sha256 > + (base32 > + "03b9xl9vkiihdilz5dzcpg6g4inb6n4k5gs911i3gbd8h9sh9ixi")) > + (file-name "lc0-neural-network")))) > + > +(define-public lc0 > + (package > + (name "lc0") > + (version "0.30.0") > + (source > + (origin > + (method git-fetch) > + (uri (git-reference > + (url "https://github.com/LeelaChessZero/lc0") > + (commit (string-append "v" version)) > + (recursive? #t))) > + (file-name (git-file-name name version)) > + (sha256 > + (base32 > "1m7k8m8iz4pxv3h9g2j1dkgryi4k9c1bcg3fx5j7ii4ysif63kj3")))) > + (build-system meson-build-system) > + (native-search-paths > + (list (search-path-specification > + (variable "XDG_DATA_DIRS") > + (files (list "share"))))) > + (inputs > + `(("neural-network" ,lc0-neural-network) > + ("eigen" ,eigen) > + ("oneapi-dnnl" ,oneapi-dnnl) > + ("zlib" ,zlib))) > + (native-inputs > + (list googletest ispc pkg-config python)) > + (arguments > + '(#:phases (modify-phases %standard-phases > + (add-after 'install 'copy-net > + (lambda* (#:key outputs inputs #:allow-other- > keys) > + (mkdir-p (string-append (assoc-ref outputs > "out") > + "/share/lc0")) > + (copy-file (assoc-ref inputs "neural-network") > + (string-append (assoc-ref outputs > "out") > + "/share/lc0/neural- > network"))))) > + #:configure-flags (list "-Ddnnl=true" > + (string-append > + "-Ddnnl_dir=" > + (assoc-ref %build-inputs "oneapi- > dnnl"))))) > + (synopsis "Neural network based chess engine") I think the postfix "based", which typically requires a dash is not easily applied here. Simply write "Chess engine using neural networks" or something like that. > + (description "Lc0 is a chess engine based on neural networks") Not a full sentence without period > + (home-page "https://lczero.org") > + (license license:gpl3+))) > + > (define-public barrage > (package > (name "barrage") > > base-commit: c7e45139faa27b60f2c7d0a4bc140f9793d97d47 Cheers
> This sentence looks semantically incorrect. Yes, sorry! I guess you didn’t receive my correction email. (I’m still bad at sending emails properly, it seems.) See: <https://issues.guix.gnu.org/63088#8> I had meant “Lc0 does *not* run without the neural networks”. > Providing a default, if it can be bootstrapped, but allowing the user to choose would be the best option. I don’t think a default can be easily bootstrapped. When I first submitted the patch, I talked with some of the Lc0 developers, and they said it might be possible to bootstrap one by using Stockfish in several minutes, but there is no code that does that currrently (it would have to be written and is nontrivial). And it wouldn’t be as effective as the existing networks, because Stockfish’s evaluation provides less information than Lc0’s is able to use. In any case, that feels entirely redundant, because Stockfish’s NNUE networks were trained on Lc0’s anyway, so it seems to be only adding a layer of complexity for no seemingly good reason. If this concern can be addressed somehow, I can submit a followup patch. (Either just fixing the wording, or also removing the networks.)
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm index cc6bef1114..21aa370701 100644 --- a/gnu/packages/games.scm +++ b/gnu/packages/games.scm @@ -118,6 +118,7 @@ (define-module (gnu packages games) #:use-module (gnu packages bash) #:use-module (gnu packages bison) #:use-module (gnu packages boost) + #:use-module (gnu packages c) #:use-module (gnu packages check) #:use-module (gnu packages cmake) #:use-module (gnu packages compression) @@ -171,6 +172,7 @@ (define-module (gnu packages games) #:use-module (gnu packages linux) #:use-module (gnu packages llvm) #:use-module (gnu packages lua) + #:use-module (gnu packages machine-learning) #:use-module (gnu packages man) #:use-module (gnu packages maths) #:use-module (gnu packages messaging) @@ -10285,6 +10287,62 @@ (define-public stockfish (home-page "https://stockfishchess.org/") (license license:gpl3+)))) +(define lc0-neural-network + (let ((hash + "f404e156ceb2882470fd8c032b8754af0fa0b71168328912eaef14671a256e34")) + (origin + (method url-fetch) + (uri (string-append "https://storage.lczero.org/files/networks/" + hash)) + (sha256 + (base32 + "03b9xl9vkiihdilz5dzcpg6g4inb6n4k5gs911i3gbd8h9sh9ixi")) + (file-name "lc0-neural-network")))) + +(define-public lc0 + (package + (name "lc0") + (version "0.30.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/LeelaChessZero/lc0") + (commit (string-append "v" version)) + (recursive? #t))) + (file-name (git-file-name name version)) + (sha256 + (base32 "1m7k8m8iz4pxv3h9g2j1dkgryi4k9c1bcg3fx5j7ii4ysif63kj3")))) + (build-system meson-build-system) + (native-search-paths + (list (search-path-specification + (variable "XDG_DATA_DIRS") + (files (list "share"))))) + (inputs + `(("neural-network" ,lc0-neural-network) + ("eigen" ,eigen) + ("oneapi-dnnl" ,oneapi-dnnl) + ("zlib" ,zlib))) + (native-inputs + (list googletest ispc pkg-config python)) + (arguments + '(#:phases (modify-phases %standard-phases + (add-after 'install 'copy-net + (lambda* (#:key outputs inputs #:allow-other-keys) + (mkdir-p (string-append (assoc-ref outputs "out") + "/share/lc0")) + (copy-file (assoc-ref inputs "neural-network") + (string-append (assoc-ref outputs "out") + "/share/lc0/neural-network"))))) + #:configure-flags (list "-Ddnnl=true" + (string-append + "-Ddnnl_dir=" + (assoc-ref %build-inputs "oneapi-dnnl"))))) + (synopsis "Neural network based chess engine") + (description "Lc0 is a chess engine based on neural networks") + (home-page "https://lczero.org") + (license license:gpl3+))) + (define-public barrage (package (name "barrage")