Input: HalfKP features (40,960 dimensions per perspective)
↓
Feature Transformer: 40,960 → 256 (separate for white/black)
↓
ClippedReLU activation
↓
Concatenate: 256 + 256 → 512
↓
Hidden Layer 1: 512 → 32 + ClippedReLU
↓
Hidden Layer 2: 32 → 32 + ClippedReLU
↓
Output Layer: 32 → 1 (centipawn evaluation)
1import torch
2from huggingface_hub import hf_hub_download
3import chess
4
5# Download and load model
6checkpoint_path = hf_hub_download(repo_id="chesshacks_model", filename="pytorch_model.bin")
7checkpoint = torch.load(checkpoint_path, map_location='cpu')
8
9# Load model config
10model_config = checkpoint['model_config']
11
12# Create model instance (you'll need the NNUEModel class)
13# from model import NNUEModel
14# model = NNUEModel(**model_config)
15# model.load_state_dict(checkpoint['model_state_dict'])
16# model.eval()
17
18# Evaluate a position
19# board = chess.Board()
20# score = model.evaluate_board(board)
21# print(f"Evaluation: {score:.2f} centipawns")