❗ PROJE OCAK 2026 TARİHİNDE BİTMİŞ OLUP, 15 KASIM 2026 TARİHİNDE PRİVATE'DEN PUBLİC DURUMA GETİRİLMİŞTİR ❗

Bunner B1 Preview, sıfırdan eğitilmiş 18.5 milyon parametreli bir satranç motorudur.

  • Dosya: bunner_b1_preview.pt - 74.2 MB

  • Config: 256 filtre, 12 blok

  • Parametre: 18.5M

  • Filtre sayısı: 256

  • Blok sayısı: 12

  • Top-1 doğruluk: %38.54 (Lichess bulmaca test seti)

  • Giriş: 19x8x8 düzlem

  • Çıkış: 4096 hamle

  • bunner_b1_preview.pt - Model ağırlıkları

  • config.json - {"filters": 256, "blocks": 12, "params": "18.5M", "top1": "38.54%"}

Kullanmak için:

from huggingface_hub import hf_hub_download
import torch, json, chess, numpy as np
import torch.nn as nn
import torch.nn.functional as F


config_path = hf_hub_download("Akdenizz/bunner-b1-preview", filename="config.json")
model_path = hf_hub_download("Akdenizz/bunner-b1-preview", filename="bunner_b1_preview.pt")

with open(config_path, "r") as f:
    config = json.load(f)


class RSEBlock(nn.Module):
    def __init__(self, f):
        super().__init__()
        self.c1 = nn.Conv2d(f, f, 3, padding=1, bias=False)
        self.b1 = nn.BatchNorm2d(f)
        self.c2 = nn.Conv2d(f, f, 3, padding=1, bias=False)
        self.b2 = nn.BatchNorm2d(f)
    def forward(self, x):
        return F.relu(x + self.b2(self.c2(F.relu(self.b1(self.c1(x))))))

class BunnerB1_Preview(nn.Module):
    def __init__(self, f=256, blocks=12):
        super().__init__()
        self.stem = nn.Sequential(
            nn.Conv2d(19, f, 3, padding=1),
            nn.BatchNorm2d(f),
            nn.ReLU()
        )
        self.tower = nn.Sequential(*[RSEBlock(f) for _ in range(blocks)])
        self.policy_conv = nn.Conv2d(f, 32, 1)
        self.policy_bn = nn.BatchNorm2d(32)
        self.policy_fc = nn.Linear(32*8*8, 256)
        self.to_4096 = nn.Linear(256, 4096)

    def forward(self, x):
        x = self.stem(x)
        x = self.tower(x)
        p = F.relu(self.policy_bn(self.policy_conv(x)))
        p = p.view(p.size(0), -1)
        p = self.policy_fc(p)
        return self.to_4096(p)


device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = BunnerB1_Preview(f=config["filters"], blocks=config["blocks"]).to(device)
model.load_state_dict(torch.load(model_path, map_location=device))
model.eval()


def encode_board(board: chess.Board):
    planes = np.zeros((19, 8, 8), dtype=np.float32)
    piece_map = {
        (chess.PAWN, True): 0, (chess.KNIGHT, True): 1, (chess.BISHOP, True): 2,
        (chess.ROOK, True): 3, (chess.QUEEN, True): 4, (chess.KING, True): 5,
        (chess.PAWN, False): 6, (chess.KNIGHT, False): 7, (chess.BISHOP, False): 8,
        (chess.ROOK, False): 9, (chess.QUEEN, False): 10, (chess.KING, False): 11,
    }
    for sq in chess.SQUARES:
        p = board.piece_at(sq)
        if p:
            idx = piece_map[(p.piece_type, p.color)]
            r, c = 7 - chess.square_rank(sq), chess.square_file(sq)
            planes[idx, r, c] = 1
    planes[12] = 1.0 if board.turn else 0.0
    return torch.from_numpy(planes).float().unsqueeze(0).to(device)


board = chess.Board()
inp = encode_board(board)

with torch.no_grad():
    policy = model(inp)[0]


legal_moves = list(board.legal_moves)
best_move = max(legal_moves, key=lambda mv: policy[mv.from_square * 64 + mv.to_square].item())

print(f"Önerilen hamle: {best_move.uci()}")
Downloads last month
35
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support