GithubHelp home page GithubHelp logo

Comments (5)

lucasart avatar lucasart commented on May 16, 2024 1

I've implemented PackedSfenValue format in c-chess-cli, to generate the training data. You might find this interesting.

It's engine agnostic, and can be used to sample game in any tournament condition you would otherwise run (same as cutechess-cli), not baked into Stockfish. You can specify sample frequency, and PV resolution (resolve tactics and record only non-check PV leave position).

What I'm missing are:

  • unit tests: a few PackedSfenValue records with their binary representation to validate the code.
  • sfMove and ply (currently exported as zero).

from nnue-pytorch.

Sopel97 avatar Sopel97 commented on May 16, 2024

That's cool!

One issue that I see is that we were using stockfish internal units for score, which inadvertedly means any generalization will break that, as cp is the only widely agreed format. I think it's good to try slowly move towards a more standardized representation, but it should be visibly documented for now :)

from nnue-pytorch.

lucasart avatar lucasart commented on May 16, 2024

Since I want to be engine agnostic, I am using:

  • cp for non mate scores: this is natural, and corresponds to what the UI reads when parsing info ... score %d lines.
  • INT16_MAX - X: for mate in X moves.
  • INT16_MIN + Y: for mated in Y moves.

The only thing that all engines seem to agree on is that int16_t is enough. Mate score, however, is where they all disagree. I think SF uses 32000-2*X+1 and -32000+2*Y, so there would some translation there (or perhaps you would just discard mate positions as they are not really useful for training).

from nnue-pytorch.

lucasart avatar lucasart commented on May 16, 2024

While writing the code, I couldn't help but notice

  1. castling encoding is not Chess960 compatible, and that's easy to fix. if you take the castling rooks (of both colors), you will notice that they occupy at most 2 files. so you just need 2*3 extra bits to encode those files. which gives you 228+6=234, still well below 256 bits.
  2. if changing the format is possible (is it?), you may as well correct the way rule50 and fullMove are encoded, just 7 bits for rule50 and 16 for fullMove, the way it was meant to be (instead of the clumsy lower part followed by upper part that is currently implemented).

from nnue-pytorch.

Sopel97 avatar Sopel97 commented on May 16, 2024
  1. I think it should be just possible to mark correct castling rights in the .bin format. Whether it's castling in normal chess or chess960 can be resolved based on the parser state. If you feel like trying to implement it in a backward compatibile way feel free, I don't really care about chess960 personally.
  2. The current implementation is the only backward compatibile fix that was possible to the issue of having only 6 bits for rule50 initially, see https://github.com/nodchip/Stockfish/pull/182/files

from nnue-pytorch.

Related Issues (20)

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.