Giter Site home page Giter Site logo

lczero.org's People

Contributors

alexisolson avatar borg323 avatar cn4750 avatar evollve avatar fohristiwhirl avatar gsobala avatar gtim avatar hans-ekbrand avatar imbigo avatar johnzeringue avatar masterkni6 avatar mellekoning avatar micos7 avatar mooskagh avatar naphthalin avatar nguyenpham avatar ni784 avatar ofekshochat avatar oscardssmith avatar rajb245 avatar rooklift avatar tesseracta avatar timjentzsch avatar wakamex avatar yellowdragoon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lczero.org's Issues

Unhandled exception: Invalid weight file: lc0 version >= 0.30.0 required.

v0.29.0+git.dirty built Oct 17 2023
id name Lc0 v0.29.0+git.dirty
id author The LCZero Authors.
Loading weights file from: /root/.cache/lc0/client-cache/ad198f560498811734b5f005a7ea4ac989ea09f3b0cbb74e9a530266bde48d89
Unhandled exception: Invalid weight file: lc0 version >= 0.30.0 required.
2023/10/17 13:11:36 lc0_main.go:732: GameInfo channel closed, exiting train loop
2023/10/17 13:11:36 lc0_main.go:749: Waiting for lc0 to stop
lc0 exited with: signal: aborted (core dumped)2023/10/17 13:11:36 lc0_main.go:754: lc0 stopped
2023/10/17 13:11:36 lc0_main.go:756: Waiting for uploads to complete
2023/10/17 13:11:36 lc0_main.go:1251: Client self-exited without producing any games.
2023/10/17 13:11:36 lc0_main.go:1252: Sleeping for 30 seconds...
2023/10/17 13:12:06 lc0_main.go:1002: serverParams: [--visits=10000 --cpuct=1.32 --cpuct-at-root=2.0 --root-has-own-cpuct-params=true --resign-percentage=2.0 --resign-playthrough=20 --temperature=0.9 --temp-endgame=0.60 --tempdecay-moves=60 --tempdecay-delay-moves=20 --temp-cutoff-move=40 --temp-visit-offset=-0.8 --fpu-strategy=reduction --fpu-value=0.26 --fpu-strategy-at-root=absolute --fpu-value-at-root=1.0 --minimum-kldgain-per-node=0.000050 --policy-softmax-temp=1.45 --resign-wdlstyle=true --noise-epsilon=0.1 --noise-alpha=0.12 --sticky-endgames=true --moves-left-max-effect=0.2 --moves-left-threshold=0.0 --moves-left-slope=0.007 --moves-left-quadratic-factor=0.85 --moves-left-scaled-factor=0.15 --moves-left-constant-factor=0.0 --openings-pgn=books/run2_book.pgn.gz --openings-mode=shuffled --task-workers=0]
Args: [/content/lc0/build/lc0 selfplay --backend-opts=backend=cuda-auto --parallelism=32 --visits=10000 --cpuct=1.32 --cpuct-at-root=2.0 --root-has-own-cpuct-params=true --resign-percentage=2.0 --resign-playthrough=20 --temperature=0.9 --temp-endgame=0.60 --tempdecay-moves=60 --tempdecay-delay-moves=20 --temp-cutoff-move=40 --temp-visit-offset=-0.8 --fpu-strategy=reduction --fpu-value=0.26 --fpu-strategy-at-root=absolute --fpu-value-at-root=1.0 --minimum-kldgain-per-node=0.000050 --policy-softmax-temp=1.45 --resign-wdlstyle=true --noise-epsilon=0.1 --noise-alpha=0.12 --sticky-endgames=true --moves-left-max-effect=0.2 --moves-left-threshold=0.0 --moves-left-slope=0.007 --moves-left-quadratic-factor=0.85 --moves-left-scaled-factor=0.15 --moves-left-constant-factor=0.0 --openings-pgn=/root/.cache/lc0/books/run2_book.pgn.gz --openings-mode=shuffled --task-workers=0 --training=true --weights=/root/.cache/lc0/client-cache/ad198f560498811734b5f005a7ea4ac989ea09f3b0cbb74e9a530266bde48d89]

Building on Windows 10: VC 2017 15.7.6 + CUDA 9.2 Step by Step

I just installed a fresh laptop and tried the build instructions here https://github.com/LeelaChessZero/lc0/blob/master/windows_build.md. I ran into some issues, that can be solved. This serves as documentation as well as a reminder that the instructions might need an update. Please also read the link given above as the following is based on it. This is for the cuda version only, but most likely applies to other builds as well:

  1. Install VC 2017. Current version is 15.7.6, and this does not work with current CUDA 9.2. This will be fixed in a later step. Add "Desktop developement in C++", "Develop for universal Windows Plattform" and "Python-Development". The latter saves you from seperately installing pyhton.

  2. Install GIT for Windows: https://git-scm.com/download/win

  3. Install CUDA 9.2: https://developer.nvidia.com/cuda-downloads

  4. Install cuDNN: https://developer.nvidia.com/rdp/cudnn-download. This consists of three files that are put in three different CUDA directories as described here: https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html. These are the official paths - remember these, they are needed later.

  5. You will find python in "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64". Check if this has been added to the path variable, if not add. Also add "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Scripts"

  6. Install Meson: pip3 install --upgrade meson

  7. Fetch source (manually or by using the GITHub extension of VS2017) to C:\Users\XXXXXXX\source\repos\lc0

  8. Edit/Replace build-cuda.cmd to reflect the paths above, and that you use VC2017:

rd /s build

call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
meson.py build --backend vs2017 --buildtype release ^
-Dcudnn_libdirs="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\lib\x64","C:\dev\cuDNN\cuda\lib\x64" ^
-Dcudnn_include="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\include" ^
-Ddefault_library=static

cd build

"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" ^
/p:Configuration=Release ^
/p:Platform=x64 ^
/p:PreferredToolArchitecture=x64 lc0.sln ^
/filelogger
  1. Starting build-cuda would yield an error, because cuda 9.2 does not work with the latest VC2017. You have to edit one number in: "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\include\crt\host_config.h" to the following:
#if _MSC_VER < 1600 || _MSC_VER > 2000

#error -- unsupported Microsoft Visual Studio version! Only the versions 2012, 2013, 2015 and 2017 are supported!

This just increases the maximum version number.

  1. Run build-cuda. Done.

Leela V 0.29 suggests a losing move

Hello,

I am sorry, feel free to lock this thread if it's inappropriate for this "issues", but I caught Leela suggesting a losing move. In this position, Leela suggests that castling is a ok move
image

It's, however, a losing move. And Leela sees it as soon as you castle. The winning for black is BxNf3, because then there is Qd4 check and the c4 bishop is lost. Here
image

So, why is it that Leela doesn't see the move before castling is made on the board? It isn't a complicated tactic (in my opinion).
image

As you see, here it suggests castling, ok it's like the fifth move but the evaluation is equal, while it's a game-losing move.

If I wait for long enough, castling disappears from the move suggestions. So maybe I am impatient. But I am really curious to understand why it's not rejected immediately since blacks has 2 moves to make to win.

Thanks and Merry Christmas everyone.

Use GitHub Actions & Pages for deployment

Hello!

I would love to contribute to the webpage, but as it stands now, I don't know how to build the webpage locally to contribute to it. With that in mind, I have two questions:

a.) What tool is being used to build the webpage?
b.) Is it possible to run that tool and build an SSG webpage that can run on github pages (avoiding the human wait time between commit and deployment?)

Leela eats up all my GPU.

Hello, I am using the latest Leela version in chessbase 16. It works fine but it shoots to 100% GPU utilization. Is there a way to reduce this? I have an old GPU Radeon Sapphir RX390 8 Go. Thank you

Porting certainty propagation to new codebase. Notes and Outline.

Certainty propagation

Certainty propagation is known in literature as MCTS-Solver (Winands et. al). If we reach terminal (which are "certain") nodes, we can propagate the "certain" results from these nodes efficiently up the search-tree. For example if one side can play a move thats leads to a terminal win node, we can make the parent node a "certain" node scored as a loss from the opponents view. Further, nodes whose children are all certain, become certain themselves with the -max q among the certain childs. With this even MCTS can solve some shallow mates, and steer exploring the tree more efficiently and avoid branches that are "proven" to no longer need exploration. See also https://github.com/Videodr0me/leela-chess-experimental/wiki/MCTS-Solver---Certainty-Propagation-and-Autoextending

Features of full Implementation (as in my experimental build):

  • One ply look-ahead. Checking for terminals is relatively cheap compared to NN evals. Checking when creating the skeleton-childs (pre edge-node separation) detects terminals (and make the skeleton-child a full terminal node) one ply earlier, making leela see some mating combos earlier. Though not impossible with the new codebase, this can be skipped initially.
  • Two-Fold draw scoring. I folded this into certainty propagation, but this could easily be a separate option. I reused the certain state of a node to indicate a two-fold, and as soon as the node becomes root (tree-reuse), I uncertain it and recalculate its stats (more about this later). Not strictly needed, can be skipped initially.
  • Root-selection rule. In the lastest version of this, I went as far as to not search certain childs of root at all (so if a root-child became certain it would stop getting visits). This requires some changes, to (1) PUCT to choose non-certain childs at root, to (2) GetBestChild, so that the most visited is chosen unless there is a certain move with a higher q and to (3) the best move update along the same lines as GetBestChild. This also ins not necessary as a first step, even though I would propose to at least (independent of visits) choose a winning certain child of root and avoid certain loosing childs at root in GetBestChild and best move update. PUCT can remain unchanged (and if changed should NOT avoid loosing moves except at root). For choosing between a terminal threefold and a two-fold, I used NN eval of parent. But again, this is maybe not for an inital version.
  • Mate Display. Purely Cosmetic can be omitted. I do it in a hacky way, in that if best move is a certain win (or certain loss), I just take the length of x = PV/2 as the length of mate (this is approximate, as we only know its winning, but do not know what is the shortest path). Uci Output in this case is modified from cp score to mate x (or -x). Not really needed, and also if the certain state of a node is overloaded with TB results, it might not be a mate but just the path to a TB win.
  • Autoextending single legal moves. Plays well with certainty propagation (especially for forced mates). But for such a little change, was awkward to implement. I opted for further extending if picknodeextend returned a move with only one single move, and when backuping that score copying it from child to parent (also for chains of single legal moves, even though extremely rare in chess). Even though it helps with forced mate combos, it can be skipped initially.

Note on the basic implementation (what are the essentials):

-IsCertain(). Nodes get a new attribute "certain". All terminal nodes are certain, but not all certain nodes are terminal. MakeCertain(v) makes a node certain. MakeTerminal(result) makes a node terminal and certain. Most checks in the main loop are changed from IsTerminal() to IsCertain(), This changes nothing in regard to terminals (all terminals are also certain). The terminal state can be "overloaded" with this, but i opted for a separate bool for clarity and so i can turn the feature of more easily via uci options (for self-play testing). Later this became useful as for example two-fold draw-scoring needs to differentiate between terminal draws and two-fold draws. I could imagine something similar with TB and a "swindle" mode when playing against non TB opponents.

-The main propagation is done in the (new codebase) DoBackupUpdate(). I store the certain scores in both Q and V, and opted to fetch them via V. But fetching them via Q would work as well. I use hacky float == x.x compares, which works because i set them exactly as such, but there are nicer ways (for example use game:result or something). For efficiency I only do the certainty check if the update originated from a certain node (which can also be a terminal) -> v_is_certain = true. Root is never made certain (actually it is made uncertain before search, if it was certain due to tree-reuse). I "overloaded" the code to at root also aid in the best move determination (thats what the n==root_node_ condition is for) and for tie breaking (two-folds, certain wins vs. terminal wins.). This is a simplified version without the overloading, its actually really simple:

  // MCTS Solver or Proof-Number-Search
  // kCertaintyProp > 0
     if (kCertaintyProp && v_is_certain && !n->IsCertain())) {
	bool children_all_certain = true;
        float best_certain_v = -3.0f;
        Node *best_certain_node = nullptr;
	for (Node* iter : n->Children()) {
	  if (!iter->IsCertain()) { children_all_certain = false; }
	    else if ((iter->GetV()) >= best_certain_v) {
	      best_certain_node = iter;
	      best_certain_v = iter->GetV();
	      }
	 }
	 if (((children_all_certain) || (best_certain_v == 1.0f)) && (n != root_node_)) {
	     v = -best_certain_v;
	     n->MakeCertain(v);
	    ++madecertain_;
         }

This is basically it, if all childs are certain we make the node certain with the -max of the certain childs. Or if we find at least one certain winning child, then the node is a certain loss for the opponent. This gets backpropagated in the tree.

The full version of this with the following best move determination and the tie break rules are here https://github.com/Videodr0me/leela-chess-experimental/blob/master/src/mcts/search.cc#L339 I currently do best move determination in two stages (mainly because of the not searching certain childs of root). First the normal update (which is preliminary) and then at root (one ply higher) I resuse the info about the best certain move from the linked full version. This again can be done simpler initially.

The changes to GetBestMove are here https://github.com/Videodr0me/leela-chess-experimental/blob/d2088837fff01779dbf8fc606af6e92c98c1a449/src/mcts/search.cc#L505 These compute normal best move and best certain move, and then decide between them. This can greatly be simplified if we initially continue searching certain childs at root (basically prioritizing everything over certain losses and always take certain wins.). Also the tiebreak rules can safely be ignored (not really sure they yield any meaningful elo anyhow for example in prefering a certain loss over a terminal loss, in hope the opponent did not see the mate).

The changes only affect node.h, node.cc, search.h and search.cc. Only conditionals with if (kCertaintyProb) are relevant. And of those only those that are general "kCertaintyProb" or "kCertaintyProp==1". The rest is irrelevant. I hope this helps for a start. The changes in ExtendNode (old codebase) are only relevant for the one-ply lookahead and two-fold draw scoring (and the tree balancing).

Lagging/Freezing on Linux Mint 20

Leela 0.26 I think?
Various networks
CUDA 11
Linux Mint 20
GTX 1060
Nvidia Driver 450

Listening to music on YouTube + letting Leela analyze with > 1 Threads makes my PC lag so badly, you could almost call it freezing.

One thread works perfectly fine.

Idea: Pose additional questions to the net in order to make it smarter

[This goes beyond Leela 0. I am not sure where to post it, please feel free to move it somewhere relevant where these discussions are more suitable.]

Background: One of the things that helps to make Leela and Alpha Zero so smart is the idea to combine two networks into one, here policy and value, only splitting by the heads. The point is that when Leela is trained to answer and thus predict ("know") the policy question, then the net is better informed to answer the value question as well, and vice versa. Or, put in another way, the net will create decision structures that will incorporate more information for either answer. Please note: The net does actually get more information from the training in this way, because it is trained on two outputs rather than just one, so there is a genuine addition of information/knowledge.

General idea: Ask the net a few other fundamental, trainable questions regarding the position. Adjust the structure of the net so that it can give this output and be trained on it. Hopefully, this will lead to an even deeper understanding of any position and stronger policy and value heads.

Suggestion 1: Ask the net to produce policy probabilities and value estimates for BOTH sides to move in a given position. Training could be done on both "colors" by sometimes using one color of the net, sometimes the other, by random, during training matches, or during training afterwards. Alternatively, you could pick positions from games by random and do an 800 node search for both sides and train both policy heads simultaneously on the same position (if there is a point to this).

Motivation: We know from human learning of chess that learning to carefully consider the opponent's options gives a quantum leap in playing strength. Currently, Leela policy can react to threats, but it is probably rather superfluously (queen threatened by lower value piece etc.). By asking Leela the trainable question "what would the opponent do if you passed", we give Leela access to a far better appreciation of the nature of the position. Hypothetical example: To move, Leela policy may miss a tactical threat of the opponent, but it would actually find it itself if it sat on the other side of the board. By asking the question "what will the opponent do", Leela will be provoked to incorporate this threat into her decision process for her policy. In general, Leela will learn to integrate initial knowledge from both policies to determine either final policy.

Suggestion 2: Ask the net to predict the opponent move after each legal move (and again, do it for both sides to move). [So: we don't only ask for a probability of a move, but also the expected response, which can be trained by inspecting what Leela actually chooses as the opponent in the training game. Of course only the response to the one move actually played can be trained at a time, unless you specifically train this with full investigations of random positions from games].

Motivation: We are not trying to "make the net do search internally" here. Rather, apart from being a "forced sanity check, did you actually LOOK at this" type question, this question is also a fundamental question to ask in order to understand the structural logic of a chess position. Bent Larsen, the great Danish Grandmaster, talked about how many moves were linked in pairs. You can think of, say, a6 Ba4 in the Ruy Lopez, or, "if I ever remove this piece, then the opponent is likely to respond with this". The full, informed by training, picture of all this is likely to provide a much richer and sophisticated understanding of the logic of the position.

Suggestion 3: Ask the net to give a value estimate after each opponent move in suggestion 2. Train it, of course, as in 2.

Motivation: To give Leela an even deeper appreciation of the position and its possibilities, and a stronger consistency demand/sanity check. Please note that we do NOT ask Leela to "evaluate this position" here, but rather, we are asking, "from this position, after these two moves, what is your evaluation"? This forces some kind of appreciation of impact of various mini-changes to the position.

Suggestion 4: Ask Leela to produce a 4-ply deep pv. Train it by inspecting if it actually chose the first move, then the next move if yes, until the 4th ply.

Motivation: Asking this question, and training it, will force Leela to actually compose some most likely ordered line from all the insights gathered in the above 2-3 suggestions, and thus develop an even better understanding of the balance of dynamics in the position.

To sum up: The common trait of these 4 suggestions is that we are asking Leela questions that we know from human experience are fundamental to comprehending a chess position. The beauty is that we have a means to train Leela's answers to the questions, and train her to be extremely strong at answering them. And, we can make her integrate the knowledge from all parts into the same net, just like policy and value are already integrated.

Not that it matters much for the merit of these ideas (I don't have much if any experience with Neural Networks and I probably overlook hundreds of things), but a humble word on my background so the ideas here can maybe more easily be taken seriously: I was on Team Rybka, worked with Noomen on the tournament book for Rybka, won one of the Freestyle tournaments solo and was runner up twice, and I had a significant role in the creation of the IDeA tree environment in Aquarium. My Fide Elo is about 2175.

I know these ideas won't be tested any day soon, but hopefully we can have a rich discussion of ideas like this and eventually we can work on such stuff to make Leela not just as strong, but much, much stronger than Alpha Zero and Stockfish! Please give me all your comments and criticism!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.