Views
No views yet
pip install -r requirements.txt1from GarryMoE import ChessPredictionEngine
2
3# Configure expert paths
4expert_paths = {
5 'casual': 'models/casual_expert_balanced_best.pt',
6 'club': 'models/club_expert_balanced_best.pt',
7 'strong': 'models/strong_expert_balanced_best.pt',
8 'elite': 'models/elite_expert_balanced_best.pt'
9}
10router_path = 'models/router.pt'
11
12# Initialize engine
13engine = ChessPredictionEngine(
14 expert_paths=expert_paths,
15 router_path=router_path,
16 inference_mode='hard' # or 'soft', 'top-k'
17)
18
19# Predict next move
20fen_sequence = [
21 "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
22 "rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1"
23]
24
25move, info = engine.predict_next_move(
26 fen_sequence,
27 elo_estimate=1500,
28 time_control="5+3"
29)
30
31if move:
32 print(f"Predicted move: {move.uci()}")models/ directory:casual_expert_balanced_best.ptclub_expert_balanced_best.ptstrong_expert_balanced_best.ptelite_expert_balanced_best.ptrouter.pt1engine = ChessPredictionEngine(
2 expert_paths: Dict[str, str],
3 router_path: str,
4 device: Optional[torch.device] = None,
5 model_config: str = 'large',
6 inference_mode: str = 'hard',
7 top_k: int = 2
8)
9
10# Predict next board state
11predicted_fen, info = engine.predict_next_board(
12 fen_sequence: List[str],
13 elo_estimate: Optional[float] = None,
14 time_control: str = ''
15)
16
17# Predict next move
18move, info = engine.predict_next_move(
19 fen_sequence: List[str],
20 elo_estimate: Optional[float] = None,
21 time_control: str = '',
22 use_constrained_sampling: bool = True,
23 sampling_temperature: float = 1.0,
24 max_sampling_attempts: int = 50
25)