Instructions to use Leon-LLM/Leon-Chess-71k-20E with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Leon-LLM/Leon-Chess-71k-20E with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Leon-LLM/Leon-Chess-71k-20E")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Leon-LLM/Leon-Chess-71k-20E") model = AutoModelForCausalLM.from_pretrained("Leon-LLM/Leon-Chess-71k-20E") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Leon-LLM/Leon-Chess-71k-20E with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Leon-LLM/Leon-Chess-71k-20E" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Leon-LLM/Leon-Chess-71k-20E", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Leon-LLM/Leon-Chess-71k-20E
- SGLang
How to use Leon-LLM/Leon-Chess-71k-20E with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Leon-LLM/Leon-Chess-71k-20E" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Leon-LLM/Leon-Chess-71k-20E", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Leon-LLM/Leon-Chess-71k-20E" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Leon-LLM/Leon-Chess-71k-20E", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Leon-LLM/Leon-Chess-71k-20E with Docker Model Runner:
docker model run hf.co/Leon-LLM/Leon-Chess-71k-20E
Chess Language Model
This model is a GPT-2-based language model trained on chess game sequences using our unique xLAN notation, focusing on predicting legal chess moves and understanding game dynamics. For more information see GitHub
Model Details
Model Description
- Developed by: Schmid Lars, Maag Jerome
- Model type: GPT-2 adaptation for chess language understanding
- Language(s) (NLP): xLAN (Chess Notation)
Model Sources
- Repository: Leon LLM Chess Research
Uses
Direct Use
The model is intended for predicting chess moves, analyzing game positions, and studying chess strategies.
Out-of-Scope Use
This model is not designed for general language understanding or tasks unrelated to chess.
Bias, Risks, and Limitations
The model reflects the strategies and styles present in the training dataset and may not encompass all possible chess scenarios.
How to Get Started with the Model
To use the model use the Notebooks on GitHub
Training Details
Training Data
The model was trained on the "Leon-LLM/Leon-Chess-Dataset-71k" dataset, sourced from Lichess database (September 2023).
Training Procedure
Preprocessing
Chess games from Lichess were converted from PGN into xLAN as part of the preprocessing.
Training Hyperparameters
- Batch Size: 23
- Epochs: 20
- Learning Rate: 0.0001
Evaluation
Metrics
The model was tested on 3 metrics:
Average Number of Correct Plies: Measures the model's ability to simulate chess games, evaluating the average number of correctly generated plies in 100 games.
Hard Position Accuracy: Assesses the model's handling of 67 challenging chess positions, including unusual castling, pawn promotions, and checkmate scenarios. Success is measured by the model's ability to generate legal moves in these complex positions.
Legal Piece Moves Accuracy: Examines the model's proficiency in keeping the board state various situations, including checks, pinned pieces, and pawn promotions. The metric focuses on the model's understanding of the board state.
Results
Model Architecture
GPT2 config with the following changes:
- VOCAB_SIZE = 75
- N_POSITION = 512
- PAD_TOKEN_ID = 0
- EOS_TOKEN_ID = 74
- Downloads last month
- 5


