Git Product home page Git Product logo

Comments (13)

glinscott avatar glinscott commented on August 25, 2024 1

Fixed in 401d25b

from nnue-pytorch.

glinscott avatar glinscott commented on August 25, 2024 1

Ah, we didn't need that with the existing layers. Should be fixed in 36de78f

from nnue-pytorch.

vondele avatar vondele commented on August 25, 2024

hmm, I'd be curious to try some different sizes, any chance for a fix?

from nnue-pytorch.

glinscott avatar glinscott commented on August 25, 2024

Yes, I will take a look. Until it's fixed, if you want to, you can compile nodchip with the different arch, and print out the hash to workaround the problem - that's how I got the original hash :).

from nnue-pytorch.

vondele avatar vondele commented on August 25, 2024

I've started an optimization, will serialize later (couldn't figure out where to print it, honestly).

from nnue-pytorch.

Sopel97 avatar Sopel97 commented on August 25, 2024

Layer stack or feature transformer hash: https://github.com/official-stockfish/Stockfish/blob/76daa88cf878b12a03755dc0550b3fa8e4d19cb1/src/nnue/evaluate_nnue.cpp#L67
Combined hash: https://github.com/official-stockfish/Stockfish/blob/76daa88cf878b12a03755dc0550b3fa8e4d19cb1/src/nnue/evaluate_nnue.cpp#L100

Either print it or remove the checks.

from nnue-pytorch.

glinscott avatar glinscott commented on August 25, 2024

Note that you will need to add a layer into the layers list in serialize.py, but otherwise it shouldn't need any changes.

from nnue-pytorch.

vondele avatar vondele commented on August 25, 2024

Thanks! For changes sizes nothing will be needed right?

from nnue-pytorch.

glinscott avatar glinscott commented on August 25, 2024

No changes required if just adjusting size :).

from nnue-pytorch.

vondele avatar vondele commented on August 25, 2024

I'm not getting it to work, must make a trivial mistake somewhere. I have this change to the trainer:

diff --git a/model.py b/model.py
index fb34284..c1d4724 100644
--- a/model.py
+++ b/model.py
@@ -6,9 +6,9 @@ import torch.nn.functional as F
 import pytorch_lightning as pl
 
 # 3 layer fully connected network
-L1 = 256
-L2 = 32
-L3 = 32
+L1 = 512
+L2 = 16
+L3 = 16
 
 class NNUE(pl.LightningModule):
   """

and this to the player:

diff --git a/src/evaluate.h b/src/evaluate.h
index 8beca2d0a..92cf96df0 100644
--- a/src/evaluate.h
+++ b/src/evaluate.h
@@ -36,7 +36,7 @@ namespace Eval {
   // The default net name MUST follow the format nn-[SHA256 first 12 digits].nnue
   // for the build process (profile-build and fishtest) to work. Do not change the
   // name of the macro, as it is used in the Makefile.
-  #define EvalFileDefaultName   "nn-62ef826d1a6d.nnue"
+  #define EvalFileDefaultName   "nn-f73eccf09644.nnue"
 
   namespace NNUE {
 
diff --git a/src/nnue/architectures/halfkp_256x2-32-32.h b/src/nnue/architectures/halfkp_256x2-32-32.h
index a0fe2e0ad..410465139 100644
--- a/src/nnue/architectures/halfkp_256x2-32-32.h
+++ b/src/nnue/architectures/halfkp_256x2-32-32.h
@@ -35,14 +35,14 @@ using RawFeatures = Features::FeatureSet<
     Features::HalfKP<Features::Side::kFriend>>;
 
 // Number of input feature dimensions after conversion
-constexpr IndexType kTransformedFeatureDimensions = 256;
+constexpr IndexType kTransformedFeatureDimensions = 512;
 
 namespace Layers {
 
 // Define network structure
 using InputLayer = InputSlice<kTransformedFeatureDimensions * 2>;
-using HiddenLayer1 = ClippedReLU<AffineTransform<InputLayer, 32>>;
-using HiddenLayer2 = ClippedReLU<AffineTransform<HiddenLayer1, 32>>;
+using HiddenLayer1 = ClippedReLU<AffineTransform<InputLayer, 16>>;
+using HiddenLayer2 = ClippedReLU<AffineTransform<HiddenLayer1, 16>>;
 using OutputLayer = AffineTransform<HiddenLayer2, 1>;
 
 }  // namespace Layers

but the network fails to load.

A sample checkpoint would be https://drive.google.com/file/d/1iTnABec1Ok771Jo1_kyVEvbvdTYowhtk/view?usp=sharing

Any idea what I might be doing wrong?

from nnue-pytorch.

Sopel97 avatar Sopel97 commented on August 25, 2024

this could be because we're not padding the input dimensions to a multiple of 32 on serialization.

For example if we had a 4->4 affine transform it would naively get serialized like

01 02 03 04 
05 06 07 08
09 10 11 12
13 14 15 16

but what needs to be done is

01 02 03 04 00 00 00 00 ... to 32 bytes
05 06 07 08 00 00 00 00 ... to 32 bytes
09 10 11 12 00 00 00 00 ... to 32 bytes
13 14 15 16 00 00 00 00 ... to 32 bytes

The player probably fails because it expects more data.

from nnue-pytorch.

vondele avatar vondele commented on August 25, 2024

good analysis! That is likely going to be the reason.

from nnue-pytorch.

vondele avatar vondele commented on August 25, 2024

@glinscott works well now... thanks!

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.