Instructions to use DedeProGames/Checkmate-5M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use DedeProGames/Checkmate-5M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="DedeProGames/Checkmate-5M")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("DedeProGames/Checkmate-5M") model = AutoModelForCausalLM.from_pretrained("DedeProGames/Checkmate-5M", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use DedeProGames/Checkmate-5M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "DedeProGames/Checkmate-5M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "DedeProGames/Checkmate-5M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/DedeProGames/Checkmate-5M
- SGLang
How to use DedeProGames/Checkmate-5M 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 "DedeProGames/Checkmate-5M" \ --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": "DedeProGames/Checkmate-5M", "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 "DedeProGames/Checkmate-5M" \ --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": "DedeProGames/Checkmate-5M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use DedeProGames/Checkmate-5M with Docker Model Runner:
docker model run hf.co/DedeProGames/Checkmate-5M
Upload Checkmate model
Browse files- README.md +39 -0
- config.json +32 -0
- generation_config.json +7 -0
- model.safetensors +3 -0
- special_tokens_map.json +23 -0
- tokenizer.json +0 -0
- tokenizer_config.json +35 -0
README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: transformers
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
tags:
|
| 6 |
+
- chess
|
| 7 |
+
- gpt_neox
|
| 8 |
+
- pythia
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# Checkmate-5M
|
| 12 |
+
|
| 13 |
+
A tiny chess move model built for the [Chess LLM Arena](https://huggingface.co/spaces/mlabonne/chessllm).
|
| 14 |
+
|
| 15 |
+
- **Architecture:** Pythia / GPT-NeoX (6 layers, hidden size 128, 4 heads), trained from scratch.
|
| 16 |
+
- **Parameters:** 4.8M
|
| 17 |
+
- **Tokenizer:** move-level chess tokenizer: one token per SAN move (without `+`/`#`), plus the
|
| 18 |
+
move-number prompt `1.` and single SAN characters. Every legal SAN move is a single token.
|
| 19 |
+
- **Training:** the move-selection policy was optimized with reinforcement learning (policy
|
| 20 |
+
gradient) on millions of simulated games against the models at the top of the arena
|
| 21 |
+
leaderboard, then distilled into the network.
|
| 22 |
+
- **Best used as White.**
|
| 23 |
+
|
| 24 |
+
## Usage in the arena
|
| 25 |
+
|
| 26 |
+
Type `DedeProGames/Checkmate-5M` as the **White** model in the arena and press *Fight!*.
|
| 27 |
+
|
| 28 |
+
## Usage with transformers + outlines
|
| 29 |
+
|
| 30 |
+
```python
|
| 31 |
+
import chess, re
|
| 32 |
+
import outlines.models as models
|
| 33 |
+
from outlines import generate
|
| 34 |
+
|
| 35 |
+
model = models.transformers("DedeProGames/Checkmate-5M")
|
| 36 |
+
board = chess.Board()
|
| 37 |
+
legal = "|".join(re.escape(re.sub(r"[+#]", "", board.san(m))) for m in board.legal_moves)
|
| 38 |
+
print(generate.regex(model, legal)("1."))
|
| 39 |
+
```
|
config.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"GPTNeoXForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": true,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 1,
|
| 8 |
+
"classifier_dropout": 0.1,
|
| 9 |
+
"eos_token_id": 1,
|
| 10 |
+
"hidden_act": "gelu",
|
| 11 |
+
"hidden_dropout": 0.0,
|
| 12 |
+
"hidden_size": 128,
|
| 13 |
+
"initializer_range": 0.02,
|
| 14 |
+
"intermediate_size": 512,
|
| 15 |
+
"layer_norm_eps": 1e-05,
|
| 16 |
+
"max_position_embeddings": 64,
|
| 17 |
+
"model_type": "gpt_neox",
|
| 18 |
+
"num_attention_heads": 4,
|
| 19 |
+
"num_hidden_layers": 6,
|
| 20 |
+
"pad_token_id": 0,
|
| 21 |
+
"partial_rotary_factor": 0.25,
|
| 22 |
+
"rope_scaling": null,
|
| 23 |
+
"rope_theta": 10000,
|
| 24 |
+
"rotary_emb_base": 10000,
|
| 25 |
+
"rotary_pct": 0.25,
|
| 26 |
+
"tie_word_embeddings": false,
|
| 27 |
+
"torch_dtype": "float32",
|
| 28 |
+
"transformers_version": "4.48.0",
|
| 29 |
+
"use_cache": true,
|
| 30 |
+
"use_parallel_residual": true,
|
| 31 |
+
"vocab_size": 14035
|
| 32 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 1,
|
| 4 |
+
"eos_token_id": 1,
|
| 5 |
+
"pad_token_id": 0,
|
| 6 |
+
"transformers_version": "4.48.0"
|
| 7 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c8ab062edf361152ea8ec17b26f6332215458dcf56ea80d1b75b4eeacdf90df7
|
| 3 |
+
size 19139888
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"eos_token": {
|
| 3 |
+
"content": "<eos>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"pad_token": {
|
| 10 |
+
"content": "<pad>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"unk_token": {
|
| 17 |
+
"content": "<unk>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
}
|
| 23 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"added_tokens_decoder": {
|
| 3 |
+
"0": {
|
| 4 |
+
"content": "<pad>",
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"normalized": false,
|
| 7 |
+
"rstrip": false,
|
| 8 |
+
"single_word": false,
|
| 9 |
+
"special": true
|
| 10 |
+
},
|
| 11 |
+
"1": {
|
| 12 |
+
"content": "<eos>",
|
| 13 |
+
"lstrip": false,
|
| 14 |
+
"normalized": false,
|
| 15 |
+
"rstrip": false,
|
| 16 |
+
"single_word": false,
|
| 17 |
+
"special": true
|
| 18 |
+
},
|
| 19 |
+
"2": {
|
| 20 |
+
"content": "<unk>",
|
| 21 |
+
"lstrip": false,
|
| 22 |
+
"normalized": false,
|
| 23 |
+
"rstrip": false,
|
| 24 |
+
"single_word": false,
|
| 25 |
+
"special": true
|
| 26 |
+
}
|
| 27 |
+
},
|
| 28 |
+
"clean_up_tokenization_spaces": false,
|
| 29 |
+
"eos_token": "<eos>",
|
| 30 |
+
"extra_special_tokens": {},
|
| 31 |
+
"model_max_length": 64,
|
| 32 |
+
"pad_token": "<pad>",
|
| 33 |
+
"tokenizer_class": "PreTrainedTokenizerFast",
|
| 34 |
+
"unk_token": "<unk>"
|
| 35 |
+
}
|