main function

Future<void> main()

Implementation

Future<void> main() async {
  final int vocabSize = 4098;
  final int bigSize = 16; // SHRUNK: From 128 to 16 (Minimum for 4 heads)
  final int blockSize =
      16; // SHRUNK: From 16 to 8 (Your games are only 6 tokens long)
  TransformerDecoder gpt = TransformerDecoder(
    vocabSize: vocabSize,
    embedSize: bigSize,
    encoderEmbedSize: bigSize,
    numLayers: 2, // SHRUNK: From 4 to 1
    numHeads: 4, // SHRUNK: From 4 to 2
    blockSize: blockSize,
  );

  const String weightPath = 'chess_gpt.bin';

  // 1. Try to restore previous state
  bool isLoaded = await loadModuleBinary(gpt, weightPath);
  final uciEngine = UciEngine(gpt);
  uciEngine.startLoop();
}